Using CEGUI inside Insight3D (AGI Components)

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

_flo_
Just popping in
Just popping in
Posts: 2
Joined: Fri Jun 10, 2011 19:32

Using CEGUI inside Insight3D (AGI Components)

Postby _flo_ » Fri Jun 10, 2011 20:27

Hi all,

For the project I'm working on, we need to add numerous, and somewhat complex overlay controls onto the scene of Insight3D (http://insight3d.agi.com/), the 3D engine for AGI Components. To describe this engine in a few words, it is used in aerospace/map applications, and is specialized in drawing stuff in space, on and around Earth (like Google Earth for example but aerospace-centered).

So, I'm considering using CEGUI for this task, since it has the huge advantage to offer a lot of features out of the box, fulfilling all our needs.

DIsclaimer : I am new to CEGUI and not very familiar with graphics programming, so if I write something horribly wrong, please don't blame me too much :)

As I understood it, the approach for this is to write your own Renderer to integrate CEGUI with the underlying engine (here, Insight3D). So I looked at the classes to implement, and I'm not sure it's doable, because Insight3D has a high-level .NET API and exposes very little of its internals. Indeed, it is aimed at rapidly developing aerospace apps, and it is not nearly as flexible as something like Ogre for example.

However, it still allows the user to hook a handler before any scene is rendered, and supports screen overlays. Using the TextureScreenOverlay class, you can overlay any texture, since it is flexible on the texture format. You can also do screen overlay "picking" (i.e. user interaction).

Is that sufficient? Because when I looked at implementation of the Ogre renderer, it seemed way more complex than that, but maybe is it because the Ogre engine itself is more complex? I'm especially concerned about the "low-level" services a renderer must provide like the ones in GeometryBuffer. Basically, what I need to do is to render CEGUI "scene" into a bitmap image in memory, and pass it to Insight3D. Is there some "easy" way to get this done?

If not, I imagined using an existing CEGUI renderer (Direct3D for example), customized for my need, which is getting the contents of what should be displayed in the rendering window. Since it certainly cannot be done from the same process as Insight3D (sharing the graphics card without knowing it will most certainly make both engines fail...), I would then make the rendering in a separate process and pass the rendering window contents via shared memory. But is it even possible to use for example Direct3D to render something in a hidden window? Or to get the contents of a D3D viewport as raw "bitmap" data? I'm starting to feel pretty clueless here ... :)

Thanks in advance for any help you can provide! :)

Flo

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

Re: Using CEGUI inside Insight3D (AGI Components)

Postby Kulik » Sat Jun 11, 2011 13:11

Well rendering gets fairly easy if you strip the offscreen rendering from it. All CEGUI rendering is done by drawing rectangles with images. If Insight3D can do that then you can write a proper renderer for it.

If Insight3D renders via OpenGL or DirectX, maybe you could just use the stock renderers and call renderGUI at the right time.

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

Re: Using CEGUI inside Insight3D (AGI Components)

Postby CrazyEddie » Sun Jun 12, 2011 07:12

The existing renderers were all created to be pretty generic, so while looking at those is certainly a good thing to do, it pays to keep in mind that if you have something specific in mind as regards to your own needs (such as drawing everything to an offscreen buffer / bitmap), what you see in the renderer code we have will perhaps not tie in precisely with the needs you have or the API you have to interface with. In these cases I would suggest thinking of the CEGUI classes you need to create as abstractly as possible...

For GeometryBuffer, yes, this receives texture change notifications and triangle list geometry. However, you can think of this as an 'image cache' of some kind. For example it could be possible to translate the geometry received (back) into some higher-level data that can be more readily used by the target API or Engine. Currently CEGUI provides nothing beyond basic triangles arranged as quads to GeometryBuffer. The same goes for the object used for what we refer to as the 'default rendering root', typically this returns something that would draw GeometryBuffer content to the screen, but in your own renderer it could draw stuff to some offscreen location or bitmap.

As Kulik mentions, some stuff is optional - such as additional offscreen surfaces, which are normally implemented via render to texture. It's acceptable to omit this and return zero pointers if you do not need that functionality. Also, you might decide to trim other features you do not need.

I would say it's certainly possible, so long as you accept and work within any limitations that the target API or engine presents.

CE.

_flo_
Just popping in
Just popping in
Posts: 2
Joined: Fri Jun 10, 2011 19:32

Re: Using CEGUI inside Insight3D (AGI Components)

Postby _flo_ » Thu Jun 16, 2011 13:26

First of all, thank you for your answers.

If I understand you correctly, it is possible to "draw" CEGUI stuff to an offline bitmap, that I would then use as a texture screen overlay in AGI?

Do you have any idea of how to proceed? I just got back on this now, and my first step is to get a 'dummy' custom renderer that would just output as many data as it can on what kind of input it receives from CEGUI. Then I would have some insight on what I must do... Is that the right way to start in your opinion? Or the fact that such a renderer does nothing will not get me enough relevant data?

Last question : What do you mean by "quads"? 2 triangles that make a rectangle? Sorry for being such a total noob... :)


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 17 guests