Sign in to follow this  

Problem with faces not being obscured

This topic is 4556 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

Ok so the deal is, if I load and display a complex object everything seems ok. But when I rotate the object, faces that should be at the back(facing the camera, not facing back, just covered by other polys) are showing through to the front. Back face culling and depth sorting are both on... glDepthFunc(GL_GEQUAL); glCullFace(GL_BACK); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE);

Share this post


Link to post
Share on other sites
You want glDepthFunc(GL_LEQUAL);

According to the redbook:
Quote:

void glDepthFunc(GLenum func);
Sets the comparison function for the depth test. The value for func must be GL_NEVER,
GL_ALWAYS, GL_LESS, GL_LEQUAL, GL_EQUAL, GL_GEQUAL, GL_GREATER, or
GL_NOTEQUAL. An incoming fragment passes the depth test if its z value has the specified
relation to the value already stored in the depth buffer. The default is GL_LESS, which means that
an incoming fragment passes the test if its z value is less than that already stored in the depth
buffer. In this case, the z value represents the distance from the object to the viewpoint, and
smaller values mean the corresponding objects are closer to the viewpoint.

Share this post


Link to post
Share on other sites
Yeah I had fiddled around with that setting a bit, if its anything but GREATER(no text) or GEQUAL(shows everything) I get nothing at all. I'm using data I generate in Blender, then export to my own format containing a list of all verts and a list of faces containing indices to each vert.

Share this post


Link to post
Share on other sites

This topic is 4556 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this