Possible to skip a display() call when using an Animator?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Possible to skip a display() call when using an Animator?

farrellf
I use a GLCanvas and an Animator to draw things. At the beginning of display(), before actually drawing things, I do a bunch of checks and math. That code also happens to let me know if I actually need to redraw this frame. Is it possible to check if a call to display() was required (maybe the window was resized, etc.) or if it can be skipped? And if it can be skipped, how do I do that?

I know I could just render to an off screen framebuffer, and blit that on screen. But "just" blitting on every vsync still uses a lot of processing power. It would be best if I could abort display() calls entirely.

Thanks,
-Farrell
Reply | Threaded
Open this post in threaded view
|

Re: Possible to skip a display() call when using an Animator?

kit89
You could implement your own equivalence of the Animator class. From a quick glance at the documentation it drives the call to display() at a rate it seems appropriate.

For my own code I drive the call to display() manually with a call to swaBuffers() on the canvas.

You'll need to ensure the context is set to run on the current thread.