animator.stop

is it necessary to call animator.stop() before exiting a JOGL application?

while on the topic of the animator object -> is it really necessary at all? from what i can tell, the animator sets up a program loop, right? at first i thought “no, there must be more to it…,” but then i looked and it only has the 2 methods.

either i’m missing out on something, or the animator is useless.

Sure one can write the same functionality that is offered by Animator…but that would be re-inventing the wheel, wouldn’t it? The Animator sets up a thread that will cause continuous calls to the display method occur. The class mainly makes it easier to keep your program clean of JOGL threading issues, since by using it, you don’t need to pollute your program with tedious details that arise with multithreaded OpenGL context access, etc.

alright, new question

in the example code listed on these forums, the animator object is declared using final. is there any particular reason why?

if i declare the animator outside the method and initialize inside, it compiles and runs fine. will this create problems for me later?

public class Controller{
  Animator animator;
  ...
  public void start(){
    ...
    animator.start();
    ...
  }
  ...
  public void closeApp(int code){
    ...
    animator.stop();
    System.exit(code);
  }
}