GUI Element - Problem with Rendering

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

GUI Element - Problem with Rendering

Post by saigumi »

This is code that I've been converting from my 0.5 to 0.6.

When I create a GUI set, I start off with a root IGUITab Control so that I can position the elements. This way, the tab could be moved for where sets of GUI's go and have the offset, which is why all the node are not children of the Root, but children of the IGUITab that is a child of the GUI Environment Root.

The problem is that the children of that IGUITab do not render properly.

Image

This is the bad. If I instead set all the elements as children of the GUI Environment Root, I get the proper look.

Image

Demonstration code can be grabbed here. http://www.saigumi.net/guihandler-bugtrack.zip
Crud, how do I do this again?
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Seems to be a clipping problem. I'll take a look at it.
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

Post by saigumi »

Ugh... been trying to track this one down myself.

The closest thing I could find is this in IGUITab control.

Code: Select all

if (DrawBackground)
driver->draw2DRectangle(BackColor, AbsoluteRect, &AbsoluteClippingRect);
But since an empty tab doesn't have a background, it doesn't call that.

Wait a minute, is there some sort of getParentClip() or getParentAbsoluteRect() thing going on? Because a GUITab in nature would have zeroes for all of those and would cause a problem, but I can't quite track down where that would be.
Crud, how do I do this again?
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post by jox »

Saigumi, are you sure the problem lies in the engine? If I create a IGUITab and add for example two Buttons to it like this (Irrlicht v0.6):

Code: Select all

	IGUITab* tab = guienv->addTab(rect<s32>(100, 100, 200, 150));
	guienv->addButton(rect<s32>(20, 20, 40, 40), tab, -1, L"1");
	guienv->addButton(rect<s32>(60, 20, 80, 40), tab, -1, L"2");
it does exactly what I expect. It places the two buttons relatively to the tab position.

I don't know how you implemented it exactly, I have not taken such a deep look into yor GUIHandler class. But maybe the problem is there somewhere.

Or maybe I got you wrong... :)
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

Post by saigumi »

Did you try running the code I provided?

It may be certain GUI elements that cause the problem, which in my GUIHandler uses.

However, in the example provided, the GUIHandler class that I made is not used. I used the GUI Demo straight from Niko and only added a GUITab and set all of the elements to use it as a parent.
Crud, how do I do this again?
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post by jox »

You mean the demonstration code at http://www.saigumi.net/guihandler-bugtrack.zip? Yes I tried it. And it's rendering is messed up, like in your first screenshot. But it is using your GUIHandler class...

in main():

Code: Select all

/*
Initialize GUI Handler
*/
GH = new GUIHandler(device);

/* 
Conform Scaling to device screen size 
This is un-needed if the GUI XML is set to the size of the device
*/
GH->setScaling(true,irr::core::dimension2d<irr::f32>(512, 384));

/*
Initialize GUI Set
*/
GH->LoadGUI("userinterface.xml", "userinterface");

Further if I take the GUI Demo straight from Niko and add a GUITab and set all of the elements to use it as a parent it works just perfect.

modified 5.UserInterface:

Code: Select all

IGUITab* tab = env->addTab(rect<s32>(100, 100, 500, 500)); 

env->addButton(rect<s32>(10,210,100,240), tab, 101, L"Quit");
env->addButton(rect<s32>(10,250,100,290), tab, 102, L"New Window");
env->addButton(rect<s32>(10,300,100,340), tab, 103, L"File Open");

env->addStaticText(L"Transparent Control:", rect<s32>(150,20,350,40), true, false, tab);
IGUIScrollBar* scrollbar = env->addScrollBar(true, rect<s32>(150, 45, 350, 60), tab, 104);
scrollbar->setMax(255);

env->addStaticText(L"Logging ListBox:", rect<s32>(50,80,250,100), true, false, tab);
listbox = env->addListBox(rect<s32>(50, 110, 250, 180), tab);
So I still can't reproduce your problem... :?
Post Reply