How to limit framerate when using Android's GLSurfaceView.RENDERMODE_CONTINUOUSLY?

后端 未结 6 912
自闭症患者
自闭症患者 2020-12-12 16:53

I have a C++ game running through JNI in Android. The frame rate varies from about 20-45fps due to scene complexity. Anything above 30fps is silly for the game; it\'s just b

6条回答
  •  旧巷少年郎
    2020-12-12 17:33

    Fili's answer looked great to me, bad sadly limited the FPS on my Android device to 25 FPS, even though I requested 30. I figured out that Thread.sleep() works not accurately enough and sleeps longer than it should.

    I found this implementation from the LWJGL project to do the job: https://github.com/LWJGL/lwjgl/blob/master/src/java/org/lwjgl/opengl/Sync.java

提交回复
热议问题