Advertisement

confused with zbuffer

Started by March 25, 2002 09:58 PM
0 comments, last by xilinshen 22 years, 11 months ago
hello, helper, I use the following code to get the depth component of the pixels on the screen: glReadPixels(0, 0, viewport[2], viewport[3], GL_DEPTH_COMPONENT, GL_FLOAT, zbuffer); viewport[2] is the width of the window; viewport[3] is the height of the window; If I want to get the depth value of a pixel with coord (x,y) from the zbuffer, shall I use zbuffer[ x + y * viewport[2] ] or zbuffer[ x * viewport[3] + y ]? Thanks!
It''s in OpenGL Specification

Answer : the first one.

Please read the manual next time.

This topic is closed to new replies.

Advertisement