All About RenderTargets

From CEGUI Wiki - Crazy Eddie's GUI System (Open Source)
Jump to: navigation, search

Written for CEGUI 0.7

Works with versions 0.7.x (obsolete)

subtitle: CrazyEddie broke my renderer

This article is intended to be a fluid piece that I will change and update as the work on the Renderer modifications is done. It's not intended as a dry, serious piece, although any technical details and such like should all be accurate.

The general goal of these modifications is to complete the 'Renderer enhancements' item from the old 0.6.0 roadmap. These items were described as:

  • Renderer enhancements
    • Allow for several GUI in several context.
    • Whole window caching.
    • Each Window is attached to a rendering target.
    • Optimised non queued drawing operations.
    • General rendering optimisations.

Renderers - times are changing

To date, all rendering was done by the renderer - that's why it had that name. The new RenderTarget system breaks this functionality out of the renderer and places it elsewhere. Under the new arrangements the renderer is set to become more of a utility and factory class; mainly creating various objects that target the associated underlying API or engine, and offering support functions as required.

What is a RenderTarget

A RenderTarget is a class of objects that can be the target of rendering operations (duh!). Basically it's a generic interface to 'anything' that can be rendered to (obviously a concrete class must be implemented to support it). In general there are, or will be, two broad types of RenderTarget. The first is a 'view port' type target - this directs rendering to the screen (or a portion of it). The second type is a 'texture' type target - this directs rendering to a texture of some kind. Texture targets are useful within CEGUI for caching the imagery of window objects, though outside of CEGUI there may be various more exciting uses.

Multiple GUI Roots

The main other addition will be that the system will eventually support multiple GUI 'roots'. Each root window will have its own root RenderTarget and so offer the ability to have different GUIs in different viewports, or maybe targetting textures to have GUIs appearing on items 'in game'.

Code Location and Status

The work on this renderer rewrite was eventually split into another branch (renderer-rewrite-devel) and started again! However, the major implementation work has been completed and the code merged back into the unstable trunk. Currently all renderers are functional with the exception of the DirectFB module; I hope to get this working by the time we need to release 0.7.0. There are large numbers of issues with the code currently (trunk is not referred to as unstable just for fun, you know), though over time these should get addressed and CEGUI will be all the better for it.

Discussion / Bug Reports

If you wish to offer some opinion (but not to nag me) about some aspect of this area of development, or report some bug that is directly related to this area of development, please post in the following forum thread

Mini FAQ

This is a mini FAQ. It's kind of a repository for questions and comments that are likely to come up regarding the RenderTarget changes in CEGUI. It's not exhaustive, and it's not supposed to be.

Why are you doing this?

  • In any project it is important to try and keep moving forwards. This is my attempt to address some known issues and also offer other some new functionality into the bargain.

Isn't this just some quick fix? A reaction to other projects?

  • No, not at all. These changes have been planned for a long, long time (since before some of those 'other projects' even existed), and were originally intended to be in and fully tested for the 0.6.0 release that would originally have been out late Q1 2007.

So, why now?

  • The main reason it wasn't done before now is because I was not around to work on the project at all, and other developers have had other things to do also. Since I have a little time to give something to CEGUI, I thought I'd try and give it something important.

You broke all the Renderers!

  • Yes, I did. This is the first time the renderer interface has significantly changed since the inception of CEGUI-Mk2 in 2004.

Why did you do the OpenGL renderer first? I do not use this renderer!

  • Well, I had to start somewhere! OpenGL is the one renderer that will run on all systems without requiring additional dependencies. Since it's also one of the lower-level renderers it served as a good choice for the 'reference code'.

When will the Renderer for <my engine> be updated?

  • As soon as it gets done. By the time this code features in an actual release, all the existing renderers will have been updated for the new Renderer model.

I have no RTT support, this means I will no longer be able to use CEGUI!

  • Not true - these changes are well designed. If it happens that such support is missing, the system should operate no worse than it did before.

Now rendered imagery is cached, you'll be using up all my video RAM!

  • Not true - these changes are well designed. It is possible to disable caching to texture on various levels depending on the requirements you have.

I have volatile window content. since you're caching to textures, my performance will be worse!

  • Not true - these changes are well designed. If you know that your window will suffer due to its volatile nature, you can turn off caching for just that window (leaving it enabled on others if so desired).

I have found a bug! Are you interested?

  • Yeah, I'm interested. Within this context I'm more interested in bugs affecting the new Renderer / RenderTarget code only, as opposed to bugs in the core of CEGUI (which I am interested in, but post those on mantis as usual). What I'm not interested in is people telling me that their renderer module is broken (I know this already, I'm the one that broke it!), or that some other module in CEGUI needs updating (again, I already know). Please use this forum thread.

Is CrazyEddie back in charge of CEGUI?

  • Nobody is 'in charge' of CEGUI. CEGUI is free software.

I don't like CEGUI. It sucks, and CrazyEddie sucks too!

  • Why are you wasting your time here then? Personally I couldn't really care what some nobody on the internet thinks; I have better ways to spend my time.