The solution to this is to write your own animator, and insert a Thread.yield() statement. There isn't much to writing an Animator, just create a thread with a reference to your GLCanvas and call display() on it. The tricky part to this is when you want to stop the animator you made, because if you try to stop your animator while display is being called, you get errors like some kind of swapping problem (and I seem to recall there was another issue too that was related to fullscreen).
import net.java.games.jogl.*;
import java.awt.event.*;
public class CustomAnimator implements ,Runnable {
GLCanvas canvas;
boolean running = true;
Thread thread = null;
public CustomAnimator(GLCanvas canvas) {
this.canvas = canvas;
thread = new Thread(this);
}
public synchronized void start() {
thread.start();
}
public synchronized void stop() {
running = false;
while (thread != null) {
//Make sure run completes
try {
wait();
} catch (InterruptedException ie) {
}
}
}
public void run() {
canvas.setRenderingThread(thread);
while (running) {
if (canvas != null) {
canvas.display();
} else {
running = false;
}
Thread.yield();
}
synchronized (CustomAnimator.this) {
thread = null;
CustomAnimator.this.notify();
}
}
}
Note: I pulled a lot of my own code out of this to make it a bare bones animator so there might be some compile errors, this will run just like the regular animator, except it yields every loop (stepping aside so that other threads can run if they want). It's possible and easy to change it so that animation stops when the window loses focus or is iconified by implementing WindowListener and keeping a variable like 'paused' and only calling display() when paused is true. There is also an FPSAnimator creeping around the forums too that can be used, personally I think my version is an easier base to work off of.