Android EGL/OpenGL ES Frame Rate Stuttering

前端 未结 2 848
醉话见心
醉话见心 2021-02-04 07:20

TL;DR

Even when doing no drawing at all, it seems impossible to maintain a 60Hz update rate on an OpenGL ES rendering thread on an Android device. Myste

2条回答
  •  醉梦人生
    2021-02-04 08:10

    You are not binding the framerate yourself. So it's bound by CPU.

    Which means that it will run fast when the CPU has nothing to do and slower when it's doing other stuff.

    Other stuff is running on your phone, which occasionally takes CPU time from your game. Garbage Collector will also to this, although not freezing your game like it used to do (since it now runs in a separate thread)

    You would see this happen on any multiprogramming operating system that was in normal use. It's not just Java's fault.

    My suggestion: bind the framerate to a lower value if constant bitrate is required. Hint: use a mix of Thread.sleep() and busy waiting (while loop), since sleep might go over the required waiting time.

提交回复
热议问题