QuickGUI and multiple viewports

Templarc

25-11-2009 16:35:29

Hi,
I have some troubles dealing with multiple viewports in ogre and using QuickGUI at the time. Actually I managed to do what I wanted to do, but I wonder if there is not a better way to do it...

In my Ogre window, I have perfectly split the window with two viewports (same RenderManager anyway). i want to display a button on each viewport, and be able to click on one or the other.

First viewport : a sheet. Position 0:0 in the viewport and size the size of the viewport (window width/2, window height).
Second viewport : a sheet. Position 0:0 in the viewport and size the size of the viewport (window width/2, window height).
My problem is that the sheet of the second viewport is at the position (0:0) in the viewport, but at the absolute position (window width/2, window height) in my Ogre window.

So here is my question : is there a way to say that in absolute position the sheet is at the position (window width/2, window height) in my Ogre window. it's because when I inject the mouse position events in QuickGUI, when it's in the first viewport (position x < window width/2) then it displays the same cursor on the sheet of the second viewport.

The only solution I found was to inject the position x of the mouse less window width/2 for the second GUI manager...

If someone can help me...

Cheers

kungfoomasta

25-11-2009 19:13:51

Hm, this is interesting. There are 2 viewports side by side, and viewports contain the textures for the GUI, so I don't think you can easily make a seemless transition, for example drawing half the mouse in one viewport and half in another. As for input injection, I think you would have to do what you said, ie 'prepare' the input data before passing it into QuickGUI.

pseudo:

if mouse values are within first viewport
hide mouse in all other viewports
if mouse overlaps second viewport
show mouse cursor in second viewport
create modified mouse input: mouse pos - viewport width
send modified mouse input data to GUIManager of second viewport
send mouse input data to GUIManager of first viewport
else if mouse values are within second viewport
hide mouse in all other viewports
if mouse overlaps first viewport
show mouse cursor in first viewport
send mouse input data to GUIManager of first viewport
create modified mouse input: mouse pos - viewport width
send modified mouse input data to GUIManager of second viewport


You asked if we could tell the second viewport GUIManager that its origin is not relative to the viewport its drawn in, but instead the render window that contains it, but I think its easier just to modify the mouse input data before using it.

Templarc

26-11-2009 07:38:02

Ok thanks, that's what I did and I didn't find anything else on the forum...

Other question, is there more complex tutorials than the four beginner tutorials on the QuickGUI main page ?

Calder

29-11-2009 18:18:56

Short answer: No.
Longer answer: The AnimationViewer and QuickGUIEditor apps that come with the source are pretty good examples for a lot of practices. Out of curiosity, what specific topics would you like additional tutorials cover?

kungfoomasta

30-11-2009 21:15:01

There aren't more tutorials, I'm not sure what kinds of things people would be interested in. Suggestions welcome.

Templarc

01-12-2009 10:25:28

Actually it was more about the different properties of the different widget. I was more looking for a doxygen list, which I found in between (didn't see the .zip at the first look).

I will look at the AnomationViewer and QUickGUIEditor source code. I didn't think about looking them. Neither tried them actually :p

Calder

02-12-2009 13:32:17

A-nom-mation viewer. :D