How to get Z values ​​from Z Buffer

I have problems with drawing in OpenGL, and I need to pinpoint which values ​​fit in the depth buffer. Can someone tell me how to get these values? thanks Chris

+4
source share
1 answer

Use glReadPixels with format = GL_DEPTH_COMPONENT, for example:

float depth; glReadPixels(0, 0, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth); 

Get the pixel depth (0, 0).

+8
source

Source: https://habr.com/ru/post/1332901/


All Articles