Depth testing isn't working (hopefully the images below describe, I'll gladly describe more when asked) for me, and I can't seem to figure out why.
GL initialization:
glEnable(GL_CULL_FACE);
//glFrontFace(GL_CW);
glDisable(GL_LIGHTING);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glShadeModel(GL_FLAT);
glEnable(GL_DEPTH_TEST);
glDepthMask(true);
glDepthFunc(GL_LESS);
//glDepthRange(-100.0, 100.0);
Pre-drawing:
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(this->camera.zoom, drx::gfx::ogl::ar, -100.0, 100.0);
this->camera.CameraLookAt();
/* Camera function */
drx::util::SPOT center = this->position.Add(this->front);
gluLookAt(this->position.x, this->position.y, this->position.z, center.x, center.y, center.z, this->up.x, this->up.y, this->up.z);
Some drawing:
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, tx.id);
glBegin(GL_TRIANGLE_FAN);
//glColor3ub(tri.color.red, tri.color.green, tri.color.blue);
glTexCoord2f(u[0], v[0]);
glVertex3d(a.x, a.y, a.z);
glTexCoord2f(u[1], v[1]);
glVertex3d(b.x, b.y, b.z);
glTexCoord2f(u[2], v[2]);
glVertex3d(c.x, c.y, c.z);
glEnd();
glDisable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, 0);
Which then result to:
If I disable depth testing and look at from just the right angle, I get:
Update 1: Tried to set glClearDepth, still same.
glClearDepth(200.0);