OgreBites button caption doesn't appear

Problems building or running the engine, queries about how to use features etc.

OgreBites button caption doesn't appear

Postby ScurvyKnave » Sun May 23, 2010 9:52 am

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 .
Last edited by ScurvyKnave on Sun May 23, 2010 10:45 am, edited 1 time in total.
User avatar
ScurvyKnave
Gremlin
 
Posts: 150
Kudos: 0
Joined: 10 Oct 2005

Re: OgreBites button caption doesn't appear

Postby omniter » Sun May 23, 2010 9:10 pm

Mind posting some code? Then people could try reproducing it.
User avatar
omniter
OGRE Contributor
OGRE Contributor
 
Posts: 424
Kudos: 44
Joined: 19 Mar 2009
Location: Canada

Re: OgreBites button caption doesn't appear

Postby ScurvyKnave » Mon May 24, 2010 8:29 pm

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:

Code: Select all
Ogre::Overlay* HUD = static_cast< Ogre::Overlay* >( Ogre::OverlayManager::getSingleton().getByName( "HeadsUpDisplayOverlay" ) );
HUD->show();


The overlay script is:
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
    }
}
User avatar
ScurvyKnave
Gremlin
 
Posts: 150
Kudos: 0
Joined: 10 Oct 2005

Re: OgreBites button caption doesn't appear

Postby TaeHyungKim » Mon Jul 05, 2010 10:04 pm

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.
Attachments
MyApp_Screenshot_07062010_060004960.jpg
C)since 1) code is enabled despite of disable 1) code , but button caption is appear well.
MyApp_Screenshot_07062010_053114064.jpg
A)if I commented 1) code in init code and added my buttons, button caption is not appear.
MyApp_Screenshot_07062010_053125978.jpg
B)and I enable by 1) code by keyboard input( refrenced that "o" key defined in basic framework tutorial ), button caption is appear
TaeHyungKim
Kobold
 
Posts: 31
Kudos: 0
Joined: 03 Jun 2010
Location: Korea

Re: OgreBites button caption doesn't appear

Postby omniter » Mon Jul 05, 2010 10:52 pm

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.
User avatar
omniter
OGRE Contributor
OGRE Contributor
 
Posts: 424
Kudos: 44
Joined: 19 Mar 2009
Location: Canada

Re: OgreBites button caption doesn't appear

Postby TaeHyungKim » Tue Jul 06, 2010 12:49 am

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..
Attachments
MyApp_Screenshot_07062010_084910216.jpg
TaeHyungKim
Kobold
 
Posts: 31
Kudos: 0
Joined: 03 Jun 2010
Location: Korea

Re: OgreBites button caption doesn't appear

Postby omniter » Tue Jul 06, 2010 5:22 am

Just curious, are you developing for the iPhone?
User avatar
omniter
OGRE Contributor
OGRE Contributor
 
Posts: 424
Kudos: 44
Joined: 19 Mar 2009
Location: Canada

Re: OgreBites button caption doesn't appear

Postby TaeHyungKim » Tue Jul 06, 2010 6:44 am

yes ^^ i develop for the iphone.
i develop on windows,visualc,opengl mainly.
and then test by macbook,xcode for iphone.
TaeHyungKim
Kobold
 
Posts: 31
Kudos: 0
Joined: 03 Jun 2010
Location: Korea

Re: OgreBites button caption doesn't appear

Postby omniter » Tue Jul 06, 2010 7:12 am

Does this happen when you test on Windows as well?
User avatar
omniter
OGRE Contributor
OGRE Contributor
 
Posts: 424
Kudos: 44
Joined: 19 Mar 2009
Location: Canada

Re: OgreBites button caption doesn't appear

Postby TaeHyungKim » Tue Jul 06, 2010 7:28 am

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();
TaeHyungKim
Kobold
 
Posts: 31
Kudos: 0
Joined: 03 Jun 2010
Location: Korea

Re: OgreBites button caption doesn't appear

Postby racoon » Mon Aug 02, 2010 12:55 pm

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??

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
racoon
Gnoblar
 
Posts: 15
Kudos: 0
Joined: 23 Jul 2010

Re: OgreBites button caption doesn't appear

Postby omniter » Mon Aug 02, 2010 2:22 pm

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.
User avatar
omniter
OGRE Contributor
OGRE Contributor
 
Posts: 424
Kudos: 44
Joined: 19 Mar 2009
Location: Canada

Re: OgreBites button caption doesn't appear

Postby Exzotus » Wed Oct 27, 2010 8:54 am

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.
Exzotus
Gnoblar
 
Posts: 1
Kudos: 0
Joined: 27 Oct 2010

Re: OgreBites button caption doesn't appear

Postby omniter » Wed Oct 27, 2010 12:10 pm

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
User avatar
omniter
OGRE Contributor
OGRE Contributor
 
Posts: 424
Kudos: 44
Joined: 19 Mar 2009
Location: Canada

Re: OgreBites button caption doesn't appear

Postby mr_mocap » Thu Apr 14, 2011 6:22 pm

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 was bitten by this particularly sneaky bug when upgrading from OGRE 1.4.6 to 1.7.2.

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. :-)
mr_mocap
Gnoblar
 
Posts: 6
Kudos: 0
Joined: 10 Apr 2007

Re: OgreBites button caption doesn't appear

Postby GemX » Wed Jul 20, 2011 10:52 am

Try using this:
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(); }


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

For this message the author GemX has received 3 kudos
GemX
Gnoblar
 
Posts: 6
Kudos: 3
Joined: 20 Jul 2011

Re: OgreBites button caption doesn't appear

Postby TaeHyungKim » Sun Oct 30, 2011 3:41 pm

I think this is bug at OgreOverlayElement.cpp
I modify ogre source and caption see well .
reference this thread will help
TaeHyungKim
Kobold
 
Posts: 31
Kudos: 0
Joined: 03 Jun 2010
Location: Korea

Re: OgreBites button caption doesn't appear

Postby spacegaier » Mon Feb 11, 2013 12:58 am

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...
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
 
Posts: 4291
Kudos: 126
Joined: 04 Feb 2008
Location: Germany


Return to Help

Who is online

Users browsing this forum: Yahoo [Bot] and 5 guests