Page 1 of 1

[ANSWERED] Widgets with not a rectangular form

Posted: Sat Feb 27, 2010 09:22
by madeinsoviets
Hello everyone...)
We are developing some kind of a simulater under Ogre3D and now we are choosing GUI system - so we have some requirements to it...
Are there any ways to creat widgets in CEGUI with not a rectangular form? For example circle button? Maybe some rectangular widgets with alpha culling? Point me a direction please..

Re: Widgets with not a rectangular form

Posted: Sat Feb 27, 2010 15:27
by madeinsoviets
Image

Re: Widgets with not a rectangular form

Posted: Mon Mar 01, 2010 07:55
by madeinsoviets
Hey, noone knows?

Re: Widgets with not a rectangular form

Posted: Mon Mar 01, 2010 08:25
by CrazyEddie
Hi,

Please don't bump posts that are only two posts down! Eventually I come here and see all posts, and will reply to any that have not otherwise been answered - though sometimes I do not come here every day; even I have days off or have other things that I have to get done ;)

To answer the question... While CEGUI is very much based upon the concept of rectangles, this may be possible, perhaps, depending upon the precise requirements :lol: Not a very straight forward answer...

There obviously is no function, createNonRectangularWindow - so any solution is going to be more involved than that ;) Also, I would say it's reasonably doubtful that a 'generic non-rectangular window' is easily achieved; any solution will need to be tailored specifically to the problem at hand. The way I see this, there are two main issues to be overcome 1) hit-testing the window area, and 2) clipping of child content.

1) You can hook into this process by overriding the Window::isHit function and rather testing for a point in a Rect, you would have to go off and do something else (depending on the exact nature of the window). Here 'something else' just means determining whether a point is within the 'red bit' of the posted image - how to do that is left as an exercise for the user!

2) Clipping is maybe more of an issue where it's required. If it's not required; if the window will have no child content, you're home and dry. Otherwise, you'll need to come up with something special. Clipping in CEGUI is very much a rectangular thing, and no real hooks exist to do anything else. However, you may still be able to come up with a solution using the RenderEffect interface - perhaps using a shader of some kind - to mask imagery outside the visible region. Definitely not something that's straight forwards, though.

So, to conclude... Possible? Perhaps, depending on the exact needs. Easy? Certainly not something for the faint hearted ;)

HTH

CE.

Re: Widgets with not a rectangular form

Posted: Mon Mar 01, 2010 08:48
by madeinsoviets
Thanks a lot, sorry for importunity..)

Re: [ANSWERED] Widgets with not a rectangular form

Posted: Mon Sep 13, 2010 09:09
by r0br0y
Hi,

someone got masking of childwindows working? or somekind of tutorial/example?
I need some way to hide content of childwindows related to the alphachannel of a parented window...


thanks much!

Re: [ANSWERED] Widgets with not a rectangular form

Posted: Mon Sep 13, 2010 09:24
by CrazyEddie
The situation is largely as before: non-rectangular clipping / masking of rendered output is not supported, and in all honesty, will probably never be supported. There may (or may not) be ways to get this to work, perhaps involving use of stencils or shaders or what have you, though it will require the use of custom Window types and / or custom WindowRenderer types, it's not something I've tried, and is not something I can advise on in any meaningful way.

For hit-testing, I wrote a Wiki article about that, which you can see here: http://www.cegui.org.uk/wiki/index.php/ ... EGUI_0.7.x

CE.