View Full Version : :( trouble reading back the stencil buffer

08-11-2005, 10:21 AM
I have an trouble trying to read back the stencil buffer of a floating point pbuffer (128 bits/pixel) with depth and stencil buffer. Everything is ok while I'm not trying to read back the stencil.
glReadPixels on the color :( buffer works fine
If I try to read back the stencil buffer the call to glReadPixels with GL_STENCIL_INDEX, the call lock.
I'd like to know if someone ever had this trouble, or if a previous driver can fix it.
I'm stuck on it, any help would be really great.
My graphics card is a
Quadro FX 4400 (driver 77.18).

ps : it works fine if the pbuffer is not floating point.

08-11-2005, 10:30 AM
Ok, I fixed it, the lock happens if the type given to glReadPixels is GL_FLOAT, if GL_UNSIGNED_INT it works fine.
But shouldn't it works in both cases as it does for a non floating point pbuffer, or with the regular framebuffer ?

08-11-2005, 11:18 AM
As far as I know, stencil buffers exclusively use integers.

08-11-2005, 12:14 PM
I know, but "if type is GL_FLOAT, then each integer index is converted to single-precision floating-point format" (opengl documentation). In some cases you might want the hw do the int->float conversion for you.
But anyway it's not a big deal while there is a way to make it works.