Geometry buffers usage to draw custom geometry?

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

Montred
Not too shy to talk
Not too shy to talk
Posts: 42
Joined: Sat Nov 10, 2012 06:45

Geometry buffers usage to draw custom geometry?

Postby Montred » Mon Jan 21, 2013 02:07

I want to draw custom geometry. I have to draw a lot of textured rectangles on screen and their positions may change in every frame. Using a cegui window for each is overkill. I want to send them to the GPU in the same batch. (in case it matters, I'm on 0.7.9, using Ogre3D 1.8.1 with D3D9.)

I've searched for a couple of hours now and my current understanding is that I have to subclass CEGUI::Window and override getGeometryBuffer() and supply my own geometry. Is this correct?

Is there documentation or an example somewhere? Has anybody done this? Any pointers would be appreciated. If possible I would prefer not to go into this without any documentation because I may be leaking something without knowing or doing something that will be broken in the next major version of CEGUI. I can perhaps contribute a snippet to the wiki with what I learn.

I feel a little silly asking this because the description of this subforum includes "- Writing custom Window and WindowRenderer classes." Yet I cannot find a thread about somebody writing a custom window with custom vertex data.

EDIT: I did see the Wiki article about this but it doesn't quite do what I need, I want CEGUI to draw the geometry that I supply, not me.

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

Re: Geometry buffers usage to draw custom geometry?

Postby CrazyEddie » Tue Jan 22, 2013 10:25

I don't think this is really documented at all yet, beyond the WIki tutorial.

If you want to use a window (like a root window, or pehaps an 'overlay window' - full-screen, always on top with passthrough enabled) you can't override getGeometryBuffer - this just returns the geometry buffer that the window owns. You could call that function and make use of the geometry buffer returned, although the content of that is reset when CEGUI decides that a redraw is needed. To use Window, the correct way would be to subclass and override the Window::populateGeometryBuffer function to fill the buffer with whatever you need or make use of a WindowRenderer and override the WindowRenderer::render function (poorly named by this point, the function actually just populates the GeometryBuffer for the target window, and does not render directly).

What you might consider, depending on your needs, is to bypass the window layer all together and target the slightly lower level render queues. Here you create a GeometryBuffer manually, and add it to some render queue on some render target. You can update the content as needed and CEGUI will just render it at the right time according to the queue it's added to. To clean that up, you remove it from the queue and destroy the buffer - job done. Look at the example base apps for an example of that approach in action - it's how we overlay the FPS and logo display in the 0.7.x samples.

CE.

Montred
Not too shy to talk
Not too shy to talk
Posts: 42
Joined: Sat Nov 10, 2012 06:45

Re: Geometry buffers usage to draw custom geometry?

Postby Montred » Tue Jan 22, 2013 12:13

Ah, thanks a lot, I'll check the samples, that sounds much more like what I wanted, low overhead, plus I don't need input, so that's ideal.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 17 guests