Page 1 of 1

renderOneFrame() time oscillation

Posted: Thu Nov 08, 2018 5:09 pm
by overtired
Hello, everyone!
I am trying to make an android app with ogre. I would prefer to use ogre with java binding, but it is not problem to recompile the shared library with some changes.

I create a scene (light source, camera, viewport, texture on background, nothing else) and begin calling renderOneFrame() on each frame from java side (using android handler). I would like to have stable 60 fps, but renderOneFrame() takes different time from ~5ms to ~45ms, commonly about 15-18ms which leads to notable lags.

Does anybody know why is it going on and what depends on?
All I need from the ogre engine for now is to place some models and play animations. Maybe I can remove some unnecessary for me code from renderOneFrame()?

Re: renderOneFrame() time oscillation

Posted: Thu Nov 08, 2018 6:47 pm
by paroj
Without having much experience with this, I would guess the way we call renderOneFrame in the JNI Sample is not very clever.

A quick googling on the topic revealed this
- https://gamedev.stackexchange.com/quest ... lgl-es-2-0
- https://source.android.com/devices/grap ... -gameloops

renderOneFrame() automatically calls eglSwapBuffers when it is done. You may want to experiment with doing it manually by using external GL control.
https://ogrecave.github.io/ogre/api/lat ... 2f6e6c847e

In case this property is not fully implemented on Android, you can comment out eglSwapBuffers here:
https://github.com/OGRECave/ogre/blob/m ... w.cpp#L145