Jump to content
  • Advertisement

Archived

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

Null and Void

OGL: Ortho+Depth buffer problems

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

Since this is my first program in OpenGL using an orthographic setup, I''m wondering what I''m doing wrong getting the depth buffer to work with it. I know that when using Ortho you can setup it up so that the Z-Value gets larger as you go into the screen, this is how I set it up. I have a 16 bit Z-Buffer set up also. I make the Z-Value larger to place objects farther into the screen, so that objects infront of them are rendered that way. But, no matter what way I arrange the values et cetera, the last quad rendered is always the one in front. Yes, I''ve made sure that I''m not translating incorrectly, and I''m sure that depth testing is enabled... Is there is any suggestions that I could get as to what I''m doing wrong? If you need more information about my problem I''ll be glad to give it. Thanks in advance.
http://www.gdarchive.net/druidgames/

Share this post


Link to post
Share on other sites
Advertisement
<< I make the Z-Value larger to place objects farther into the screen>>
not to sure what u mean by that it does sound a bit suspect though.

glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glClearDepth(1)



http://members.xoom.com/myBollux

Share this post


Link to post
Share on other sites
Yeah, I have both glEnable(GL_DEPTH_TEST) and glDepthFunc(GL_LEQUAL) at the beginning of my program. What I meant was that I make the z-value (as in glVertex3f(x,y,z-value)) larger (as in add a positive value to it) to place it behind something else. I set up the program so that the larger the z-value of something is, the "further away" from the viewport it is. I thought that maybe I should make it smaller (as in add a negative value to it) or even make them negative (they''re behind the near clipping plane it this case), but, the last one rendered is always the one infront...



http://www.gdarchive.net/druidgames/

Share this post


Link to post
Share on other sites
that doesnt seem right can u post your code?
did u try glDepthFunc(GL_GREATER)

http://members.xoom.com/myBollux

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!