Anyways, when you sample from a depth texture in OpenGL, you already get a value between 0 and 1… so switching to the convention for clip coordinates will make everything more consistent. It’s a good decision even if you’re not using Reversed-Z.
![gluperspective opengl es 2.0 gluperspective opengl es 2.0](https://wiki.delphigl.com/images/a/a8/GluPerspective.png)
Give up entirely on the convention, it’s hands-down objectively worse than the convention when it comes to precision. I recommend sticking this line of code at the start of your program, and never changing the clip conventions after that. GlClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE) OpenGL’s default convention is, but you can override that using glClipControl: Reversed-Z is designed for clip-space Z values in the range, not. So, how to use it in OpenGL? Here’s a no-nonsense step-by-step guide.
![gluperspective opengl es 2.0 gluperspective opengl es 2.0](https://www.i-programmer.info/images/stories/News/2012/AUG/A/openglcorearch.jpg)
Reversed-Z visualized: Near objects have a higher Z value than far objects.