Re: getting a swing application to run my simple jogl application, it goes into an infinite loop of creating windows instead of displaying graphics
Posted by
Wade Walker on
Mar 10, 2011; 11:05pm
URL: https://forum.jogamp.org/getting-a-swing-application-to-run-my-simple-jogl-application-it-goes-into-an-infinite-loop-of-creats-tp2655798p2662737.html
As Justin pointed out, the problem is your code looks like this:
public SimpleScene() {
...
canvas.addGLEventListener(new SimpleScene());
...
}
This is a recursive function call, probably not what you intended

If you do this instead, it uses the existing SimpleScene instead of creating a new one:
public SimpleScene() {
...
canvas.addGLEventListener(this);
...
}
This is why I always suggest stepping through the code in a debugger -- often you can spot the problem in just a few moments, and save yourself the pain of editing and posting your code and hoping for people to reply