PDA

View Full Version : pbuffer bug on linux/nvidia?



eldritch
09-20-2002, 04:15 AM
I have a weird problem with pbuffers on linux with nvidia hardware. When I use glReadPixels or glCopyTexImage2d, the bottom row and right column of the image is garbled.

I have a small example here: http://www.simula.no/~thomasse/pbuffer_bug.jpg

This is taken from the NvSDK pbuffer example. The source code for this example with makefile for linux is here: http://www.simula.no/~thomasse/simple_pbuffer.tgz

This problem occurs with all versions of the driver that supports pbuffers (including 3123), on GF2 and GF3 on various linux distributions.

Any ideas?

Asgard
09-20-2002, 04:41 AM
I've got the exact same problem on Mandrake Linux 8 with the latest NVIDIA Linux drivers. I'm using glCopyTexSubImage to do render-2-texture and also get garbage at the edges of the resulting texture.

tayo
09-20-2002, 05:23 AM
Same problem on linux...
does anyone know if the same problem exist on windows?
but you can resolve the problem :

- create the pbuffer with 1 more pixel in width and height
- render with into the pbuffer with glViewport(0,1,width,height)
- read the pixels like this :
glReadPixels( 0, 1, _width, _height, GL_RGB, GL_UNSIGNED_BYTE,itemBuffer);

eldritch
09-20-2002, 05:51 AM
hmm.. I tried to use the glViewport/glReadpixels(0,1, w, h). hack, but it doesn't work for all pbuffer sizes. It works for a 256x256 pbuffer, but for 512x512 the stripes were back again...

tayo
09-20-2002, 08:19 AM
Originally posted by eldritch:
hmm.. I tried to use the glViewport/glReadpixels(0,1, w, h). hack, but it doesn't work for all pbuffer sizes. It works for a 256x256 pbuffer, but for 512x512 the stripes were back again...

It works for me with 512x512 pbuffer :-)
Don't forget you have to create a pbuffer with one additional pixel so a 513x513 pbuffer.
It is still a ugly hack...

jra101
09-20-2002, 08:24 AM
This is a known issue and should be fixed in a future driver release.

heath
10-11-2002, 07:46 PM
Here is a (temporary) fix/hack.

glBindTexture(GL_TEXTURE_RECTANGLE_NV,m_PBufferTex Object);
glBegin(GL_QUADS);
{
#ifdef linux_x86
glTexCoord2i(0, 1); glVertex2i(0,0);
glTexCoord2i(gCanvasWidth()-1, 1); glVertex2i(gCanvasWidth(),0);
glTexCoord2i(gCanvasWidth()-1, gCanvasHeight()-1); glVertex2i(gCanvasWidth(),gCanvasHeight());
glTexCoord2i(0, gCanvasHeight()-1); glVertex2i(0,gCanvasHeight());
#else
glTexCoord2f(0.0f, 0.0f); glVertex2f(0.0f,0.0f);
glTexCoord2f(gCanvasWidth(), 0.0f); glVertex2f(gCanvasWidth(),0.0f);
glTexCoord2f(gCanvasWidth(), gCanvasHeight()); glVertex2f(gCanvasWidth(),gCanvasHeight());
glTexCoord2f(0.0f, gCanvasHeight()); glVertex2f(0.0f,gCanvasHeight());
#endif
}
glEnd();
glDisable(GL_TEXTURE_RECTANGLE_NV);


Hope it helps.

Heath.