stack under/over-flow exception...

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

stack under/over-flow exception...

ThomasR
I get the following exception running Jogamp's Ardor3D Continuation:
Hello,

Exception in thread "Thread-4" com.jogamp.opengl.GLException: Caught RuntimeException: com.ardor3d.util.Ardor3dException: Error in opengl: stack underflow on thread Thread-4
    at com.jogamp.opengl.GLException.newGLException(GLException.java:76)
    at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1327)
    at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147)
    at com.jogamp.opengl.awt.GLCanvas$12.run(GLCanvas.java:1438)
    at com.jogamp.opengl.Threading.invoke(Threading.java:223)
    at com.jogamp.opengl.awt.GLCanvas.display(GLCanvas.java:505)
    at jogamp.opengl.GLDrawableHelper.invoke(GLDrawableHelper.java:912)
    at com.jogamp.opengl.awt.GLCanvas.invoke(GLCanvas.java:1118)
    at com.ardor3d.framework.jogl.awt.JoglAwtCanvas.draw(JoglAwtCanvas.java:101)
    at com.ardor3d.framework.FrameHandler.updateFrame(FrameHandler.java:90)

I'm trying to run multiple independent JFrames in an Ardor3D based app. The first JFrame is fine, opening  another
generates the above with some weird flashing between the two frames and then garbage is seen. It happens using
both JoglAwtCanvas and JoglNewtCanvas but not JoglSwingCanvas. I'm running on OS X

Tom
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: stack under/over-flow exception...

gouessej
Administrator
Please reproduce your bug with an existing example or provide a SSCCE. In my humble opinion, your threading is wrong and you implicitly manipulate an empty stack. Enable the debug in the canvas renderer in order to find the culprit.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: stack under/over-flow exception...

ThomasR
Problem goes away if I process FrameHandler.init() and FrameHandler.updateFrame() for different canvases across multiple JFrames from the *same*, single user Thread? I will put together a SSCCE but thought this was interesting, perhaps instructive even. So what is the proper threading model for Jogamp's Ardor3D based applications. What threads are allowed to initialize and update the Scene. I'm assuming the Swing and ATW Canvases should be created on the EDT
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: stack under/over-flow exception...

gouessej
Administrator
Yes it's constructive but it will be easier to judge when I'll see your source code. Some limitations are GPU and/or OS specific, keep it in mind.

Do you use the same canvas renderer?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: stack under/over-flow exception...

ThomasR
Thanks. IMHO, probably not gpu/OS limitation - Java3D + JOGL has always handled multiple, independent JFrames.

Each JFrame has its own unique CanvasRenderer. You also mentioned turning on debug - how to do that?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: stack under/over-flow exception...

gouessej
Administrator
The use case you describe typically works on my machine with JogAmp's Ardor3D Continuation, please post a SSCCE so that I have something to test and to give me a chance to reproduce your problem.

There is a debug parameter in the canvas renderer.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: stack under/over-flow exception...

gouessej
Administrator
In reply to this post by ThomasR
I've just run the bloom example, the extrusion example and the dynamic smoker example in the same Java program (a single main entry point) and it works as expected:
diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/ExampleRunner.java b/ardor3d-examples/src/main/java/com/ardor3d/example/ExampleRunner.java
index a3fd849..383609e 100644
--- a/ardor3d-examples/src/main/java/com/ardor3d/example/ExampleRunner.java
+++ b/ardor3d-examples/src/main/java/com/ardor3d/example/ExampleRunner.java
@@ -1027,11 +1026,19 @@ public class ExampleRunner extends JFrame {
             UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
         } catch (final Exception e) {
         }
-        final ExampleRunner app = new ExampleRunner();
-        app.setIconImage(getIcon("ardor3d_white_24.png").getImage());
-        app.setSize(800, 400);
-        app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-        app.setLocationRelativeTo(null);
-        app.setVisible(true);
+        for (int i = 0; i < 3; i++) {
+            new Thread(new Runnable() {
+
+                @Override
+                public void run() {
+                    final ExampleRunner app = new ExampleRunner();
+                    app.setIconImage(getIcon("ardor3d_white_24.png").getImage());
+                    app.setSize(800, 400);
+                    app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                    app.setLocationRelativeTo(null);
+                    app.setVisible(true);
+                }
+            }).start();
+        }
     }
 }


Please run my example and post the FULL stack traces if any.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: stack under/over-flow exception...

ThomasR
In reply to this post by gouessej
Will do, thanks! Just double-checking on any obvious problems on my part and try to develop some sense of the workflow.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: stack under/over-flow exception...

ThomasR
Can't get this SSCCE to fire the Exception. Anything obviously wrong? I was running this source with one of our Java3D applications as an intermediate step. I wonder if that could be a problem?

DisplayA3D.java
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: stack under/over-flow exception...

gouessej
Administrator
I can't guarantee that Java3D doesn't pick the wrong OpenGL context but it's not a problem with JogAmp's Ardor3D Continuation. You should check which context is used by Java3D and which context is used by JogAmp's Ardor3D Continuation, you should compare them with the created contexts.
Julien Gouesse | Personal blog | Website
Loading...