Menu

Depth Testing

Using GLFW
2015-06-01
2015-06-01
  • Ankit singh kushwah

    Hi Everyone..
    Do you guys know how to enable depth testing in glfw? :-)
    Thank you

     
  • Bastiaan Olij

    Bastiaan Olij - 2015-06-01

    Hi Ankit,

    If I'm not mistaken the depth buffer itself is created by default unless you specify otherwise. After that it just a matter of enabling it in the standard way:

    glEnable(GL_DEPTH_TEST);

    Make sure to clear the depth buffer at the start of your render loop:
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

     
    • Ankit singh kushwah

      Thank you Bastiaan! :-)