I rotate the box around X axis
those are images taken when running my code:
I used glEnable(GL_DEPTH_TEST)
, and glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
before drawing.
why?
CodePudding user response:
Your window (default framebuffer) doesn't have a depth buffer at all. You have to setup a OpenGL window with a depth buffer by using the sf::ContextSettings
class.
See Using OpenGL in a SFML window:
ContextSettings settings;
settings.depthBits = 24;