Jump to content
  • Advertisement
Sign in to follow this  
KodeNerd

Depth Errors [Solved]

This topic is 3665 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 not been able to come up with a reason why depth testing refuses to work in my application. I have the following in my source before rendering:
	glClearDepth(1.0);
	glEnable(GL_DEPTH_TEST);
	glDepthFunc(GL_LEQUAL);


Along with a projection matrix (which is generated by myself but comes out to exactly what they had) with a near plane not zero. My shaders: Fragment
void main() {

	gl_FragColor = gl_Color;

}


Vertex
uniform mat4 Projection_Matrix;
uniform mat4 Modelview_Matrix;

void main() {

	gl_Position = Projection_Matrix * Modelview_Matrix * gl_Vertex;

	gl_ClipVertex = Modelview_Matrix * gl_Vertex;


	gl_FrontColor = gl_Color;

}


The matrices are uploaded to the respective matrix variables as displayed in the vertex shader. Can anyone pinpoint what I am doing wrong? [Edited by - KodeNerd on November 30, 2008 5:27:47 PM]

Share this post


Link to post
Share on other sites
Advertisement
I didn't see any problem. Is depth testing working without shaders?
Have eyou tried commenting out
gl_ClipVertex = Modelview_Matrix * gl_Vertex;

because it runs very slow on ATI radeon 9700 last time I tried. It was like software rendering.

Share this post


Link to post
Share on other sites
Nevermind. I found out that the problem was that I enabled depth testing before I created a window.

Thanks for all of your help though.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!