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.

Re: Error in opengl: stack underflow

Postby gouessej » Tue Feb 21, 2012 3:21 am

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.
gouessej
regular
 
Posts: 1186
Joined: Fri May 01, 2009 3:26 am
Location: France

Re: Error in opengl: stack underflow

Postby gouessej » Tue Feb 21, 2012 3:15 pm

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

Postby gouessej » Tue Feb 21, 2012 3:38 pm

@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.
gouessej
regular
 
Posts: 1186
Joined: Fri May 01, 2009 3:26 am
Location: France

Re: Error in opengl: stack underflow

Postby renanse » Tue Feb 21, 2012 9:10 pm

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.
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 » Wed Feb 22, 2012 5:56 am

Hi!

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 :oops:

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

Postby pjotter » Wed Feb 22, 2012 2:21 pm

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 :P

Grts!

Peter
Attachments
ardor3d-core.zip
Instancing fix
(2.54 KiB) Downloaded 57 times
pjotter
regular
 
Posts: 68
Joined: Fri May 22, 2009 2:51 am
Location: Utrecht, The Netherlands

Re: Error in opengl: stack underflow

Postby gouessej » Thu Feb 23, 2012 4:23 am

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?
gouessej
regular
 
Posts: 1186
Joined: Fri May 01, 2009 3:26 am
Location: France

Re: Error in opengl: stack underflow

Postby runiter » Thu Feb 23, 2012 2:09 pm

The current version works great with my project.
Thanks very much 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 gouessej » Thu Feb 23, 2012 2:28 pm

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

Postby renanse » Fri Feb 24, 2012 5:34 pm

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. :P
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

PreviousNext

Return to Core Development Discussions

Who is online

Users browsing this forum: No registered users and 0 guests

cron