MovableText Bounding Box Problem

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
User avatar
manowar
Orc
Posts: 419
Joined: Thu Apr 07, 2005 2:11 pm
Location: UK
Contact:

MovableText Bounding Box Problem

Post by manowar »

Hello

I am using the MovableText class to render 3D text. It worked fine until I tried to change the font size using setCharacterHeight(). For some reason the bounding box is wrong. I will have a look on the code and see if I can fix that. I guess it should be a simple fix once you understand how the bounding box is calculated. Could you please let me know if anyone noticed the problem and maybe already fixed it ? Thanks a lot

Eric

User avatar
DWORD
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 1365
Joined: Tue Sep 07, 2004 12:43 pm
Location: Aalborg, Denmark
Contact:

Re: MovableText Bounding Box Problem

Post by DWORD »

manowar wrote:For some reason the bounding box is wrong.
How is it wrong? Is it not updated with the change in font size (i.e. stays the same), or is it updated to some wrong size?

I'm not familiar with the MovableText class, but maybe it's necessary to tell Ogre that an update is needed. See this thread.

User avatar
manowar
Orc
Posts: 419
Joined: Thu Apr 07, 2005 2:11 pm
Location: UK
Contact:

Post by manowar »

hello

Yes it is not updated. Here is my code when I create my scene

Code: Select all

MovableText *mText = new MovableText("text","COOL TEXT !!!!!");
SceneNode* nodeText mgr->getRootSceneNode()->createChildSceneNode();
mText->setCharacterHeight(50);
nodeText->attachObject(mText);
nodeText->showBoundingBox(true);
I tried to add nodeText->needUpdate() after that but it does not seem to change anything. Well anyway thanks for this really quick answer.

Eric

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

How about

Code: Select all

nodeText->getParentSceneNode()->needUpdate()
:?:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
manowar
Orc
Posts: 419
Joined: Thu Apr 07, 2005 2:11 pm
Location: UK
Contact:

Post by manowar »

Well I tried to call that just after I call mText->setCharacterHeight(50); but it does not seem to change anything.
:(

User avatar
DWORD
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 1365
Joined: Tue Sep 07, 2004 12:43 pm
Location: Aalborg, Denmark
Contact:

Post by DWORD »

Try attaching it to a node before calling needUpdate() on the parent node.

User avatar
manowar
Orc
Posts: 419
Joined: Thu Apr 07, 2005 2:11 pm
Location: UK
Contact:

Post by manowar »

I have to call needUpdate() in the framelistener. I was calling it just after setting up the text and attaching it to a node (createScene function). Now it is working. I simply would like to know now why it does not work in createScene ?

Thanks for your help

Eric

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

It's because the render loop hasn't started yet.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

Post Reply