View Full Version : surport Z buffer,render some object and then read the z_buffer

07-06-2006, 04:09 AM
some time I have abandoned my work on this topic,but now i think i should comlete it.So I want my project surport z buffer,but under windous(not use glut),then render some objects and then scan the z buffer to obtain the data.
please anybody help me,one tiny branch or simple example is very useful. Thank you!

07-06-2006, 09:54 PM
glEnable( GL_DEPTH_TEST );
glClear( all );
draw someit
glReadPixels(.... GL_DEPTH_COMPONENT .... );

07-07-2006, 08:11 PM
Thank you!
A algorithm said:
glutInitDisplayMode(GLUT_DEPTH) is need,
but glut doesn`t fit windouws(VC frame work)
so is it needed?
And can this algorithm make sure it is hardware acceleration?
Thank you!

07-08-2006, 03:50 AM
When you are selcting the pixelformat for your window, make shure you set the depth bit parameter in the pixeldescriptor to a value greater then zero. Current hardware usually supports 24bit depth buffer. To check your pixelformat for a depth buffer use DescribePixelFormat and test the corresponding parameter of the pixeldescriptor record.
Depth buffers are supported by all 3d hardware singe 15 years, so accleleration won't be a problem. oO

07-14-2006, 01:24 AM
the capacity can be set? and the area?
that means i want to desingate special area ,set its capacity and get its z-buffer. Is it doable?

07-14-2006, 04:35 AM
I don't quite understand what are you talking about :-/

The depth buffer is common for the whole window. Once you set it's capacity (bit depth) it is constant.
To get data from the depth buffer use ReadPixels.

I hope you do know how to set OpenGL up in a window, if not - just google for it. MSDN library also has some nice examples.