android / ndk-samples

Android NDK samples with Android Studio
http://developer.android.com/ndk
Apache License 2.0
9.97k stars 4.15k forks source link

Remove odd engine_draw_frame call patterns. #1006

Closed DanAlbert closed 2 months ago

DanAlbert commented 2 months ago

It looks like whoever wrote this just kept adding draw calls until it worked. For some reason if I removed the call from APP_CMD_INIT_WINDOW (which really shouldn't have needed to render), or added an if (!animating) early exist to engine_draw_frame, it would prevent the app from ever rendering. I never figured out why, but in any case the most important call is the one that was missing: the one in APP_CMD_GAINED_FOCUS. That's why the rendering wouldn't start until you tapped the screen. I added that and now all the calls that appear superfluous in fact are.

Depends on https://github.com/android/ndk-samples/pull/1005.