Texturing and depth testing


I have a problem with texture mapping and depht testing.
When I render a few polygons with mapped textures and each of them is on another Z position. I always see the polygon which has the smallest Z value doesn’t matter where is camera positioned in the scene. So that’s why I set glEnable(GL_DEPTH_DEST) but then polygons are “crashing” when for example I make a scene rotation. Is there any way to fix it without depht testing?

did you remember to do a

also if you are using glut you might want to put this in your code as well
glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); The GLUT_DEPTH is the new part. the other parts are up to do depending on your needs.

Yes. I have the line:

now i’m searching for some mistake in my program, i’ve got NeHe’s tutorial and if I render the polygons there all is OK!
I have to work a little so I will find the problem!

I don’t use GLUT.

thanks anyway

I did find the error!
It was in gluPerspective - zNear = 0
One small mistake, i changed zNear when I experimented with fonts. This error crashes all of polygons… wondering.