# CEGUI::Renderer Class Reference

Abstract class defining the interface for Renderer objects. More...

Inheritance diagram for CEGUI::Renderer:

[legend]
Collaboration diagram for CEGUI::Renderer:

[legend]
List of all members.

## Public Member Functions

virtual void | addQuad (const Rect &dest_rect, float z, const Texture *tex, const Rect &texture_rect, const ColourRect &colours, QuadSplitMode quad_split_mode)=0
| Add a quad to the rendering queue. All clipping and other adjustments should have been made prior to calling this.
virtual void | doRender (void)=0
| Perform final rendering for all quads that have been queued for rendering.
virtual void | clearRenderList (void)=0
| Clears all queued quads from the render queue.
virtual void | setQueueingEnabled (bool setting)=0
| Enable or disable the queueing of quads from this point on.
virtual Texture * | createTexture (void)=0
| Creates a 'null' Texture object.
virtual Texture * | createTexture (const String &filename, const String &resourceGroup)=0
| Create a Texture object using the given image file.
virtual Texture * | createTexture (float size)=0
| Create a Texture object with the given pixel dimensions as specified by size. NB: Textures are always square.
virtual void | destroyTexture (Texture *texture)=0
| Destroy the given Texture object.
virtual void | destroyAllTextures (void)=0
| Destroy all Texture objects.
virtual bool | isQueueingEnabled (void) const =0
| Return whether queueing is enabled.
virtual float | getWidth (void) const =0
| Return the current width of the display in pixels.
virtual float | getHeight (void) const =0
| Return the current height of the display in pixels.
virtual Size | getSize (void) const =0
| Return the size of the display in pixels.
virtual Rect | getRect (void) const =0
| Return a Rect describing the screen.
virtual uint | getMaxTextureSize (void) const =0
| Return the maximum texture size available.
virtual uint | getHorzScreenDPI (void) const =0
| Return the horizontal display resolution dpi.
virtual uint | getVertScreenDPI (void) const =0
| Return the vertical display resolution dpi.
void | resetZValue (void)
| Reset the z co-ordinate for rendering.
void | advanceZValue (void)
| Update the z co-ordinate for the next major UI element (window).
float | getCurrentZ (void) const
| return the current Z value to use (equates to layer 0 for this UI element).
float | getZLayer (uint layer) const
| return the z co-ordinate to use for the requested layer on the current GUI element.
const String & | getIdentifierString () const
| Return identification string for the renderer module. If the internal id string has not been set by the Renderer module creator, a generic string of "Unknown renderer" will be returned.
virtual ResourceProvider * | createResourceProvider (void)

## Static Public Attributes

static const String | EventNamespace
| Namespace for global events.
static const String | EventDisplaySizeChanged

## Protected Attributes

ResourceProvider * | d_resourceProvider
| Holds the pointer to the ResourceProvider object.
String | d_identifierString
| String that holds some id information about the renderer.

## Detailed Description

Abstract class defining the interface for Renderer objects.

Objects derived from Renderer are the means by which the GUI system interfaces with specific rendering technologies. To use a rendering system or API to draw CEGUI imagery requires that an appropriate Renderer object be available.

## Member Function Documentation

virtual void CEGUI::Renderer::addQuad | ( | const Rect & | dest_rect,
|  | float | z,
|  | const Texture * | tex,
|  | const Rect & | texture_rect,
|  | const ColourRect & | colours,
|  | QuadSplitMode | quad_split_mode
| ) | `[pure virtual]`

Add a quad to the rendering queue. All clipping and other adjustments should have been made prior to calling this.

Parameters:

  | dest_rect | Rect object describing the destination area (values are in pixels)
  | z | float value specifying the z co-ordinate / z order of the quad
  | tex | pointer to the Texture object that holds the imagery to be rendered
  | texture_rect | Rect object holding the area of tex that is to be rendered (values are in texture co-ordinates).
  | colours | ColourRect object describing the colour values that are to be applied when rendering.
  | quad_split_mode | One of the QuadSplitMode values specifying the way quads are split into triangles

Returns:
  Nothing

Implemented in CEGUI::DirectX81Renderer, CEGUI::DirectX9Renderer, CEGUI::IrrlichtRenderer, and CEGUI::OpenGLRenderer.

void CEGUI::Renderer::advanceZValue | ( | void |  | ) | `[inline]`

Update the z co-ordinate for the next major UI element (window).

Returns:
  Nothing

virtual void CEGUI::Renderer::clearRenderList | ( | void |  | ) | `[pure virtual]`

