Error in opengl: stack underflow

A forum for discussing development work on the Ardor3D core systems. Basically, anything that is in the ardor3d-core, math or savable modules.
Forum rules
Developer discussions only. Newbie questions belong in the HELP! forum. This is a forum for discussing development work on the Ardor3D core systems. Basically, anything that is in the ardor3d-core, math or savable modules.

Error in opengl: stack underflow

Postby runiter » Wed Feb 15, 2012 10:47 am

I just updated ardor3d from svn and now I can't run my project. I get the following error now with nothing appearing on canvas:

Code: Select all
com.ardor3d.util.Ardor3dException: Error in opengl: stack underflow
   at com.ardor3d.renderer.jogl.JoglRenderer.checkCardError(JoglRenderer.java:621)
   at com.ardor3d.renderer.jogl.JoglRenderer.flushFrame(JoglRenderer.java:223)
   at com.ardor3d.framework.jogl.JoglCanvasRenderer.draw(JoglCanvasRenderer.java:207)
   at com.ardor3d.framework.jogl.JoglAwtCanvas.draw(JoglAwtCanvas.java:60)
   at com.ardor3d.framework.FrameHandler.updateFrame(FrameHandler.java:90)
   at org.concord.energy3d.scene.SceneManager.run(SceneManager.java:320)
   at java.lang.Thread.run(Thread.java:662)
Sign this petition to demand Oracle remove Ask Toolbar from Java: https://www.change.org/petitions/oracle ... -installer
User avatar
runiter
regular
 
Posts: 612
Joined: Fri Oct 23, 2009 8:50 am
Location: Boston, MA, USA

Re: Error in opengl: stack underflow

Postby peq » Thu Feb 16, 2012 3:27 am

Same here.

Googling tells me this happens when...
"You are popping something off a matrix that doesn't have anything on it. Check to make sure that your push/pops line up."
My country is the world and my religion is to do good.
Thomas Paine
User avatar
peq
regular
 
Posts: 102
Joined: Fri Apr 01, 2011 12:48 am

Re: Error in opengl: stack underflow

Postby runiter » Thu Feb 16, 2012 9:55 am

yeah something must be broken in JOGL. maybe it's due to upgrading to JOGL 2.0?
Lwjgl works fine.

Renanse? gouessej?
Sign this petition to demand Oracle remove Ask Toolbar from Java: https://www.change.org/petitions/oracle ... -installer
User avatar
runiter
regular
 
Posts: 612
Joined: Fri Oct 23, 2009 8:50 am
Location: Boston, MA, USA

Re: Error in opengl: stack underflow

Postby renanse » Thu Feb 16, 2012 2:58 pm

Are you using the jogl2 renderer with the latest core code? The jogl2 renderer may not be updated when we added geometry instancing support?
Gratitude is a mark of a noble soul and a refined character.
User avatar
renanse
Site Admin
 
Posts: 2955
Joined: Tue Oct 28, 2008 6:49 pm
Location: Austin, TX

Re: Error in opengl: stack underflow

Postby runiter » Fri Feb 17, 2012 8:50 am

I'm not sure! I didn't intentionally use jogl2. I was using jogl1 bundled with ardor3D, then I fetched the latest update from ardor3d svn and suddenly it stopped working.
Did you replace jogl1 with jogl2 in ardor3d or is it still jogl1?
Sign this petition to demand Oracle remove Ask Toolbar from Java: https://www.change.org/petitions/oracle ... -installer
User avatar
runiter
regular
 
Posts: 612
Joined: Fri Oct 23, 2009 8:50 am
Location: Boston, MA, USA

Re: Error in opengl: stack underflow

Postby renanse » Fri Feb 17, 2012 9:49 am

No, it's still jogl1, so that's not it. So either there's so specific combination that produces a bug in the new code, or you have some code that deals directly with renderer?
Gratitude is a mark of a noble soul and a refined character.
User avatar
renanse
Site Admin
 
Posts: 2955
Joined: Tue Oct 28, 2008 6:49 pm
Location: Austin, TX

Re: Error in opengl: stack underflow

Postby gouessej » Mon Feb 20, 2012 8:33 am

I don't know what is wrong, I will look at "my" JOGL 2.0 renderer.

As far as I know, this problem does not come from JOGL. It is highly probable that it does not come from the JOGL renderer of Ardor3D too because it very rarely uses push and pop operations. Can you tell me which build introduces this regression if any?

Edit.: I have looked at the changes done in the last 3 months and I see nothing that could cause such a regression in the JOGL 1 renderer. The JOGL 2.0 renderer doesn't yet contain the changeset 1795, 1798 and 1799.

Edit.: Use DebugGL to find which OpenGL call (pop) happens when the stack is empty.

