problem using createWindow()

rekotc

03-07-2010 20:17:31

hello, im following the tutorials (2-3) for setting up some very basics buttons with QuickGUI, but i have a strange problem with createWindow(), in my app i have:

...
mGUIManager->setActiveSheet(mySheet);

QuickGUI::Sheet* Sheet = mGUIManager->getActiveSheet();
QuickGUI::Window* myWindow = Sheet->createWindow();
QuickGUI::Button* myButton = Sheet->createButton("Click Me!",QuickGUI::Rect(50,50,100,25));
...


the code works perfectly if i comment out the line QuickGUI::Window* myWindow = Sheet->createWindow(), otherwise when i run the program i get only a black screen, and apparently there are no errors in Ogre.log, where is my mistake?

thanks

Calder

03-07-2010 20:36:32

For starters, if I'm remembering correctly, you'll probably want to use
window->createButton()
rather than
sheet->createButton()

Try that and see what happens... My guess is that you're initializing a big black window in front of everything and obscuring the view of the button somehow? Maybe? Possibly? Hopefully? :wink:

rekotc

03-07-2010 20:53:57

mmmm unfortunately it doesnt work, i tried:

QuickGUI::Sheet* Sheet = mGUIManager->getActiveSheet();

QuickGUI::Window* myWindow = Sheet->createWindow();
QuickGUI::Button* myButton = myWindow->createButton("Click Me!",QuickGUI::Rect(50,50,100,25));


and

QuickGUI::Sheet* Sheet = mGUIManager->getActiveSheet();
QuickGUI::Button* myButton = Sheet->createWindow(QuickGUI::Rect(300,300,200,200))->createButton("Click Me!",QuickGUI::Rect(50,50,100,25));


the last one is simply the code from the tutorial, in both cases i get a black screen and i can also hear the typical sound of a Windows crashing application :D

Calder

03-07-2010 21:26:19

Argh, sorry, I'm stumped! You might have to wait for KFM on this one. Shouldn't be long though! :wink:

rekotc

03-07-2010 21:35:59

ok! :) i hope it's a problem easy to solve! thanks

rekotc

04-07-2010 15:35:24

