Game Development Community

GFX: Exceeded world matrix stack size

by Mike Rowley · in Torque Game Engine Advanced · 12/25/2008 (1:03 pm) · 9 replies

After adding the guiSpeedometerHud to the playGui.gui, I get the following error and crash.

Fatal: (c:\torque\tgea_1_8_0\engine\source\gfx\gfxdevice.h @ 832) GFX: Exceeded world matrix stack size

Anyone know how I may fix this?
I'm using the stronghold example for this conversion.

#1
12/25/2008 (3:19 pm)
There was a post about this just a day or so ago. They forgot to pop the matrix in that particular GUI.
#2
12/25/2008 (6:29 pm)
Unfortunately, I can't find that post. The code in playGui.gui that I used is the same as it is in tge.
#3
12/25/2008 (7:23 pm)
After the object is drawn, you need to call GFX->popWorldMatrix()
#4
12/26/2008 (7:07 pm)
Ok, where do I add that code? I added it to the end of guiSpeedometer.cc and it compiles fine, but the speedometer still crashes the engine. I compared the tge versions and found that part was missing from the end of the file. That's why I added it there. It just didn't work.
#5
12/26/2008 (7:19 pm)
Huh? There should be loads of differences between a TGE and a TGEA version of that file, and you sure don't push and pop at the end of the source file. You have to do it in onRender () most likely.

Edit: Look at the other GUI controls and how they push/pop.
#6
12/26/2008 (7:44 pm)
There are a ton of differences. I was looking specifically for this type of code to see where to add it.
At the end of tge's version it states at the end of void GuiSpeedometerHud::onRender(Point2I offset, const RectI &updateRect):

glEnd();
   glPopMatrix();
Which happens to be the end of the file.
In tgea's void GuiSpeedometerHud::onRender(Point2I offset, const RectI &updateRect), it states simply PrimBuild::end();, so I figured it went after PrimBuild becouse it appears to be doing the same thing. That didn't work. It still crashes. (it being GFX->popWorldMatrix(); )
#7
12/27/2008 (8:25 am)
Update on my findings....

After adding GFX->popWorldMatrix(); to the end of onRender, I can copy/paste the speedometer hud into play gui and it works. If I make it using the editor, tgea crashes.
#8
12/27/2008 (8:51 am)
Nvm..
#9
12/27/2008 (9:10 am)
Thanks for your help Stefan. It has been much appreciated. :-) I would have never figured this out without it.