P.S: You should intentionally use the JOGL 2.0 renderer so that bugs are found and fixed earlier. The legacy renderer should be removed in my humble opinion.
gouessej
regular
 
Posts: 1186
Joined: Fri May 01, 2009 3:26 am
Location: France

Re: Error in opengl: stack underflow

Postby gouessej » Mon Feb 20, 2012 3:44 pm

I reproduce this regression:
[java] Exception in thread "main" java.lang.RuntimeException: com.ardor3d.util.Ardor3dException: Error in opengl: stack underflow
[java] at jogamp.opengl.GLRunnableTask.run(GLRunnableTask.java:63)
[java] at jogamp.opengl.GLDrawableHelper.execGLRunnables(GLDrawableHelper.java:229)
[java] at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:178)
[java] at com.jogamp.newt.opengl.GLWindow$DisplayAction.run(GLWindow.java:636)
[java] at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:422)
[java] at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:361)
[java] at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:562)
[java] at jogamp.opengl.GLDrawableHelper.invoke(GLDrawableHelper.java:287)
[java] at com.jogamp.newt.opengl.GLWindow.invoke(GLWindow.java:541)
[java] at com.ardor3d.framework.jogl.JoglNewtWindow.draw(JoglNewtWindow.java:160)
[java] at engine.service.Ardor3DGameServiceProvider.start(Ardor3DGameServiceProvider.java:273)
[java] at engine.service.Ardor3DGameServiceProvider.main(Ardor3DGameServiceProvider.java:161)
[java] Caused by: com.ardor3d.util.Ardor3dException: Error in opengl: stack underflow
[java] at com.ardor3d.renderer.jogl.JoglRenderer.checkCardError(JoglRenderer.java:622)
[java] at com.ardor3d.renderer.jogl.JoglRenderer.flushFrame(JoglRenderer.java:224)
[java] at com.ardor3d.framework.jogl.JoglCanvasRenderer.draw(JoglCanvasRenderer.java:208)
[java] at com.ardor3d.framework.jogl.JoglNewtWindow$3.run(JoglNewtWindow.java:163)
[java] at jogamp.opengl.GLRunnableTask.run(GLRunnableTask.java:57)
[java] ... 11 more
[java] Caused by: javax.media.opengl.GLException: stack underflow
[java] at com.ardor3d.renderer.jogl.JoglRenderer.checkCardError(JoglRenderer.java:619)
[java] ... 15 more


When I revert all changes done between the 8th of December 2011 and now in ardor3d-core and ardor3d-jogl2, it works just fine. This bug is a regression of Ardor3D, not a regression of JOGL. I'm still investigating.

Edit.: bug not reproducible with the revision 1790

Edit.: bug not reproducible with the revision 1796

Edit.: the bug comes from the revision 1799. I'm still investigating

Edit.: the bug comes from the class trunk/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Mesh.java in the method render(final Renderer renderer, final MeshData meshData). @Renanse, you call renderer.undoTransforms(_worldTransform) too much, I don't know why and I'm falling asleep. @Runiter It is not a JOGL bug of course; if even glPopMatrix and glPushMatrix were broken in JOGL 1.1.1a, Sven and me would have noticed that, lots of people would have reported such a big bug.

Edit.: my game crashes a few seconds after calling makeCopy, when rendering 2 identical weapons.
gouessej
regular
 
Posts: 1186
Joined: Fri May 01, 2009 3:26 am
Location: France

Re: Error in opengl: stack underflow

Postby runiter » Mon Feb 20, 2012 5:51 pm

thanks for investigating this gouessej, i hope the info you provided will help renanse figure out the source of the problem. If it's indeed related to push and pop then it should be fairly easy to fix.
Sign this petition to demand Oracle remove Ask Toolbar from Java: https://www.change.org/petitions/oracle ... -installer
User avatar
runiter
regular
 
Posts: 612
Joined: Fri Oct 23, 2009 8:50 am
Location: Boston, MA, USA

Re: Error in opengl: stack underflow

Postby gouessej » Mon Feb 20, 2012 6:07 pm

runiter wrote:thanks for investigating this gouessej, i hope the info you provided will help renanse figure out the source of the problem. If it's indeed related to push and pop then it should be fairly easy to fix.

You're welcome. However, fixing this bug is not trivial for me because I have only a tiny experience on mesh instancing and the source code is quite difficult to understand. We should have updated our build of Ardor3D earlier, I feel quite guilty. This bug is not reproducible on very simple examples.
gouessej
regular
 
Posts: 1186
Joined: Fri May 01, 2009 3:26 am
Location: France

Next

Return to Core Development Discussions

Who is online

Users browsing this forum: No registered users and 1 guest

cron