In OpenGL, I display a simple model. When I enable the depth buffer,
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
everything disappears. I read this OpenGL FAQ, but it didn't help me.
My perspective settings are: angle=45deg
, near=1
, far=40
, I put model at (0,0,0)
and I place my eye at (0,0,4)
. Without the Z-buffer, I can see the model.
What could be wrong?
winding order
of your vertices ifGL_CULL_FACE
is enabled; and you have to clear theGL_COLOR_BUFFERT_BIT | GL_DEPTH_BUFFER_BIT)
... – Francis Cugler