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 > glClearDepth (1.0f) to enable depth function; GlDepthFunc (GL_LESS); GlEnable (GL_DEPTH_TEST);

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.

alt text

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?

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.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -