Prevent onPause from trashing OpenGL Context

前端 未结 4 1599
鱼传尺愫
鱼传尺愫 2020-12-04 22:30

I\'m writing an Android application that uses OpenGL ES (GLSurfaceView and GLSurfaceView.Renderer). The problem is that when the user switches applications and then switches

4条回答
  •  南方客
    南方客 (楼主)
    2020-12-04 23:18

    It's been a while since I worked with OpenGL and it was the standard sort on desktop pc's, but I seem to remember standard OpenGL doesn't require a reload of textures on context switch. Of course, that doesn't really help in this case.

    Assuming the textures have to be reloaded, the question becomes: how do you speed this up? And then the question becomes, just how many textures do you need at any one time and can you load them on demand? What are their dimensions? I recall that powers of two were usually faster to load, though that may also depend on the OpenGL implementation and drivers.

    I've also heard about keeping a context somewhere where it won't get destroyed, somewhat like this thread: opengles view switching problem

提交回复
热议问题