Depth Buffer in OpenGL -
Trying to attract some rectangles while using OpenGL, but some of them should be visible below the rectangle.
I am using I am using gluLookAt at the beginning of each draw. Here is an image of the problem. Blue rectangles are placed with higher Y values than green rectangles. As you can see in the top image some green rectangle appears above why any idea of Blue is happening and I What can I do to fix it? Can there be something to do with that sequence that I am underlining the rectangles? glClearDepth (1.0f) to enable depth function; GlDepthFunc (GL_LESS); GlEnable (GL_DEPTH_TEST);
color buffer Are you also cleaning the depth buffer?
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
Are you sure the image is not correct? Some of those green squares actually look more than blue / blue.