Using GLField with the Animation API

If you use the Animation API with a GLField, you must update your Animator at the same rate as the GLField.

Both the GLField and Animator classes enable you to set a target frame rate. But when you use them together, you should synchronize the update rates by handling the Animator update from within the GLField update() method. Doing so will ensure that the Animator and GLField are updated at the same frame rate.

The following code snippet demonstrates overriding the GLField update() method to have it update the Animator. This ensures that the Animator is synchronized with the GLField.

private Animator _animator;

protected void initialize(GL g)
    // ...
    _animator = new Animator(0);
    // add animations to animator

public void update()
Next topic: Shader programs
Previous topic: GLField

Was this information helpful? Send us your comments.