Garbled text in textbox and window caption

goishin

29-03-2014 21:24:52

Hey all,
When I try to display text, my text is always garbled. I'm not sure what I'm doing wrong, so I figured I'd ask for advice. Please see a screenshot of the garbled text I'm referring to.
[attachment=0]garbled_text.jpg[/attachment]

I've tried a variety of different things. But the basic jist of the code I'm using is the following:

MyGUI::Window* window = static_cast<MyGUI::Window*>( static_cast<MenuItemComponent*>(*parentIter)->GetWidget() );
MyGUI::TextBox* t = window->createWidget<MyGUI::TextBox>( "TextBox", MyGUI::IntCoord( 0, 0, 50, 50 ), MyGUI::Align::Left, "Main" );
t->setCaption( "Test" );


Looking in the mygui log file I see no errors at all. Has anyone else seen this? And if so, what did you do to resolve this?

- goishin

Altren

29-03-2014 21:45:16

Hi, I never heard about such problem.
The only guess I have right now is that Freetype generated invalid texture.

Does MyGUI demos work fine or have same problem?

goishin

29-03-2014 22:12:46

Yeah, everything else works great. I've even been using mygui in this project. And I've ripped out mygui and redone it about three times so far. But this time around, I ripped everything out, and now I just can't get the text to work right.

goishin

05-04-2014 21:06:38

Bump!

I'm still working on the problem, but am running out of ideas. Any suggestions? I'm desperate and am willing to try anything.

Altren

06-04-2014 22:36:05

Try removing objects from scene. There is a chance, that some material in not fully resetted in render manager, so part of it affect MyGUI's material.
Try removing various blocks of code to see which one might cause problem.

goishin

07-04-2014 18:07:49

I figured it out!

I'm using the sample BaseApplication that comes with Ogre as my base that I'm building on top of. It's small and simple and just enough to get me going. However, there's a few things the base application does that I've since started handling in my own code. In this case, it's input. I do it all myself, but I still pipe input events to the base class. And for some reason, I had decided to do level-loading using the F5 key, which then gets piped to the base application, which also has a binding for the F5 key, which happens to reload all textures. I figured out what was happening through trial and error. I started removing things to the point where I had realized that I had actually removed all of my own input handling, and the problem was still occurring. I thought, "how can that be" and then realized that keyboard input was still being piped to the base application. I poked in there, and saw that F5 that made the following call:
Ogre::TextureManager::getSingleton().reloadAll();
Anyway, for some reason, calling that function will garble your text.

Altren

08-04-2014 03:12:30

Glad you figured it out.
I'll check what's wrong with texture and why it gets broken after reload.

goishin

08-04-2014 18:30:41

Sweet!

Let me know if I can help, Altren. I've got some good repro steps if you need 'em.