[SOLVED]Buttons, Labels, etc. not rendering when in Debug

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

frigopie
Just popping in
Just popping in
Posts: 8
Joined: Mon Mar 01, 2010 21:37

[SOLVED]Buttons, Labels, etc. not rendering when in Debug

Postby frigopie » Fri Sep 13, 2013 02:50

Hi!

I am using VS2010 and cegui 0.7.2, I haven't had problems until now.
VS configuration is ok, include path, lib path and *_d.lib to use, also *_d.dll are on their place.
I have a problem visualizing this elements when they are created dynamically and in Debug mode. If I run the Release configuration everything is OK. If I load a window from a layout file, all is ok in Release and Debug mode. It only fails when I create the elements dynamically and use them in Debug configuration. The root window is a DefaultWindow, but if I set it to FrameWindow, I can see the window borders but not the elements created inside, also I can see the CEGUI cursor.
Here is the code I use to create the elements:

Code: Select all

//The window
Window *pantalla;

try{
      pantalla = (DefaultWindow*)WindowManager::getSingleton().createWindow("DefaultWindow");
      pantalla->setSize(UVector2(UDim(0,1280), UDim(0,720)));
      pantalla->setAlpha(1.0);
      pantalla->setPosition(UVector2(UDim(0,0), UDim(0,0)));
}catch(CEGUI::InvalidRequestException &e){
      printf("%s\n",e.getMessage().c_str());
      Error("Error starting PantallaGUI \n%s", e.getMessage().c_str());
}


//The button
PushButton* guiButton;

try{
   guiButton = (PushButton*)WindowManager::getSingleton().createWindow(CEGUI_THEME"/Button");
   UVector2 v;
   v.d_x.d_offset =  200;
   v.d_y.d_offset =  200;
   guiButton->setPosition(v);
   guiButton->setSize(UVector2(UDim(0,320), UDim(0,40)));
   guiButton->setText("Hi");
   guiButton->setProperty("HorzLabelFormatting", "RightAligned");
   pantalla->addChildWindow(guiButton);
   guiButton->show();
   guiButton->activate();

   guiButton->subscribeEvent(PushButton::EventMouseEnters, Event::Subscriber(&WdgButtonFlash::onMouseOver, this));
   guiButton->subscribeEvent(PushButton::EventMouseLeaves, Event::Subscriber(&WdgButtonFlash::onMouseLeaves, this));
}catch(CEGUI::InvalidRequestException &e){
      Error("Error starting PantallaGUI \n%s", e.getMessage().c_str());
}


Anyone have an idea of what's happening?

Thanks.
Last edited by frigopie on Wed Sep 18, 2013 06:07, edited 1 time in total.

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Buttons, Labels, etc. not rendering when in Debug mode

Postby Kulik » Fri Sep 13, 2013 11:40

This could be a number of things.

Apps that behave differently in debug mode usually rely on uninitialised variables, check that. You could also be mixing up debug and release msvc runtimes which causes nasty problems.

Either way, I suspect a memory issue or library mismatch.

frigopie
Just popping in
Just popping in
Posts: 8
Joined: Mon Mar 01, 2010 21:37

Re: Buttons, Labels, etc. not rendering when in Debug mode

Postby frigopie » Mon Sep 16, 2013 21:49

it is strange, because even in release mode, sometimes it fails. If I set a position to an element, even if is the same position it has, the element will not be visible. It has to be a cegui bug, i will try to examine the code...

frigopie
Just popping in
Just popping in
Posts: 8
Joined: Mon Mar 01, 2010 21:37

Re: Buttons, Labels, etc. not rendering when in Debug mode

Postby frigopie » Wed Sep 18, 2013 06:06

SOLVED

The problem is that you must initialize UVector2 with values for both scale and offset (set 0.0 to scale if you are working with offset). Looks like in Release mode they are set to 0.0 by default (by the compiler) but not in Debug mode, so initialization is required (I was used to my vector class, where they are set to 0.0 in the constructor).


Return to “Help”

Who is online

Users browsing this forum: No registered users and 10 guests