OGL: Ortho+Depth buffer problems

Started by
3 comments, last by Null and Void 23 years, 3 months ago
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/
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
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/
It''s ok I guess. I put a sorting algoritm together to render the furthest first, and the closest last. It is just as good except that I have to bind new textures more often...


http://www.gdarchive.net/druidgames/
that doesnt seem right can u post your code?
did u try glDepthFunc(GL_GREATER)

http://members.xoom.com/myBollux

This topic is closed to new replies.

Advertisement