How to get Z values from Z Buffer

ε祈祈猫儿з 提交于 2019-12-07 08:04:31

问题


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


回答1:


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).



来源:https://stackoverflow.com/questions/4499999/how-to-get-z-values-from-z-buffer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!