:( i tried different ways for creating the window but i always obtain a black screen..and this exception:

Eccezione first-chance a 0x7595b727 in TutorialApplication.exe: Eccezione di Microsoft C++: QuickGUI::Exception nella posizione di memoria 0x001eebd4..


it doesnt happen if i dont use the createWindow()

kungfoomasta

05-07-2010 20:12:44

Sorry for the late response, I have been on a family vacation. By default the GUIManager does not have a Sheet, so you're using a NULL pointer in this line:

QuickGUI::Window* myWindow = Sheet->createWindow();

Create a Sheet, then set it as the active sheet, and then the above code will work fine.

rekotc

05-07-2010 20:30:15

Sorry for the late response, I have been on a family vacation.
no problems , i've been on a family vacation too :P..anyway..still the same, here it is the complete code, it works perfectly if i load a button instead of a window, so i cant find my mistake..

QuickGUI::GUIManagerDesc d;
QuickGUI::GUIManager* mGUIManager;


new QuickGUI::Root();
QuickGUI::SkinTypeManager::getSingleton().loadTypes();

d.sceneManager = mSceneMgr;
d.viewport = mCamera->getViewport();
d.queueID = Ogre::RENDER_QUEUE_OVERLAY;

mGUIManager = QuickGUI::Root::getSingletonPtr()->createGUIManager(d);

QuickGUI::SheetDesc* sd = QuickGUI::DescManager::getSingleton().getDefaultSheetDesc();
sd->resetToDefault();
sd->widget_dimensions.size = QuickGUI::Size(800,600);
QuickGUI::Sheet* mySheet = QuickGUI::SheetManager::getSingleton().createSheet(sd);

mGUIManager->setActiveSheet(mySheet);

QuickGUI::Window* myWindow = mySheet->createWindow(QuickGUI::Rect(300,300,200,200));



kungfoomasta

06-07-2010 05:25:43

I'm betting the Skins are not registered correctly. The wiki tutorial should show you how to setup QuickGUI:

http://www.ogre3d.org/tikiwiki/QuickGUI+Beginner+Tutorial+1

If that still doesn't solve the problem, can you paste the contents of your quickgui log?

rekotc

06-07-2010 09:03:56

mmm...im currently following tutorial 1+2 and the buttons work correctly, i didnt know there is a quickGUI.log, but i cant find it, do i have to enable it somewhere?

kungfoomasta

06-07-2010 19:11:46

I believe its embedded into the main Ogre log, which is ogre.log.

rekotc

06-07-2010 19:52:30

ok, this is the last part of the ogre.log before shutting down the application, the first log is using the createWindow, the second is using the createButton, the code is exactly the same, as you can see in the first case it stops when it loads the font_arial.png:

0:41:20: [QGUI] Skin definition for class "TextCursor" with ID "test2" found.
20:41:20: [QGUI] Skin definition for class "TitleBar" with ID "default" found.
20:41:20: [QGUI] Skin definition for class "ToolBar" with ID "default" found.
20:41:20: [QGUI] Skin definition for class "TreeView" with ID "default" found.
20:41:20: [QGUI] Skin definition for class "TreeViewCheckBoxNode" with ID "default" found.
20:41:20: [QGUI] Skin definition for class "TreeViewNode" with ID "default" found.
20:41:20: [QGUI] Skin definition for class "TreeViewRadioButtonNode" with ID "default" found.
20:41:20: [QGUI] Skin definition for class "VScrollBar" with ID "default" found.
20:41:20: [QGUI] Skin definition for class "Window" with ID "default" found.
20:41:20: Texture: font_arial.png: Loading 1 faces(PF_A8R8G8B8,1024x1024x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,1024x1024x1.


while in the other case the application goes on until the end without crashing:

20:46:00: Texture: font_arial.png: Loading 1 faces(PF_A8R8G8B8,1024x1024x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,1024x1024x1.
20:46:00: Texture: spot_shadow_fade.png: Loading 1 faces(PF_R8G8B8,128x128x1) with 5 hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
20:46:00: Font SdkTrays/Captionusing texture size 512x256
20:46:00: Info: Freetype returned null for character 160 in font SdkTrays/Caption
20:46:00: Texture: SdkTrays/CaptionTexture: Loading 1 faces(PF_BYTE_LA,512x256x1) with hardware generated mipmaps from Image. Internal format is PF_BYTE_LA,512x256x1.
20:46:00: Font SdkTrays/Valueusing texture size 512x512
20:46:00: Info: Freetype returned null for character 127 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 128 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 129 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 130 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 131 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 132 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 133 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 134 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 135 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 136 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 137 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 138 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 139 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 140 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 141 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 142 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 143 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 144 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 145 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 146 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 147 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 148 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 149 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 150 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 151 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 152 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 153 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 154 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 155 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 156 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 157 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 158 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 159 in font SdkTrays/Value
20:46:00: Info: Freetype returned null for character 160 in font SdkTrays/Value
20:46:00: Texture: SdkTrays/ValueTexture: Loading 1 faces(PF_BYTE_LA,512x512x1) with hardware generated mipmaps from Image. Internal format is PF_BYTE_LA,512x512x1.
20:46:00: Texture: qgui.button.png: Loading 1 faces(PF_A8R8G8B8,78x23x1) with 5 hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,78x23x1.
20:46:00: Texture: qgui.cursor.png: Loading 1 faces(PF_A8R8G8B8,28x40x1) with 5 hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,28x40x1.


thanks for you help:)

kungfoomasta

06-07-2010 21:19:17

Can you put a breakpoint inside the Window constructor and step through the function? (F9 to set breakpoint, F5 to debug, F10 to step through code)

The callstack would also help in seeing why you're getting a crash. It doesn't really make any sense that the createWindow function would cause a crash, there must be some other underlying issue here.

rekotc

07-07-2010 11:33:34

ok i tried to debug it, i noticed the error from the messageBox that i couldnt see before (i load the application in fullscreen and after every crash i was unable to get back to my desktop) so the error is:

CloseButtonPadding exceeds height of TitleBar, cannot create Close Button! in TitleBar::_initialize


again, it doesnt happen with createButton, but i guess now it's easier to find the problem :)

thanks!

kungfoomasta

07-07-2010 18:01:49

The problem here is that the TitleBar's height is too small for a Close Button to be drawn. I do not have time to debug this issue since I'm actively working on the next version of QuickGUI, which uses a different code base. Things to try:

1. Create a window using a WindowDesc, instead of supplying no arguments.
2. Try supplying some Text for the window. WindowDesc::textDesc
3. Disable the TitleBar from having a close button. WindowDesc::window_titleBarCloseButton = false;

rekotc

07-07-2010 20:44:41

thanks!!! it works if i put some text or if i disable the close button..thanks now im happy :D:D