OgreBites button caption doesn't appear
- ScurvyKnave
- Gremlin
- Posts: 150
- Joined: Mon Oct 10, 2005 5:57 pm
- Contact:
OgreBites button caption doesn't appear
Hi
I'm trying out OgreBites. The samples work fine, but when I brought it across into my own project I've found that none of the captions for any of the UI elements show up.
I've found that if I create a label positioned with OgreBites::TL_NONE (as opposed to OgreBites::TL_CENTER for example) then the label's caption shows up (but only the label, doing the same for buttons etc does not help).
Any idea what is happening? Anybody else experienced this? I've stepped through the code and can't see anything wrong.
I'm using a pre-built 1.7.1 SDK with Visual Studio 2008 Express .
I'm trying out OgreBites. The samples work fine, but when I brought it across into my own project I've found that none of the captions for any of the UI elements show up.
I've found that if I create a label positioned with OgreBites::TL_NONE (as opposed to OgreBites::TL_CENTER for example) then the label's caption shows up (but only the label, doing the same for buttons etc does not help).
Any idea what is happening? Anybody else experienced this? I've stepped through the code and can't see anything wrong.
I'm using a pre-built 1.7.1 SDK with Visual Studio 2008 Express .
Last edited by ScurvyKnave on Sun May 23, 2010 10:45 am, edited 1 time in total.
- omniter
- OGRE Contributor
- Posts: 424
- Joined: Thu Mar 19, 2009 8:08 am
- Location: Canada
- x 44
Re: OgreBites button caption doesn't appear
Mind posting some code? Then people could try reproducing it.
- ScurvyKnave
- Gremlin
- Posts: 150
- Joined: Mon Oct 10, 2005 5:57 pm
- Contact:
Re: OgreBites button caption doesn't appear
Ok well it happens when manually creating overlays as well. Currently I'm having the first text overlay I create not work, only subsequent ones.
The code to create it is just:
The overlay script is:
The code to create it is just:
Code: Select all
Ogre::Overlay* HUD = static_cast< Ogre::Overlay* >( Ogre::OverlayManager::getSingleton().getByName( "HeadsUpDisplayOverlay" ) );
HUD->show();
Code: Select all
HeadsUpDisplayOverlay
{
zorder 200
container Panel( HeadsUpDisplayOverlay )
{
metrics_mode relative
left 0
top 0
width 1
height 1
material HeadsUpDisplay
}
container TextArea( A )
{
left 200
top 100
width 200
height 200
metrics_mode pixels
font_name Arial
char_height 20
space_width 7
colour 1.0 1.0 1.0
caption A
}
container TextArea( B )
{
left 150
top 100
width 200
height 200
metrics_mode pixels
font_name Arial
char_height 20
space_width 7
colour 1.0 0.0 0.0
caption B
}
container TextArea( C )
{
left 100
top 100
width 200
height 200
metrics_mode pixels
font_name Arial
char_height 20
space_width 7
colour 1.0 0.0 0.0
caption C
}
}
-
- Kobold
- Posts: 31
- Joined: Thu Jun 03, 2010 4:03 pm
- Location: Korea
Re: OgreBites button caption doesn't appear
hi. i found same situation.
so i debug that, i found one thing
1) mTrayMgr->showFrameStats(TL_BOTTOMLEFT);
A) if I commented 1) code in init code and added my buttons, button caption is not appear.
B) and I enable by 1) code by keyboard input( refrenced that "o" key defined in basic framework tutorial ), button caption is appear
C) since 1) code is enabled despite of disable 1) code , but button caption is appear well.
so i debug that, i found one thing
1) mTrayMgr->showFrameStats(TL_BOTTOMLEFT);
A) if I commented 1) code in init code and added my buttons, button caption is not appear.
B) and I enable by 1) code by keyboard input( refrenced that "o" key defined in basic framework tutorial ), button caption is appear
C) since 1) code is enabled despite of disable 1) code , but button caption is appear well.
- Attachments
- omniter
- OGRE Contributor
- Posts: 424
- Joined: Thu Mar 19, 2009 8:08 am
- Location: Canada
- x 44
Re: OgreBites button caption doesn't appear
ScurvyKnave, your TextAreas are on the same level as your Panel. There is no guarantee that the TextAreas would show up in front of the Panel unless they are children of the Panel.
I don't think the problem you two are having is specific to OgreBites. It's probably something to do with OGRE's overlay system. Each widget is just an OverlayElement, and I've made sure that the TextAreas are topmost in the button hierarchy. Also, as far as I can tell, once a button is created, it does not change its structure. So if something is causing the captions to appear / disappear, it's unlikely to be in the OgreBites code.
I don't think the problem you two are having is specific to OgreBites. It's probably something to do with OGRE's overlay system. Each widget is just an OverlayElement, and I've made sure that the TextAreas are topmost in the button hierarchy. Also, as far as I can tell, once a button is created, it does not change its structure. So if something is causing the captions to appear / disappear, it's unlikely to be in the OgreBites code.
-
- Kobold
- Posts: 31
- Joined: Thu Jun 03, 2010 4:03 pm
- Location: Korea
Re: OgreBites button caption doesn't appear
I debug code for this bug.
I found bug but I am not know how fix code to solve this.
in void OverlayElement::_update(void) function
overlay element of button's mPixelWidth initial value is 1.0
so I add dataBreak at when mPixelWidth value is change..
when break is happen, callstack is as below..
OgreMain_d.dll!Ogre::OverlayElement::setWidth(float width=60.000000)
OgreMain_d.dll!Ogre::TextAreaOverlayElement::updatePositionGeometry()
OgreMain_d.dll!Ogre::OverlayElement::_update()
but mWidth change code is line 377. so mWidth is not change this time.
in line 410, mGeomPositionsOutOfDate = false; is excuted, so mWidth is not change until mGeomPositionsOutOfDate value set true.
when i called
button->setCaption("adsf"); manually at each update loop.
caption is appear well..
I found bug but I am not know how fix code to solve this.
in void OverlayElement::_update(void) function
overlay element of button's mPixelWidth initial value is 1.0
so I add dataBreak at when mPixelWidth value is change..
when break is happen, callstack is as below..
OgreMain_d.dll!Ogre::OverlayElement::setWidth(float width=60.000000)
OgreMain_d.dll!Ogre::TextAreaOverlayElement::updatePositionGeometry()
OgreMain_d.dll!Ogre::OverlayElement::_update()
but mWidth change code is line 377. so mWidth is not change this time.
in line 410, mGeomPositionsOutOfDate = false; is excuted, so mWidth is not change until mGeomPositionsOutOfDate value set true.
when i called
button->setCaption("adsf"); manually at each update loop.
caption is appear well..
- omniter
- OGRE Contributor
- Posts: 424
- Joined: Thu Mar 19, 2009 8:08 am
- Location: Canada
- x 44
Re: OgreBites button caption doesn't appear
Just curious, are you developing for the iPhone?
-
- Kobold
- Posts: 31
- Joined: Thu Jun 03, 2010 4:03 pm
- Location: Korea
Re: OgreBites button caption doesn't appear
yes ^^ i develop for the iphone.
i develop on windows,visualc,opengl mainly.
and then test by macbook,xcode for iphone.
i develop on windows,visualc,opengl mainly.
and then test by macbook,xcode for iphone.
- omniter
- OGRE Contributor
- Posts: 424
- Joined: Thu Mar 19, 2009 8:08 am
- Location: Canada
- x 44
Re: OgreBites button caption doesn't appear
Does this happen when you test on Windows as well?
-
- Kobold
- Posts: 31
- Joined: Thu Jun 03, 2010 4:03 pm
- Location: Korea
Re: OgreBites button caption doesn't appear
yes , i was tested on windows.
i was coded traycontrols init like below
m_pTrayMgr = new OgreBites::MySDKTrayManager("TrayMgr", m_pRenderWnd, m_pMouse, this);
m_pTrayMgr->destroyAllWidgets();
m_pTrayMgr->createButton(OgreBites::TL_NONE,"_Continue","Continue",140.0f);
m_pTrayMgr->createButton(OgreBites::TL_NONE,"_Help","Help",140.0f);
m_pTrayMgr->createButton(OgreBites::TL_NONE,"_Credit","Credit",140.0f);
m_pTrayMgr->showCursor();
i was coded traycontrols init like below
m_pTrayMgr = new OgreBites::MySDKTrayManager("TrayMgr", m_pRenderWnd, m_pMouse, this);
m_pTrayMgr->destroyAllWidgets();
m_pTrayMgr->createButton(OgreBites::TL_NONE,"_Continue","Continue",140.0f);
m_pTrayMgr->createButton(OgreBites::TL_NONE,"_Help","Help",140.0f);
m_pTrayMgr->createButton(OgreBites::TL_NONE,"_Credit","Credit",140.0f);
m_pTrayMgr->showCursor();
-
- Gnoblar
- Posts: 15
- Joined: Fri Jul 23, 2010 6:34 pm
Re: OgreBites button caption doesn't appear
Hi
I am having the same problem TaeHyungKim is describing. My Captions are only appearing when I
show/toggle the frame stats. Is there a soloution for that problem??
I am using Windows and openGL
cheers
Sebastian
I am having the same problem TaeHyungKim is describing. My Captions are only appearing when I
show/toggle the frame stats. Is there a soloution for that problem??
TaeHyungKim wrote:hi. i found same situation.
so i debug that, i found one thing
1) mTrayMgr->showFrameStats(TL_BOTTOMLEFT);
A) if I commented 1) code in init code and added my buttons, button caption is not appear.
B) and I enable by 1) code by keyboard input( refrenced that "o" key defined in basic framework tutorial ), button caption is appear
C) since 1) code is enabled despite of disable 1) code , but button caption is appear well.
I am using Windows and openGL
cheers
Sebastian
- omniter
- OGRE Contributor
- Posts: 424
- Joined: Thu Mar 19, 2009 8:08 am
- Location: Canada
- x 44
Re: OgreBites button caption doesn't appear
I'm now 90% sure that the problem is something in the Ogre core. I had a similar problem myself with overlay text not appearing, and I wouldn't be surprised if it was related to your problem. See this thread. I'm not sure as to the status of that bug, though. Anybody on the team care to shed some light on this situation?
EDIT: Notice that all of these problems seem to revolve around some TextArea not showing up unless some other TextArea is present.
EDIT: Notice that all of these problems seem to revolve around some TextArea not showing up unless some other TextArea is present.
-
- Gnoblar
- Posts: 1
- Joined: Wed Oct 27, 2010 8:23 am
Re: OgreBites button caption doesn't appear
There seems to be an issue with text when its widget is created before the scene has been rendered at least once. The quickest work around is to call "mRoot->renderOneFrame()" before creating any widgets.
An alternative is to fix the text by making a change to the SdkTrayManager the malfunctioning widget belongs to...after a frame has been rendered.
Some possible changes:
- Changing any widget's caption
- Moving, any widget to a different tray (including to/from OgreBites::TL_NONE)
- Creating or destroying a widget
Note: Hiding or showing a widget doesn't work.
An alternative is to fix the text by making a change to the SdkTrayManager the malfunctioning widget belongs to...after a frame has been rendered.
Some possible changes:
- Changing any widget's caption
- Moving, any widget to a different tray (including to/from OgreBites::TL_NONE)
- Creating or destroying a widget
Note: Hiding or showing a widget doesn't work.
- omniter
- OGRE Contributor
- Posts: 424
- Joined: Thu Mar 19, 2009 8:08 am
- Location: Canada
- x 44
Re: OgreBites button caption doesn't appear
Thanks, Exzotus. As I mentioned in this thread, anything that causes the OverlayElement's geom positions to be refreshed is a temporary solution. I'm not sure why this issue still isn't resolved. :S
-
- Gnoblar
- Posts: 6
- Joined: Tue Apr 10, 2007 6:46 pm
Re: OgreBites button caption doesn't appear
I was bitten by this particularly sneaky bug when upgrading from OGRE 1.4.6 to 1.7.2.Exzotus wrote:There seems to be an issue with text when its widget is created before the scene has been rendered at least once. The quickest work around is to call "mRoot->renderOneFrame()" before creating any widgets.
An alternative is to fix the text by making a change to the SdkTrayManager the malfunctioning widget belongs to...after a frame has been rendered.
Some possible changes:
- Changing any widget's caption
- Moving, any widget to a different tray (including to/from OgreBites::TL_NONE)
- Creating or destroying a widget
Note: Hiding or showing a widget doesn't work.
I create an overlay screen (with TextAreaOverlayElements) upon system initialization and before the first redraw. However, NOW I must also destroy/recreate all the TextAreaOverlayElement items AFTER the very first redraw. It works now.
Interesting note: Simply moving the creation of the TextAreaOverlayElements to AFTER the first redraw didn't solve the problem. I had to keep the original initialization code and THEN destroy/recreate those TextAreaOverlayElements again after redrawing the first time. No other combination of mRoot->renderOneFrame() or moving the initalization code around did the trick.
... in case someone else needs more info to keep from pulling their hair out.
-
- Gnoblar
- Posts: 6
- Joined: Wed Jul 20, 2011 10:45 am
- x 3
Re: OgreBites button caption doesn't appear
Try using this:
Fonts are not loaded correctly in the first run... So add these lines at startup after you loaded your resources (esp. SdkTray.zip)!
I had this problem with sliders, labels, buttons and so forth.
Would be nice, if you can report whether you need to recreate anything after adding these lines...
Code: Select all
// load fonts explicitly after resources are loaded (esp. SdkTray.zip) since they will not be loaded on start up from the resource manager
ResourceManager::ResourceMapIterator iter = Ogre::FontManager::getSingleton().getResourceIterator();
while (iter.hasMoreElements()) { iter.getNext()->load(); }
I had this problem with sliders, labels, buttons and so forth.
Would be nice, if you can report whether you need to recreate anything after adding these lines...
-
- Kobold
- Posts: 31
- Joined: Thu Jun 03, 2010 4:03 pm
- Location: Korea
Re: OgreBites button caption doesn't appear
I think this is bug at OgreOverlayElement.cpp
I modify ogre source and caption see well .
reference this thread will help
I modify ogre source and caption see well .
reference this thread will help
- spacegaier
- OGRE Team Member
- Posts: 4304
- Joined: Mon Feb 04, 2008 2:02 pm
- Location: Germany
- x 135
- Contact:
Re: OgreBites button caption doesn't appear
FYI for everyone coming across this issue and this thread: I just fixed the problem in both the 1.8 and 1.9 branch. So if you run into the described situation please update your Ogre version/revision.
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...