Skip to main content
GameDev.net gamedev.net
🔒 Locked

Depth Errors [Solved]

Started by KodeNerd Nov 30, 2008 at 12:52 AM 2 replies 550+ views
Original Post
KodeNerd
KodeNerd
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]
------------George Gough
V-man
V-man
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.
KodeNerd
KodeNerd
Without shaders the problem still persists.

[Edit]
I did remove the line you said also. Thanks for the performance tip.
------------George Gough
KodeNerd
KodeNerd
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.
------------George Gough

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.