PDA

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



T.james
07-06-2006, 03: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!

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

T.james
07-07-2006, 07: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!

Zengar
07-08-2006, 02: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

T.james
07-14-2006, 12: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?

Zengar
07-14-2006, 03: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.