PDA

View Full Version : gluLookAt & depth culling



wmelgaard
10-29-2014, 10:38 AM
I have a model 0.0 < z < 30.0. The default gluLookAt(0,-100,0, 0,0,0, 0,1,0); looks at the bottom of the model. If I rotate the model, the bottom of the model occludes anything above it.
If I change to gluLookAt(0,100,0, 0,0,0, 0,1,0); the model disappears completely.
???

Does it matter if gluLookAt is in glMatrixMode(GL_PROJECTION) or glMatrixMode(GL_MODEL)?

Dark Photon
10-29-2014, 05:41 PM
I have a model 0.0 < z < 30.0. The default gluLookAt(0,-100,0, 0,0,0, 0,1,0); looks at the bottom of the model. If I rotate the model, the bottom of the model occludes anything above it.
If I change to gluLookAt(0,100,0, 0,0,0, 0,1,0); the model disappears completely.
???

glDisable( GL_CULL_FACE );
glDisable( GL_DEPTH_TEST );

And retry. Start debugging with that.


Does it matter if gluLookAt is in glMatrixMode(GL_PROJECTION) or glMatrixMode(GL_MODEL)?

Yes! First, there's no GL_MODEL (in the fixed-function pipeline); it's GL_MODELVIEW. And second, gluLookAt is a VIEWING transform so it goes into MODELVIEW. Check this out:

* http://sjbaker.org/steve/omniv/projection_abuse.html