Jump to content
  • Advertisement
Sign in to follow this  
AmeNeko

Problem with faces not being obscured

This topic is 4746 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
Advertisement
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
Oh I'm dumb ;) Was clearing the depth buffer incorrectly anyway. No problems now. I always find the answer to my problem after I ask someone heh...

Share this post


Link to post
Share on other sites
In that case you'll have to give some more information. What do you mean by GREATER(no text) or GEQUAL(shows everything)? And you're clearing the depth buffer every frame I trust?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!