OpenGL ES depth buffer android, can't get to work

后端 未结 3 559
一向
一向 2021-01-06 01:14

I\'m unable to get the depth buffer working correctly on Android OpenGL ES 2.0. Regardless of what I do, the objects are always render in the order provided and completely i

3条回答
  •  情话喂你
    2021-01-06 01:42

    I had the same problem. I fixed it by using a 24-bit depth buffer instead of the default, which is 16 bits (so selecting a 16-bit depth buffer won't make any difference). I used

    myGlSurfaceView.setEGLConfigChooser(8,8,8,8,24,0);

    Incidentally I had the same problem, with effectively the same solution, on iOS (my code is a portable map renderer, so I need it to run on lots of platforms). The iOS fix was to call

    self.drawableDepthFormat = GLKViewDrawableDepthFormat24;

    in the init function of my GLKView-derived class.

提交回复
热议问题