Advertisement

GL_DEPTH_COMPONENT?

Started by March 25, 2002 11:14 PM
1 comment, last by xilinshen 22 years, 11 months ago
I wrote: " 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; zubber is an array; I want to get the depth component of an object on the screen, why the value from the zbuffer are all 1.0, no matter it related to a point on the object or a point on the background? I am very confused about it, and waiting for someone''s help
I''m not sure but try passing &zbuffer.
Advertisement
It may be 1.0 if you haven''t enabled GL_DEPTH_TEST while drawing.

Do this :

glEnable(GL_DEPTH_TEST);
draw_my_stuff();

Also, check the depth range.
if you call glDepthRange(1.0, 1.0) then your depth components will always be 1.0

This topic is closed to new replies.

Advertisement