[solved] Rendering GUI in 3D space ( Ogre )

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

Sairon
Not too shy to talk
Not too shy to talk
Posts: 22
Joined: Sun Dec 07, 2008 01:11

[solved] Rendering GUI in 3D space ( Ogre )

Postby Sairon » Fri Dec 04, 2009 18:52

We have a 3D scene in which we want to incorporate GUI elements. I presume the first step is to get CEGUI to render to a render target, which texture our object / quad with. So, what's the easiest way to get this going? The current approach I have in mind is using setRenderingSurface() to associate the render target with the GUI element, and then simply fire off a render() on it. Would this work or is the perhaps a better way?
Last edited by Sairon on Wed Dec 09, 2009 16:35, edited 1 time in total.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Rendering GUI in 3D space ( Ogre )

Postby CrazyEddie » Sat Dec 05, 2009 14:08

Hi,

What you suggest as a possible approach is largely correct (but see below). In some future 0.7.x release this will be made easier still since such things have been planned for 0.7 from the start (though omitted so far due to the need to have new releases in a timely fashion).

A couple of points to be aware of in our related not-quite-ready-yet parts of the system...

The layout / root window for the particular UI in question will possible (or even likely) not be attached to the set GUI sheet. This means the regular System::renderGUI call will not update the rendering on this part of the UI - to overcome this, you need to perform the update yourself (so calling Renderer::beginRendering, clearing the target of imagery & geometry, calling Window::render for the root of the UI part, calling RenderingSurface::draw, and finally calling Renderer::endRendering - you might like to look at the code for System::renderGUI, since that's pretty much what you need to reproduce). NB: you likely will not want to do that *every* frame unless you like slow rendering, so the update should be done before the call to System::renderGUI, so you can check whether a redraw is required via System::isRedrawRequested.

The second potential issue is with input processing - currently this always uses whatever is set as the GUI sheet as the root, so you may have to take some action to work around this if you need to.

Lastly, at certain points in the system, basically when looking for the parent size of a root window, we currently always use the display size / size of the default rendering surface. This is technically incorrect and should use the size of the root rendering surface of any given UI hierarchy. Whether this is an issue at all will depend upon what you're doing exactly and what your expectations are.

CE.

Sairon
Not too shy to talk
Not too shy to talk
Posts: 22
Joined: Sun Dec 07, 2008 01:11

Re: Rendering GUI in 3D space ( Ogre )

Postby Sairon » Sat Dec 05, 2009 14:16

Ah, thanks for the indepth response :)

Sairon
Not too shy to talk
Not too shy to talk
Posts: 22
Joined: Sun Dec 07, 2008 01:11

Re: Rendering GUI in 3D space ( Ogre )

Postby Sairon » Wed Dec 09, 2009 16:35

Got it working. The largest problem actually was me forgetting to handle device reset. Since CEGUI doesn't use RendererListner in the Ogre renderer there was some problems restoring the surface since doing it with a RendererListner didn't guarantee that CEGUI surfaces had been restored at that point.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: [solved] Rendering GUI in 3D space ( Ogre )

Postby CrazyEddie » Thu Dec 10, 2009 10:03

Cool. Thanks for letting us know you got it working, and for mentioning the pitfall as regards to device / resource restoration.

CE


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 4 guests