Re: New to JOGL / NEWT
Posted by
Sven Gothel on
Dec 30, 2010; 3:30pm
URL: https://forum.jogamp.org/New-to-JOGL-NEWT-tp2157407p2167984.html
On Thursday, December 30, 2010 00:23:57 Demoscene Passivist [via jogamp] wrote:
>
> >I then saw somewhere that using FPSAnimator was not recommended
> > as it behaves differently on windows / linux and can have drift /
> > innacurate results. Is this true?
>
> I only have experience with the FPSAnimator on Windows XP/Vista/7 and its
> works ok'isch there. The timing difference/inaccuracy is ~20ms wich is ~1-2
> frames if u assume 60 frames per second. So its ok but not perfect.
>
> I would recommend using Animator in conjunction with v-sync to get accurate
> timings for ur rendering and only use FPSAnimator as a fallback, when v-sync
> is not available on the platform.
Exactly.
If you don't want to render every frame, than you can toggle every other frame etc
using the set swap buffer interval method (see the Gears example in the unit tests).
Only with vsync you are guaranteed to have correct timings anyways.
>
> The code snippet I referred to in my previous posting contains code for both
> methods (vsync+fpsanimator).
>
> >In which case do I simply enforce my own timings using Animator and
> thread.sleep();
> >methods on animator? If so, then what is the point of animator? It just
> seems to be a
> >thread that ticks and calls display ... although I guess it is creating
> GLEvents? Could I
> >not simply not use the Animator and instead write a simpler Thread class
> with my
> >own timings?
>
> I would not recommend using a "custom" thread for ur display() loop as there
> are some subtle multithreading issues involved when calling methods on a
> GLAutoDrawable. So better leave the threading stuff to the JOGL helper
> classes or be 120% sure u know what u do
If neither animator suits you, feel free to implement your own GLAnimatorControl implementation.
This would allow seamless integration of your custom animator thread to the GLAutoDrawable
lifecycle.
~Sven