Hello, It is possible to replace Animator, you have to be careful with threads but the only things to do is calling display (the GLJPanel takes care of calling init method first, you don’t have to call it yourself).
I use Executors, very powerful Threads manipulations which lets you create Scheduling capabilities when using ScheduledExecutorService :
ScheduledExecutorService autoDisplayExecutor = Executors.newSingleThreadScheduledExecutor();
autoDisplayExecutor.scheduleWithFixedDelay(displayRunnable, 0, 22, TimeUnit.MILLISECONDS);
This code will call a Runnable in a SingleThread every 22 Milliseconds (approximately 30 fps). If the treatment of displayRunnable is longer, the next call will be differed. This is exactly the same behaviour of the FPSAnimator, it tries to keep a level of FPS.
Here you have the runnable
Runnable displayRunnable = new Runnable()
{
public void run()
{
gljpanel.display();
}
};
If you want a normal Animator and not a FPSAnimator you could simply use an ExecutorService.
With this scheduleexecutor you can execute other Runnable in the queue like this
autoDisplayExecutor.execute(reinitBufferRunnable);
The Executor will assure the thread safety, it will not execute displayRunnable until reinitBufferRunnable has done.