Using glClear()
you can set the buffer specified by the parameter to 0.0
. This is useful say if you want pixels not covered by models to be black. Because vec3(0.0, 0.0, 0.0)
results in black.
But for the depth buffer, clearing means to set it to the maximum value 1.0
since you don't want pixels not covered by models to have the depth 0.0
which is the camera's position but to have the depth 1.0
which means as far away as possible.
So how can I clear the depth buffer to 1.0
or come over this issue in another way?