Archived

This topic is now archived and is closed to further replies.

GL_DEPTH_BUFFER_BIT

This topic is 5148 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a little problem. I am rotating an object behind another object and the one that rotates always showed kind of infront of the other which I understand from others is a common thing. I was told that I had to use glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); in my reshape function. I also have in my display function glLoadIdentity(); glClearColor(0.0, 0.0, 0.0, 1.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); This solved the problem with the object rotating behind the other one and the parts of it that actually are behind it are not displayed. However it posed a new problem. The object that I rotate about seems now to be kind of semi transparent. I have it on a grid and I can see the lines through the object. Does anyone understand what I am saying and can maby help me with this.

Share this post


Link to post
Share on other sites
That is probably because the z-component of your grid coordinates are in front of the objects being drawn. Try drawing the grid with a z-component that is behind the objects.

Share this post


Link to post
Share on other sites