Clears all queued quads from the render queue.

Returns:
  Nothing

Implemented in CEGUI::DirectX81Renderer, CEGUI::DirectX9Renderer, CEGUI::IrrlichtRenderer, and CEGUI::OpenGLRenderer.

virtual Texture* CEGUI::Renderer::createTexture | ( | float | size | ) | `[pure virtual]`

Create a Texture object with the given pixel dimensions as specified by size. NB: Textures are always square.

Parameters:

  | size | float value that specifies the size to use for the width and height when creating the new texture.

Returns:
  a newly created Texture object. The initial contents of the texture memory is undefined / random.

Note:
  Textures are always created with a size that is a power of 2. If you specify a size that is not a power of two, the final size will be rounded up. So if you specify a size of 1024, the texture will be (1024 x 1024), however, if you specify a size of 1025, the texture will be (2048 x 2048). You can check the ultimate size by querying the texture after creation.

Implemented in CEGUI::DirectX81Renderer, CEGUI::DirectX9Renderer, CEGUI::IrrlichtRenderer, and CEGUI::OpenGLRenderer.

virtual Texture* CEGUI::Renderer::createTexture | ( | const String & | filename,
|  | const String & | resourceGroup
| ) | `[pure virtual]`

Create a Texture object using the given image file.

Parameters:

  | filename | String object that specifies the path and filename of the image file to use when creating the texture.
  | resourceGroup | Resource group identifier to be passed to the resource provider when loading the texture file.

Returns:
  a newly created Texture object. The initial contents of the texture memory is the requested image file.

Note:
  Textures are always created with a size that is a power of 2. If the file you specify is of a size that is not a power of two, the final size will be rounded up. Additionally, textures are always square, so the ultimate size is governed by the larger of the width and height of the specified file. You can check the ultimate sizes by querying the texture after creation.

Implemented in CEGUI::DirectX81Renderer, CEGUI::DirectX9Renderer, CEGUI::IrrlichtRenderer, and CEGUI::OpenGLRenderer.

virtual Texture* CEGUI::Renderer::createTexture | ( | void |  | ) | `[pure virtual]`

Creates a 'null' Texture object.

Returns:
  a newly created Texture object. The returned Texture object has no size or imagery associated with it, and is generally of little or no use.

Implemented in CEGUI::DirectX81Renderer, CEGUI::DirectX9Renderer, CEGUI::IrrlichtRenderer, and CEGUI::OpenGLRenderer.

virtual void CEGUI::Renderer::destroyAllTextures | ( | void |  | ) | `[pure virtual]`

Destroy all Texture objects.

Returns:
  Nothing

Implemented in CEGUI::DirectX81Renderer, CEGUI::DirectX9Renderer, CEGUI::IrrlichtRenderer, and CEGUI::OpenGLRenderer.

virtual void CEGUI::Renderer::destroyTexture | ( | Texture * | texture | ) | `[pure virtual]`

Destroy the given Texture object.

Parameters:

  | texture | pointer to the Texture object to be destroyed

Returns:
  Nothing

Implemented in CEGUI::DirectX81Renderer, CEGUI::DirectX9Renderer, CEGUI::IrrlichtRenderer, and CEGUI::OpenGLRenderer.

virtual void CEGUI::Renderer::doRender | ( | void |  | ) | `[pure virtual]`

Perform final rendering for all quads that have been queued for rendering.

The contents of the rendering queue is retained and can be rendered again as required. If the contents is not required call clearRenderList().

Returns:
  Nothing

Implemented in CEGUI::DirectX81Renderer, CEGUI::DirectX9Renderer, CEGUI::IrrlichtRenderer, and CEGUI::OpenGLRenderer.

float CEGUI::Renderer::getCurrentZ | ( | void |  | ) | const`[inline]`

return the current Z value to use (equates to layer 0 for this UI element).

Returns:
  float value that specifies the z co-ordinate to be used for layer 0 on the current GUI element.

virtual float CEGUI::Renderer::getHeight | ( | void |  | ) | const`[pure virtual]`

Return the current height of the display in pixels.

Returns:
  float value equal to the current height of the display in pixels.

Implemented in CEGUI::DirectX81Renderer, CEGUI::DirectX9Renderer, CEGUI::IrrlichtRenderer, and CEGUI::OpenGLRenderer.

virtual uint CEGUI::Renderer::getHorzScreenDPI | ( | void |  | ) | const`[pure virtual]`

Return the horizontal display resolution dpi.

Returns:
  horizontal resolution of the display in dpi.

