by MichaelEGR » Sat Jun 11, 2011 12:05 am
How I accomplish this in TyphonRT is through a callback clock / timing system. Essentially it's sort of like a do while thread sleep(1) loop. Kind of a spin wait, but the sleep will yield as necessary. In the old days we used the yield() method instead of sleep, but that increases processor usage especially for laptops and most definitely for Android devices. In the TyphonRT clocking system there is a subdivided int clock. Essentially you can set the min subdivision to 60hz and 2 subdivisions are 30hz, 3 = 20hz, 4 = 15hz, etc. It's fast and accurate enough and you can not only adjust the callbacks, but you can have callbacks at different FPS / ratios (IE maybe AI running at 15hz callbacks). If you want to render at 20hz you assign the callback that does the GL rendering and eglSwapBuffers call to the 3rd subdivision. I'll be releasing TyphonRT soon...
Founder & Principal Architect; EGR Software LLC
http://www.typhonrt.org
http://www.egrsoftware.com