GuiMenuBar sub menu arrows not rendering all the time
by Nathan Bowhay - ESAL · in Torque Game Engine Advanced · 04/02/2009 (4:01 pm) · 7 replies
If you look at the following:
if the line that is commented out isn't the arrow renders fine, if it is it doesn't.
Note that MainMenuBar is of type GuiMenuBar.
I found out that the reason this is the case is because on line 1256 or so in guiMenuBar.cpp the code
is executing (when commenting it out the arrow isn't render) and more specifically
if I make the same call (GFX->setTexture( 0, NULL );) in PrimBuild::end(); near the end before setupGenericShaders (line 161 in primBuilder.cpp) the arrow renders, but the sky is doesn't.
Not real great at render code and since it appears to be a bug in torque I was hoping someone else knew the solution to fixing it.
MainMenuBar.addMenuItem("File", "Export", 7);
MainMenuBar.setMenuItemSubmenuState("File", "Export", true);
//MainMenuBar.setMenuItemChecked("File", "Export", true);
MainMenuBar.addSubmenuItem("File", "Export", "A...", 1);
MainMenuBar.addSubmenuItem("File", "Export", "B...", 2);
MainMenuBar.addSubmenuItem("File", "Export", "C...", 3);if the line that is commented out isn't the arrow renders fine, if it is it doesn't.
Note that MainMenuBar is of type GuiMenuBar.
I found out that the reason this is the case is because on line 1256 or so in guiMenuBar.cpp the code
GFX->getDrawUtil()->drawBitmapSR(mProfile->mTextureObject, offset + off, rect);
is executing (when commenting it out the arrow isn't render) and more specifically
mDevice->setTexture( 0, texture );is called
if I make the same call (GFX->setTexture( 0, NULL );) in PrimBuild::end(); near the end before setupGenericShaders (line 161 in primBuilder.cpp) the arrow renders, but the sky is doesn't.
Not real great at render code and since it appears to be a bug in torque I was hoping someone else knew the solution to fixing it.
#2
Regardless, the usual fix for this kind of texture issue would be to stick
04/26/2009 (10:48 pm)
What version of TGEA is this from? In 1.8.1 the rendering code is around ~870-940 and ~1030 in guiMenuBarCtrl.cpp.Regardless, the usual fix for this kind of texture issue would be to stick
for(U32 i = 0; i < GFX->getNumSamplers(); ++i) GFX->setTexture(i, NULL);at the beginning of GuiMenuBarCtrl::onRender.
#3
PS: I tried that and it didn't seem to fix it :(
04/27/2009 (10:34 am)
Yeah it is 1.8.1 thanks for the suggestion I will try it.PS: I tried that and it didn't seem to fix it :(
#4
04/27/2009 (10:35 am)
Is it stock 1.8.1? As said, my rendering code is about 300 lines earlier in guiMenuBar.cpp than yours apparently is.
#5
I added a good chunk of code to grab profiles, but that shouldn't cause any issues.
Like I said I will check stock just to make sure.
04/27/2009 (10:48 am)
No I did modify it, but not any of the render code. I can try it with a stock 1.8.1.I added a good chunk of code to grab profiles, but that shouldn't cause any issues.
Like I said I will check stock just to make sure.
#6
if there is no playgui or GameTSCtrl (just commented it out) when you launch torque the arrow/triangle shows up for Export. when not commented out it doesn't show up. I then made the change:
on line 868 in guiMenuBar.cpp under
Tried the same two steps with the same results.
04/27/2009 (11:39 am)
Ok so I took a stock 1.8.1 made changes to put playgui inside a guiControl and then put a GuiMenuBar and then changed all the Canvas.setContent to add the guiControl (instead of playGui). I then addedmyMenuBar.clearMenus();
myMenuBar.addMenu("File", 0);
myMenuBar.addMenuItem("File", "Import", 1);
myMenuBar.addMenuItem("File", "Export", 2);
myMenuBar.setMenuItemSubmenuState("File", "Export", true);
myMenuBar.addSubmenuItem("File", "Export", "A...", 1);
myMenuBar.addSubmenuItem("File", "Export", "B...", 2);
myMenuBar.addSubmenuItem("File", "Export", "C...", 3);if there is no playgui or GameTSCtrl (just commented it out) when you launch torque the arrow/triangle shows up for Export. when not commented out it doesn't show up. I then made the change:
on line 868 in guiMenuBar.cpp under
void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect)added
for(U32 i = 0; i < GFX->getNumSamplers(); ++i)
GFX->setTexture(i, NULL);Tried the same two steps with the same results.
#7
06/19/2009 (3:23 pm)
It is fixed in T3D. So that is the solution LOL. No in all seriousness it isn't a big deal anymore cause we are porting everything to T3D and not using TGEA anymore and it is fixed in T3D.
Torque 3D Owner Nathan Bowhay - ESAL
ESALPllc
I really hope someone with a bit more render code knowledge ends up figuring out a good fix, cause this is kinda a big bug.