pbuffer bug on linux/nvidia?

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?

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.

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);

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…

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 :slight_smile:
Don’t forget you have to create a pbuffer with one additional pixel so a 513x513 pbuffer.
It is still a ugly hack…

This is a known issue and should be fixed in a future driver release.

Here is a (temporary) fix/hack.

  glBindTexture(GL_TEXTURE_RECTANGLE_NV,m_PBufferTexObject);
  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.