Depth Buffer causes artifacts

Started by
3 comments, last by Boltimus 15 years, 9 months ago
Hi everyone, I'm using openGL to simply draw the Earth. The problem is, when I turn on depth buffering I get artifacts that look like this: If I turn if off, then it looks normal as below: has anyone else seen this? Thanks! Bolt
~Bolt"All men dream: but not equally. Those who dream by night in the dusty recesses of their minds wake in the day to find that it was vanity: but the dreamers of the day are dangerous men, for they may act their dreams with open eyes, to make it possible." This I did...
Advertisement
That looks like a problem with either your projection matrix, the polygon depth values, or the depth func is reversed (glDepthFunc(GL_GREATER))
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
Give us the code where you create the projection matrix.
Quote:Original post by agi_shi
Give us the code where you create the projection matrix.


Okay, I won't be able to post until tomorrow. Thanks in advance for the help!
~Bolt"All men dream: but not equally. Those who dream by night in the dusty recesses of their minds wake in the day to find that it was vanity: but the dreamers of the day are dangerous men, for they may act their dreams with open eyes, to make it possible." This I did...
Quote:Original post by V-man
That looks like a problem with either your projection matrix, the polygon depth values, or the depth func is reversed (glDepthFunc(GL_GREATER))


Thanks for both of your replies.. Agi and Mr. "V". As it turns out, it was my projection matrix. I set the near plane too small. :(
~Bolt"All men dream: but not equally. Those who dream by night in the dusty recesses of their minds wake in the day to find that it was vanity: but the dreamers of the day are dangerous men, for they may act their dreams with open eyes, to make it possible." This I did...

This topic is closed to new replies.

Advertisement