Posted by
Sven Gothel on
Mar 25, 2014; 6:19am
URL: https://forum.jogamp.org/Question-About-Annimation-tp4032059p4032064.html
On 03/25/2014 02:29 AM, Mike [via jogamp] wrote:
> So let me see if I understand this; when one uses an animator class (e.g.
> FPSAnimator) without sub-classing it all one is doing is saving the work of
> writing the loop to call the display function iteratively.
>
> Am I to assume that as one would like more advanced animations, one then
> sub-classes an animator class and adds code to control the more advanced
> animation?
>
> I think I'm going to have more questions on this as I work more closely with
> the first few examples in the tutorial, but I want to make sure I understand
> your reply for now.
The GLAnimatorControl implementations (Animator, FPSAnimator)
are helping to periodically issue a 'display()' call on the attached
GLAutoDrawable.
Further more, since GLAnimatorControl is attached to one or more
GLAutoDrawable, it makes the latter aware of the existence of such
periodically refreshing thread.
This allows GLAutoDrawable to defer a display() call,
i.e. allow the animator to handle it guaranteeing fluent updates.
This is documented in GLAutoDrawable, see invokeGL(..) etc.
Further, in case of NEWT or GLCanvas, the native windowing toolkit's update
will _not_ issue a display() call if an animator is attached and animating
for the same reasons.
Animation of objects in a scene is a different subject,
here you probably want to look into keyframe based animation,
i.e. changing rendering parameters over time.
f(t,..) -> f', with t [t0..t1]
Of course, any animation will benefit from proper 'in time'
display update cycles, which is guaranteed if using the Animator
based on v-sync if enabled -> glSwapInterval(1).
~Sven
>
> Thanks,
> Mike
>