View Full Version : PBuffer - depth component
11-19-2003, 05:24 AM
is it possible to use glReadPixels from the pbuffer (wglCreatePbufferARB) in the same way like from the frame buffer? i'd like to read DEPTH_COMPONENT but i have the blank buffer after the rendering.
(NVIDIA GeForce4 MX440, true color).
11-19-2003, 05:57 AM
Did you remember to request a depth buffer when creating your pbuffer? If so, how many bits do you request?
11-19-2003, 07:23 AM
you also must remember to enable depth testing for the pbuffer (glEnable(GL_DEPTH_TEST)), or else rendering will have no effect on the depth buffer, even if it does in fact exist.
It's also worth noting that depending on how you set up your Frustum and how you render you geometry, the variation in z-values may be very subtle. It might look like you have a blank (eg. white) pbuffer, but it may simply be that the precision isn't there to see the different values.
For testing, move your far plane in (and/or your near plane out) so that your geometry fills up more of the space between the two planes. That'll make the variation more obvious.
11-19-2003, 09:40 PM
i asked for 32 in the ChoosePixelFormat, but i obtained just 16 bits in truecolor mode.
so i set the depth bits to 16 (higher values did not work):
complete atributes array for the wglChoosePixelFormatARB looks like this:
the array of pbuffer attributes for the wglCreatePbufferARB is empty (just zero terminated).
did i omit something?
Your settings look reasonable. Try calling glError() during your setup code to see if you are getting any errors.
IIRC 32 bit z-depth may not be supported by your card. 24bit is most likely the maximum. (That leaves 8bits for stencil if you want it). I could be wrong though, perhaps some cards will let you use 32bit as long as you don't ask for stencil.
24 bits should work on your card.
11-19-2003, 11:20 PM
> 24 bits should work on your card.
yes, you're right. when i asked for 24 depth bits in ChoosePixelFormat i got them.
also pbuffer with 24 bits was created afterwards.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.