renderOneFrame() time oscillation

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
overtired
Gnoblar
Posts: 14
Joined: Tue Oct 23, 2018 1:32 pm
x 1

renderOneFrame() time oscillation

Post 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()?
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: renderOneFrame() time oscillation

Post 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
Post Reply