Implemented in CEGUI::DirectX81Renderer, CEGUI::DirectX9Renderer, CEGUI::IrrlichtRenderer, and CEGUI::OpenGLRenderer.

const String & CEGUI::Renderer::getIdentifierString | ( |  | ) | const

Return identification string for the renderer module. If the internal id string has not been set by the Renderer module creator, a generic string of "Unknown renderer" will be returned.

Returns:
  String object holding a string that identifies the Renderer in use.

virtual uint CEGUI::Renderer::getMaxTextureSize | ( | void |  | ) | const`[pure virtual]`

Return the maximum texture size available.

Returns:
  Size of the maximum supported texture in pixels (textures are always assumed to be square)

Implemented in CEGUI::DirectX81Renderer, CEGUI::DirectX9Renderer, CEGUI::IrrlichtRenderer, and CEGUI::OpenGLRenderer.

virtual Rect CEGUI::Renderer::getRect | ( | void |  | ) | const`[pure virtual]`

Return a Rect describing the screen.

Returns:
  A Rect object that describes the screen area. Typically, the top-left values are always 0, and the size of the area described is equal to the screen resolution.

Implemented in CEGUI::DirectX81Renderer, CEGUI::DirectX9Renderer, CEGUI::IrrlichtRenderer, and CEGUI::OpenGLRenderer.

virtual Size CEGUI::Renderer::getSize | ( | void |  | ) | const`[pure virtual]`

Return the size of the display in pixels.

Returns:
  Size object describing the dimensions of the current display.

Implemented in CEGUI::DirectX81Renderer, CEGUI::DirectX9Renderer, CEGUI::IrrlichtRenderer, and CEGUI::OpenGLRenderer.

virtual uint CEGUI::Renderer::getVertScreenDPI | ( | void |  | ) | const`[pure virtual]`

Return the vertical display resolution dpi.

Returns:
  vertical resolution of the display in dpi.

Implemented in CEGUI::DirectX81Renderer, CEGUI::DirectX9Renderer, CEGUI::IrrlichtRenderer, and CEGUI::OpenGLRenderer.

virtual float CEGUI::Renderer::getWidth | ( | void |  | ) | const`[pure virtual]`

Return the current width of the display in pixels.

Returns:
  float value equal to the current width of the display in pixels.

Implemented in CEGUI::DirectX81Renderer, CEGUI::DirectX9Renderer, CEGUI::IrrlichtRenderer, and CEGUI::OpenGLRenderer.

float CEGUI::Renderer::getZLayer | ( | uint | layer | ) | const`[inline]`

return the z co-ordinate to use for the requested layer on the current GUI element.

Parameters:

  | layer | Specifies the layer to return the Z co-ordinate for. Each GUI element can use up to 10 layers, so valid inputs are 0 to 9 inclusive. If you specify an invalid value for layer, results are undefined.

Returns:
  float value that specifies the Z co-ordinate for layer layer on the current GUI element.

virtual bool CEGUI::Renderer::isQueueingEnabled | ( | void |  | ) | const`[pure virtual]`

Return whether queueing is enabled.

Returns:
  true if queueing is enabled, false if queueing is disabled.

Implemented in CEGUI::DirectX81Renderer, CEGUI::DirectX9Renderer, CEGUI::IrrlichtRenderer, and CEGUI::OpenGLRenderer.

void CEGUI::Renderer::resetZValue | ( | void |  | ) | `[inline]`

Reset the z co-ordinate for rendering.

Returns:
  Nothing

virtual void CEGUI::Renderer::setQueueingEnabled | ( | bool | setting | ) | `[pure virtual]`

Enable or disable the queueing of quads from this point on.

This only affects queueing. If queueing is turned off, any calls to addQuad will cause the quad to be rendered directly. Note that disabling queueing will not cause currently queued quads to be rendered, nor is the queue cleared - at any time the queue can still be drawn by calling doRender, and the list can be cleared by calling clearRenderList. Re-enabling the queue causes subsequent quads to be added as if queueing had never been disabled.

Parameters:

  | setting | true to enable queueing, or false to disable queueing (see notes above).

Returns:
  Nothing

Implemented in CEGUI::DirectX81Renderer, CEGUI::DirectX9Renderer, CEGUI::IrrlichtRenderer, and CEGUI::OpenGLRenderer.

## Member Data Documentation

const String CEGUI::Renderer::EventDisplaySizeChanged `[static]`

| event that fires when the underlying display size had changed. It is important that all Renderer implementers fire this properly as the system itself subscribes to this event.