开发者

How to get Z values from Z Buffer

开发者 https://www.devze.com 2023-01-31 20:09 出处:网络
I\'m having problems with drawing in OpenGL and I need开发者_运维问答 to see exactly what values are being placed in the depth buffer. Can anyone tell me how to retrieve these values?

I'm having problems with drawing in OpenGL and I need开发者_运维问答 to see exactly what values are being placed in the depth buffer. Can anyone tell me how to retrieve these values? Thanks Chris


Use glReadPixels with format = GL_DEPTH_COMPONENT, for example:

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

Will get the depth of pixel (0, 0).

0

精彩评论

暂无评论...
验证码 换一张
取 消