Error in opengl: stack underflow
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.
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.
26 posts
• Page 2 of 3 • 1, 2, 3
Re: Error in opengl: stack underflow
Hi
I can investigate a bit more but I will need some help as I don't feel "comfortable" with mesh instancing. I'm going to find one simple example crashing because of the change in the revision 1799.
I can investigate a bit more but I will need some help as I don't feel "comfortable" with mesh instancing. I'm going to find one simple example crashing because of the change in the revision 1799.
- gouessej
- regular
- Posts: 1186
- Joined: Fri May 01, 2009 3:26 am
- Location: France
Re: Error in opengl: stack underflow
CollisionTreeExample crashes immediately because of this bug.
- gouessej
- regular
- Posts: 1186
- Joined: Fri May 01, 2009 3:26 am
- Location: France
Re: Error in opengl: stack underflow
@Renanse, please try my patch:
### Eclipse Workspace Patch 1.0
#P ardor3d-core
Index: src/main/java/com/ardor3d/scenegraph/Mesh.java
===================================================================
--- src/main/java/com/ardor3d/scenegraph/Mesh.java (revision 1799)
+++ src/main/java/com/ardor3d/scenegraph/Mesh.java (working copy)
@@ -275,8 +275,11 @@
}
}
+ final boolean transformed;
if (primcount <= 0) { // means no instancing
- renderer.doTransforms(_worldTransform);
+ transformed = renderer.doTransforms(_worldTransform);
+ } else {
+ transformed = false;
}
// Apply shader states here for the ability to retrieve mesh matrices
@@ -292,7 +295,9 @@
}
if (primcount <= 0) { // means no instancing
- renderer.undoTransforms(_worldTransform);
+ if (transformed) {
+ renderer.undoTransforms(_worldTransform);
+ }
break;
}
It seems to work but you say that primcount <= 0 means "no instancing" in Mesh but primcount < 0 means "no instancing" in both renderers.
@runiter you can use my JARs if you want, the fix is already in ardor3d-core-0.8-SNAPSHOT.jar in my SVN repository for the prebeta version of TUER.
### Eclipse Workspace Patch 1.0
#P ardor3d-core
Index: src/main/java/com/ardor3d/scenegraph/Mesh.java
===================================================================
--- src/main/java/com/ardor3d/scenegraph/Mesh.java (revision 1799)
+++ src/main/java/com/ardor3d/scenegraph/Mesh.java (working copy)
@@ -275,8 +275,11 @@
}
}
+ final boolean transformed;
if (primcount <= 0) { // means no instancing
- renderer.doTransforms(_worldTransform);
+ transformed = renderer.doTransforms(_worldTransform);
+ } else {
+ transformed = false;
}
// Apply shader states here for the ability to retrieve mesh matrices
@@ -292,7 +295,9 @@
}
if (primcount <= 0) { // means no instancing
- renderer.undoTransforms(_worldTransform);
+ if (transformed) {
+ renderer.undoTransforms(_worldTransform);
+ }
break;
}
It seems to work but you say that primcount <= 0 means "no instancing" in Mesh but primcount < 0 means "no instancing" in both renderers.
@runiter you can use my JARs if you want, the fix is already in ardor3d-core-0.8-SNAPSHOT.jar in my SVN repository for the prebeta version of TUER.
- gouessej
- regular
- Posts: 1186
- Joined: Fri May 01, 2009 3:26 am
- Location: France
Re: Error in opengl: stack underflow
This functionality was a donation from the community (which I appreciate). And always good to have eyes on it from the community as well.
I've redone Mesh some. There is a small amount of code duplication now, but it is clearer and I personally prefer it to more method nesting. You jogl patch is in as well with a small tweak to get it to compile.
Gratitude is a mark of a noble soul and a refined character.
-

