Flickering Objects

I’m trying to display a cube built out of triangles. All the information is stored in an array of structures and then drawn:

glVertexPointer(3, GL_FLOAT, sizeof(Vertex), &vertices[0].position);
glNormalPointer(GL_FLOAT, sizeof(Vertex), &vertices[0].normal);
glTexCoordPointer(2, GL_FLOAT, sizeof(Vertex), &vertices[0].texCoord);
glDrawElements(GL_QUADS, 4, GL_UNSIGNED_INT, indices);

the problem I’m having though is that when depth buffering is enabled everything flickers as the objects rotated etc.

Dont suppose anyone knows what could possibly be going wrong??

Cheers.

well, if its just when the depth buffer is enabled its probably z-fighting. Either bump out your near clipping plane, or pull in the far one. This may help

That sounds a lot like you aren’t using double buffering, although if it really only happens when you are using the depth buffer, it could be something else, but I’m not sure what.

Awww thankyou so much. it was my near and far planes, can’t believe how stoopid i was. This has been bugging me for weeks!