glReadPixels doesn't read depth buffer values on iOS

前端 未结 1 779
陌清茗
陌清茗 2020-12-18 08:30

I can\'t seem to read the depth buffer values in OpenGL ES2 on iOS 4.3

afDepthPixels = (float*)malloc(sizeof(float) * iScreenWidth * iScreenHeight);
glReadPi         


        
相关标签:
1条回答
  • 2020-12-18 09:01

    As you guess, reading the depth buffer isn't supported in ES 2.x. Per the glReadPixels man page (direct from Khronos) the only permissible values for 'format' in ES 2 are GL_ALPHA, GL_RGBA and GL_RGB.

    From memory, depth textures are supported on recent versions of iOS, so it should be possible to run a pixel shader to convert a depth buffer into something you can read as RGBA if you're otherwise at a dead end.

    0 讨论(0)
提交回复
热议问题