renanse - Site Admin
- Posts: 2955
- Joined: Tue Oct 28, 2008 6:49 pm
- Location: Austin, TX
Re: Error in opengl: stack underflow
Hi!
I agree with you and I wish I will make some donations too this year.
That's why I would like more people to use the JOGL 2.0 renderer.
It's much readable than the source code obtained after applying my patch, thanks.
My patch was ready to use for the JOGL 2.0 renderer, the renderer that should replace the legacy one. I used the same "trick" for JMonkeyEngine 3 but I had never tested it
I should have checked that earlier, that's my task, I'm officially the person responsible for engine support in the JogAmp Foundation:
http://jogamp.org/wiki/index.php/Maintainer_and_Contacts
renanse wrote:This functionality was a donation from the community (which I appreciate).
I agree with you and I wish I will make some donations too this year.
renanse wrote:And always good to have eyes on it from the community as well.
That's why I would like more people to use the JOGL 2.0 renderer.
renanse wrote:I've redone Mesh some. There is a small amount of code duplication now, but it is clearer and I personally prefer it to more method nesting.
It's much readable than the source code obtained after applying my patch, thanks.
renanse wrote:Your jogl patch is in as well with a small tweak to get it to compile.
My patch was ready to use for the JOGL 2.0 renderer, the renderer that should replace the legacy one. I used the same "trick" for JMonkeyEngine 3 but I had never tested it
I should have checked that earlier, that's my task, I'm officially the person responsible for engine support in the JogAmp Foundation:
http://jogamp.org/wiki/index.php/Maintainer_and_Contacts
- gouessej
- regular
- Posts: 1186
- Joined: Fri May 01, 2009 3:26 am
- Location: France
Re: Error in opengl: stack underflow
Hi there,
Sorry for the bug (I guess the patch was bound to have some issues
) But I'm afraid the same can be said about the current ardor version. It breaks instancing 
I've supplied a patch that fixes this (in the new code style), adds more comments to all functions and enables users to set the min/max batch sizes in the InstancingManager.
The version currently in the ardor repo does not apply the transforms in the case where the instancing manager decides to fall back to normal rendering. This happens when the number of visible meshes is smaller than the MinBatchSize : This prevents the additional overhead of instancing on small batches (one or two meshes).
I guess we should write something about all this on the wiki
Grts!
Peter
Sorry for the bug (I guess the patch was bound to have some issues
I've supplied a patch that fixes this (in the new code style), adds more comments to all functions and enables users to set the min/max batch sizes in the InstancingManager.
The version currently in the ardor repo does not apply the transforms in the case where the instancing manager decides to fall back to normal rendering. This happens when the number of visible meshes is smaller than the MinBatchSize : This prevents the additional overhead of instancing on small batches (one or two meshes).
I guess we should write something about all this on the wiki
Grts!
Peter
- Attachments
-
ardor3d-core.zip- Instancing fix
- (2.54 KiB) Downloaded 57 times
Peter Heil
http://caromble.com
http://caromble.com
- pjotter
- regular
- Posts: 68
- Joined: Fri May 22, 2009 2:51 am
- Location: Utrecht, The Netherlands
Re: Error in opengl: stack underflow
Hi Peter
I have just looked at your patch. Please can you give it a try with one of the JOGL renderers so that I'm sure my trick with unindexed buffers works?
I have just looked at your patch. Please can you give it a try with one of the JOGL renderers so that I'm sure my trick with unindexed buffers works?
- gouessej
- regular
- Posts: 1186
- Joined: Fri May 01, 2009 3:26 am
- Location: France
Re: Error in opengl: stack underflow
The current version works great with my project.
Thanks very much gouessej
Thanks very much gouessej
Sign this petition to demand Oracle remove Ask Toolbar from Java: https://www.change.org/petitions/oracle ... -installer
-

runiter - regular
- Posts: 612
- Joined: Fri Oct 23, 2009 8:50 am
- Location: Boston, MA, USA
Re: Error in opengl: stack underflow
runiter wrote:The current version works great with my project.
Thanks very much gouessej
You're welcome. You should not use mesh instancing while Peter's fixes are not integrated.
- gouessej
- regular
- Posts: 1186
- Joined: Fri May 01, 2009 3:26 am
- Location: France
Re: Error in opengl: stack underflow
The patch is in svn. Thanks Peter. And no need to apologize for bugs especially since you are nice enough to provide a fix too. 
Gratitude is a mark of a noble soul and a refined character.
-

renanse - Site Admin
- Posts: 2955
- Joined: Tue Oct 28, 2008 6:49 pm
- Location: Austin, TX
26 posts
• Page 2 of 3 • 1, 2, 3
Return to Core Development Discussions
Who is online
Users browsing this forum: No registered users and 0 guests