Cannot display TextArea in single Panel
- omniter
- OGRE Contributor
- Posts: 424
- Joined: Thu Mar 19, 2009 8:08 am
- Location: Canada
- x 44
Cannot display TextArea in single Panel
Hi guys,
I just found what appears to be a bug in the overlay system. It seems that when I have an overlay with one container in it, any TextArea elements inside of that container will not show. I have to add another container before it in the same overlay, containing another TextArea using the same font, so that the original one will show text. It sounds very strange, but I've tested it with a bunch of different fonts, materials, using templates / not using templates, etc. I am using the latest MogreSDK (which uses OGRE 1.7.1 revision 72), so I'm not sure if it's a Mogre-specific problem. Could someone else confirm / disconfirm this? Thanks!
I just found what appears to be a bug in the overlay system. It seems that when I have an overlay with one container in it, any TextArea elements inside of that container will not show. I have to add another container before it in the same overlay, containing another TextArea using the same font, so that the original one will show text. It sounds very strange, but I've tested it with a bunch of different fonts, materials, using templates / not using templates, etc. I am using the latest MogreSDK (which uses OGRE 1.7.1 revision 72), so I'm not sure if it's a Mogre-specific problem. Could someone else confirm / disconfirm this? Thanks!
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
Re: Cannot display TextArea in single Panel
I get the same error.
I think you can see it in the terrain sample as well.
Seems to be a refresh related issue, because it shows when the overlay is redrawn.
I think..
I think you can see it in the terrain sample as well.
Seems to be a refresh related issue, because it shows when the overlay is redrawn.
I think..
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
- omniter
- OGRE Contributor
- Posts: 424
- Joined: Thu Mar 19, 2009 8:08 am
- Location: Canada
- x 44
Re: Cannot display TextArea in single Panel
Seems the problem was introduced in v1.7 then.
- omniter
- OGRE Contributor
- Posts: 424
- Joined: Thu Mar 19, 2009 8:08 am
- Location: Canada
- x 44
Re: Cannot display TextArea in single Panel
Hey guys,
I found a couple of other guys with similar problems. I didn't see the connection before, but it definitely seems like there is one now. Take a look at this thread.
I found a couple of other guys with similar problems. I didn't see the connection before, but it definitely seems like there is one now. Take a look at this thread.
-
- Gnoblar
- Posts: 3
- Joined: Tue Jun 15, 2010 8:33 am
Re: Cannot display TextArea in single Panel
Seems like updateTextureGeometry isn't called properly at initialization.
I've been struggeling with this for quite a while, but thought it was a problem I caused myself..
Doing this, however.. does the trick:
It's obviously not ment to be done this way though.
I've been struggeling with this for quite a while, but thought it was a problem I caused myself..
Doing this, however.. does the trick:
Code: Select all
bool first = true;
while(mRunning)
{
//Pump messages in all registered RenderWindow windows
Ogre::WindowEventUtilities::messagePump();
mRoot->renderOneFrame(); // Ignore whatever the frame listeners return basically.
if(first)
{
first = false;
// Simple hack to make sure all text area overlay elements are shown correctly..
Ogre::OverlayManager& om = Ogre::OverlayManager::getSingleton();
Ogre::OverlayManager::OverlayMapIterator omi = om.getOverlayIterator();
while(omi.hasMoreElements())
{
Ogre::Overlay* overlay = omi.getNext();
Ogre::Overlay::Overlay2DElementsIterator o2dei = overlay->get2DElementsIterator();
while(o2dei.hasMoreElements())
{
Ogre::OverlayElement* oe = o2dei.getNext();
oe->setCaption(oe->getCaption());
}
}
}
}
-
- Kobold
- Posts: 31
- Joined: Thu Jun 03, 2010 4:03 pm
- Location: Korea
Re: Cannot display TextArea in single Panel
i replied for this problem earlier another thread..
I think this is bug in OverlayElement::_update(void) function,
mPixelWidth is changed at line (1) , but mWidth is changed at line (2)
but at line (3) mGeomPositionsOutOfDate is setting to false, so when next _update fuction called, line (2) is not excuted because (4) is false
mWidth is not changed at this time, so textarea is not displayed
I think this is bug in OverlayElement::_update(void) function,
mPixelWidth is changed at line (1) , but mWidth is changed at line (2)
but at line (3) mGeomPositionsOutOfDate is setting to false, so when next _update fuction called, line (2) is not excuted because (4) is false
mWidth is not changed at this time, so textarea is not displayed
Code: Select all
-> OgreOverlayElement.cpp
void OverlayElement::_update(void)
{
// Check size if pixel-based
switch (mMetricsMode)
{
case GMM_PIXELS :
if (OverlayManager::getSingleton().hasViewportChanged() || mGeomPositionsOutOfDate) // (4)
{
Real vpWidth, vpHeight;
OverlayManager& oMgr = OverlayManager::getSingleton();
vpWidth = (Real) (oMgr.getViewportWidth());
vpHeight = (Real) (oMgr.getViewportHeight());
mPixelScaleX = 1.0f / vpWidth;
mPixelScaleY = 1.0f / vpHeight;
mLeft = mPixelLeft * mPixelScaleX;
mTop = mPixelTop * mPixelScaleY;
mWidth = mPixelWidth * mPixelScaleX; // (2)
mHeight = mPixelHeight * mPixelScaleY;
}
break;
case GMM_RELATIVE_ASPECT_ADJUSTED :
if (OverlayManager::getSingleton().hasViewportChanged() || mGeomPositionsOutOfDate)
{
Real vpWidth, vpHeight;
OverlayManager& oMgr = OverlayManager::getSingleton();
vpWidth = (Real) (oMgr.getViewportWidth());
vpHeight = (Real) (oMgr.getViewportHeight());
mPixelScaleX = 1.0f / (10000.0f * (vpWidth / vpHeight));
mPixelScaleY = 1.0f / 10000.0f;
mLeft = mPixelLeft * mPixelScaleX;
mTop = mPixelTop * mPixelScaleY;
mWidth = mPixelWidth * mPixelScaleX;
mHeight = mPixelHeight * mPixelScaleY;
}
break;
default:
break;
}
_updateFromParent();
// NB container subclasses will update children too
// Tell self to update own position geometry
if (mGeomPositionsOutOfDate && mInitialised)
{
updatePositionGeometry(); // (1)
mGeomPositionsOutOfDate = false; // (3)
}
// Tell self to update own texture geometry
if (mGeomUVsOutOfDate && mInitialised)
{
updateTextureGeometry();
mGeomUVsOutOfDate = false;
}
}
- omniter
- OGRE Contributor
- Posts: 424
- Joined: Thu Mar 19, 2009 8:08 am
- Location: Canada
- x 44
Re: Cannot display TextArea in single Panel
So does that mean the problem doesn't occur for relative metrics mode?
-
- Kobold
- Posts: 31
- Joined: Thu Jun 03, 2010 4:03 pm
- Location: Korea
Re: Cannot display TextArea in single Panel
i don't know what is relative metircs mode..
i just initialize buttons like this
m_pTrayMgr = new OgreBites::MySDKTrayManager("TrayMgr", m_pRenderWnd, m_pMouse, this);
m_pTrayMgr->showCursor();
m_pTrayMgr->createButton(OgreBites::TL_BOTTOMRIGHT,"_Continue","Continue",140.0f);
caption is not displaying always.
in my update fuction, i called below code at each frame
button->setCaption("Continue");
after this , caption is display well , mWidth value is corrected.
i just initialize buttons like this
m_pTrayMgr = new OgreBites::MySDKTrayManager("TrayMgr", m_pRenderWnd, m_pMouse, this);
m_pTrayMgr->showCursor();
m_pTrayMgr->createButton(OgreBites::TL_BOTTOMRIGHT,"_Continue","Continue",140.0f);
caption is not displaying always.
in my update fuction, i called below code at each frame
button->setCaption("Continue");
after this , caption is display well , mWidth value is corrected.
- omniter
- OGRE Contributor
- Posts: 424
- Joined: Thu Mar 19, 2009 8:08 am
- Location: Canada
- x 44
Re: Cannot display TextArea in single Panel
The SdkTrays system uses pixel metrics mode.
If you are correct, then the fix could be just to put the switch statement between lines (1) and (3).
If you are correct, then the fix could be just to put the switch statement between lines (1) and (3).
- icaro56
- Greenskin
- Posts: 105
- Joined: Sun Feb 15, 2009 2:03 am
- Location: Belo Horizonte, MG, BRA
- x 1
Re: Cannot display TextArea in single Panel
I get the same error!
In my topic: http://www.ogre3d.org/forums/viewtopic.php?f=5&t=61763
This is strange!
In my topic: http://www.ogre3d.org/forums/viewtopic.php?f=5&t=61763
This is strange!
Ícaro Motta
-
- Gnoblar
- Posts: 6
- Joined: Wed Jul 20, 2011 10:45 am
- x 3
Re: Cannot display TextArea in single Panel
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.
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.
- omniter
- OGRE Contributor
- Posts: 424
- Joined: Thu Mar 19, 2009 8:08 am
- Location: Canada
- x 44
Re: Cannot display TextArea in single Panel
A couple of fixes have been posted a long time ago:
http://www.ogre3d.org/forums/viewtopic. ... 75#p403274
http://www.ogre3d.org/forums/viewtopic. ... 75#p403274
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
Re: Cannot display TextArea in single Panel
That's not really impressive, as it didn't went into the code base, but it's better than nothing.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
-
- Kobold
- Posts: 31
- Joined: Thu Jun 03, 2010 4:03 pm
- Location: Korea
Re: Cannot display TextArea in single Panel
you're right. i modify that you said "put the switch statement between lines (1) and (3)".omniter wrote:The SdkTrays system uses pixel metrics mode.
If you are correct, then the fix could be just to put the switch statement between lines (1) and (3).
caption is viewed well.
thanks. i hope this fix is reflected in ogre next version.
-
- Kobold
- Posts: 32
- Joined: Thu Aug 11, 2011 10:00 pm
Re: Cannot display TextArea in single Panel
Hello,
I believe I'm still having this bug, but I'm not using SdkTrays, just overlays directly, and all the fixes use SdkTrays. Do you know if there are some other fixes available ?
Thanks for your help,
Guillaume
I believe I'm still having this bug, but I'm not using SdkTrays, just overlays directly, and all the fixes use SdkTrays. Do you know if there are some other fixes available ?
Thanks for your help,
Guillaume
- omniter
- OGRE Contributor
- Posts: 424
- Joined: Thu Mar 19, 2009 8:08 am
- Location: Canada
- x 44
Re: Cannot display TextArea in single Panel
If you're compiling Ogre, you can look up a few posts for a solution that involves changing OgreOverlayElement.cpp.guillaumequest wrote:Hello,
I believe I'm still having this bug, but I'm not using SdkTrays, just overlays directly, and all the fixes use SdkTrays. Do you know if there are some other fixes available ?
Thanks for your help,
Guillaume
Also, from the other threads: "Any operation that will cause the OverlayElement's geom positions to be refreshed will fix this problem."
This includes stuff like changing positions and sizes, and setting the metrics mode.
-
- Kobold
- Posts: 32
- Joined: Thu Aug 11, 2011 10:00 pm
Re: Cannot display TextArea in single Panel
Thanks,
I copied the code from ObjectTextDisplay and adapted it so that it would display the text at a fixed position and this worked for some reason, I don't really have any idea why that worked better, though...
I copied the code from ObjectTextDisplay and adapted it so that it would display the text at a fixed position and this worked for some reason, I don't really have any idea why that worked better, though...
- spacegaier
- OGRE Team Member
- Posts: 4304
- Joined: Mon Feb 04, 2008 2:02 pm
- Location: Germany
- x 135
- Contact:
Re: Cannot display TextArea in single Panel
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...
- arcanemartz
- Gnoblar
- Posts: 6
- Joined: Tue Jun 26, 2012 11:38 pm
- x 3
- Contact:
Re: Cannot display TextArea in single Panel
Hi,
It seems the patch has broken the ability to update the position of an overlay element with setPosition(...) when element is in relative mode. It seems the switch case in _update() should be similar to the one in _notifyViewport(), i.e. add to the default case:
Here is the complete switch in _update():
Thanks,
Martin
It seems the patch has broken the ability to update the position of an overlay element with setPosition(...) when element is in relative mode. It seems the switch case in _update() should be similar to the one in _notifyViewport(), i.e. add to the default case:
Code: Select all
case GMM_RELATIVE :
mPixelScaleX = 1.0;
mPixelScaleY = 1.0;
mPixelLeft = mLeft;
mPixelTop = mTop;
mPixelWidth = mWidth;
mPixelHeight = mHeight;
Code: Select all
// Check size if pixel-based or relative-aspect-adjusted
switch (mMetricsMode)
{
case GMM_PIXELS :
if (OverlayManager::getSingleton().hasViewportChanged() || mGeomPositionsOutOfDate)
{
mPixelScaleX = 1.0f / vpWidth;
mPixelScaleY = 1.0f / vpHeight;
}
break;
case GMM_RELATIVE_ASPECT_ADJUSTED :
if (OverlayManager::getSingleton().hasViewportChanged() || mGeomPositionsOutOfDate)
{
mPixelScaleX = 1.0f / (10000.0f * (vpWidth / vpHeight));
mPixelScaleY = 1.0f / 10000.0f;
}
break;
default:
case GMM_RELATIVE :
mPixelScaleX = 1.0;
mPixelScaleY = 1.0;
mPixelLeft = mLeft;
mPixelTop = mTop;
mPixelWidth = mWidth;
mPixelHeight = mHeight;
break;
}
Martin