glEnable(GL_DEPTH_TEST) - nothing rendered

后端 未结 3 535
傲寒
傲寒 2020-12-31 02:49

In OpenGL, I display a simple model. When I enable the depth buffer,

glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);

3条回答
  •  滥情空心
    2020-12-31 03:30

    If the other answer does not work, Try what user886079 mentioned in a comment

    If the above doesn't work, check your near plane in the gluPerspective, glFrustum, or glOrtho function. Depth buffering doesn't seem to work if it is set to 0.

    I had tried almost everything but could not solve the overlapping issue. I had put the near value 0.0f. I changed it to 0.01f and the results now are how it needed to be.

提交回复
热议问题