Crazy Eddies GUI System: CEGUI::OpenGLRenderer Class Reference

Crazy Eddies GUI System 0.7.6

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Static Public Member Functions
CEGUI::OpenGLRenderer Class Reference

Renderer class to interface with OpenGL. More...

Inheritance diagram for CEGUI::OpenGLRenderer:
[legend]
Collaboration diagram for CEGUI::OpenGLRenderer:
[legend]

List of all members.

## Public Types
enum | TextureTargetType { TTT_AUTO, TTT_FBO, TTT_PBUFFER, TTT_NONE }
| Enumeration of valid texture target types. More...
## Public Member Functions
RenderingRoot & | getDefaultRenderingRoot ()
| Return the default rendering root for the renderer. The default rendering root is typically a RenderingRoot that targets the entire screen (or rendering window).
GeometryBuffer & | createGeometryBuffer ()
| Create a new GeometryBuffer and return a reference to it. You should remove the GeometryBuffer from any RenderQueues and call destroyGeometryBuffer when you want to destroy the GeometryBuffer.
void | destroyGeometryBuffer (const GeometryBuffer &buffer)
| Destroy a GeometryBuffer that was returned when calling the createGeometryBuffer function. Before destroying any GeometryBuffer you should ensure that it has been removed from any RenderQueue that was using it.
void | destroyAllGeometryBuffers ()
| Destroy all GeometryBuffer objects created by this Renderer.
TextureTarget * | createTextureTarget ()
| Create a TextureTarget that can be used to cache imagery; this is a RenderTarget that does not lose it's content from one frame to another.
void | destroyTextureTarget (TextureTarget *target)
| Function that cleans up TextureTarget objects created with the createTextureTarget function.
void | destroyAllTextureTargets ()
| Destory all TextureTarget objects created by this Renderer.
Texture & | createTexture ()
| Create a 'null' Texture object.
Texture & | createTexture (const String &filename, const String &resourceGroup)
| Create a Texture object using the given image file.
Texture & | createTexture (const Size &size)
| Create a Texture object with the given pixel dimensions as specified by size.
void | destroyTexture (Texture &texture)
| Destroy a Texture object that was previously created by calling the createTexture functions.
void | destroyAllTextures ()
| Destroy all Texture objects created by this Renderer.
void | beginRendering ()
| Perform any operations required to put the system into a state ready for rendering operations to begin.
void | endRendering ()
| Perform any operations required to finalise rendering.
void | setDisplaySize (const Size &sz)
| Set the size of the display or host window in pixels for this Renderer object.
const Size & | getDisplaySize () const
| Return the size of the display or host window in pixels.
const Vector2 & | getDisplayDPI () const
| Return the resolution of the display or host window in dots per inch.
uint | getMaxTextureSize () const
| Return the pixel size of the maximum supported texture.
const String & | getIdentifierString () const
| Return identification string for the renderer module.
Texture & | createTexture (GLuint tex, const Size &sz)
| Create a texture that uses an existing OpenGL texture with the specified size. Note that it is your responsibility to ensure that the OpenGL texture is valid and that the specified size is accurate.
void | enableExtraStateSettings (bool setting)
| Tells the renderer to initialise some extra states beyond what it directly needs itself for CEGUI.
void | grabTextures ()
| Grabs all the loaded textures from Texture RAM and stores them in a local data buffer. This function invalidates all textures, and restoreTextures must be called before any CEGUI rendering is done for predictable results.
void | restoreTextures ()
| Restores all the loaded textures from the local data buffers previously created by 'grabTextures'.
Size | getAdjustedTextureSize (const Size &sz) const
| Helper to return a valid texture size according to reported OpenGL capabilities.
void | setupRenderingBlendMode (const BlendMode mode, const bool force=false)
| set the render states for the specified BlendMode.
## Static Public Member Functions
static OpenGLRenderer & | bootstrapSystem (const TextureTargetType tt_type=TTT_AUTO)
| Convenience function that creates the required objects to initialise the CEGUI system.
static OpenGLRenderer & | bootstrapSystem (const Size &display_size, const TextureTargetType tt_type=TTT_AUTO)
| Convenience function that creates the required objects to initialise the CEGUI system.
static void | destroySystem ()
| Convenience function to cleanup the CEGUI system and related objects that were created by calling the bootstrapSystem function.
static OpenGLRenderer & | create (const TextureTargetType tt_type=TTT_AUTO)
| Create an OpenGLRenderer object.
static OpenGLRenderer & | create (const Size &display_size, const TextureTargetType tt_type=TTT_AUTO)
| Create an OpenGLRenderer object.
static void | destroy (OpenGLRenderer &renderer)
| Destroy an OpenGLRenderer object.
static float | getNextPOTSize (const float f)
| Utility function that will return f if it's a power of two, or the next power of two up from f if it's not.

## Detailed Description

Renderer class to interface with OpenGL.

## Member Enumeration Documentation

enum CEGUI::OpenGLRenderer::TextureTargetType

Enumeration of valid texture target types.

Enumerator:

  TTT_AUTO | Automatically choose the best type available.
  TTT_FBO | Use targets based on frame buffer objects if available, else none.
  TTT_PBUFFER | Use targets based on pbuffer support if available, else none.
  TTT_NONE | Disable texture targets.

## Member Function Documentation

static OpenGLRenderer& CEGUI::OpenGLRenderer::bootstrapSystem | ( | const TextureTargetType | tt_type = `TTT_AUTO` | ) | `[static]`

Convenience function that creates the required objects to initialise the CEGUI system.

The created Renderer will use the current OpenGL viewport as it's default surface size.

This will create and initialise the following objects for you:

- CEGUI::OpenGLRenderer
- CEGUI::DefaultResourceProvider
- CEGUI::System

Parameters:

  tt_type | Specifies one of the TextureTargetType enumerated values indicating the desired TextureTarget type to be used. Defaults to TTT_AUTO.

Returns:
  Reference to the CEGUI::OpenGLRenderer object that was created.

static OpenGLRenderer& CEGUI::OpenGLRenderer::bootstrapSystem | ( | const Size & | display_size,
|  | const TextureTargetType | tt_type = `TTT_AUTO`
| ) |  | `[static]`

Convenience function that creates the required objects to initialise the CEGUI system.

The created Renderer will use the current OpenGL viewport as it's default surface size.

This will create and initialise the following objects for you:

- CEGUI::OpenGLRenderer
- CEGUI::DefaultResourceProvider
- CEGUI::System

Parameters:

  display_size | Size object describing the initial display resolution.
  tt_type | Specifies one of the TextureTargetType enumerated values indicating the desired TextureTarget type to be used. Defaults to TTT_AUTO.

Returns:
  Reference to the CEGUI::OpenGLRenderer object that was created.

static OpenGLRenderer& CEGUI::OpenGLRenderer::create | ( | const TextureTargetType | tt_type = `TTT_AUTO` | ) | `[static]`

Create an OpenGLRenderer object.

Parameters:

  tt_type | Specifies one of the TextureTargetType enumerated values indicating the desired TextureTarget type to be used.

static OpenGLRenderer& CEGUI::OpenGLRenderer::create | ( | const Size & | display_size,
|  | const TextureTargetType | tt_type = `TTT_AUTO`
| ) |  | `[static]`

Create an OpenGLRenderer object.

Parameters:

  display_size | Size object describing the initial display resolution.
  tt_type | Specifies one of the TextureTargetType enumerated values indicating the desired TextureTarget type to be used.

GeometryBuffer& CEGUI::OpenGLRenderer::createGeometryBuffer | ( |  | ) | `[virtual]`

Create a new GeometryBuffer and return a reference to it. You should remove the GeometryBuffer from any RenderQueues and call destroyGeometryBuffer when you want to destroy the GeometryBuffer.

Returns:
  GeometryBuffer object.

Implements CEGUI::Renderer.

Texture& CEGUI::OpenGLRenderer::createTexture | ( | const Size & | size | ) | `[virtual]`

Create a Texture object with the given pixel dimensions as specified by size.

Parameters:

  size | Size object that describes the desired texture size.

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

Note:
  Due to possible limitations of the underlying hardware, API or engine, the final size of the texture may not match the requested size. You can check the ultimate sizes by querying the Texture object after creation.

Implements CEGUI::Renderer.

Texture& CEGUI::OpenGLRenderer::createTexture | ( |  | ) | `[virtual]`

Create a 'null' Texture object.

Returns:
  A newly created Texture object. The returned Texture object has no size or imagery associated with it.

Implements CEGUI::Renderer.

Texture& CEGUI::OpenGLRenderer::createTexture | ( | GLuint | tex,
|  | const Size & | sz
| ) |  |

Create a texture that uses an existing OpenGL texture with the specified size. Note that it is your responsibility to ensure that the OpenGL texture is valid and that the specified size is accurate.

Parameters:

  sz | Size object that describes the pixel size of the OpenGL texture identified by tex.

Returns:
  Texture object that wraps the OpenGL texture tex, and whose size is specified to be sz.

Texture& CEGUI::OpenGLRenderer::createTexture | ( | const String & | filename,
|  | const String & | resourceGroup
| ) |  | `[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 | String objet that specifies the resource group identifier to be passed to the resource provider when loading the texture file filename.

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

Note:
  Due to possible limitations of the underlying hardware, API or engine, the final size of the texture may not match the size of the loaded file. You can check the ultimate sizes by querying the Texture object after creation.

Implements CEGUI::Renderer.

TextureTarget* CEGUI::OpenGLRenderer::createTextureTarget | ( |  | ) | `[virtual]`

Create a TextureTarget that can be used to cache imagery; this is a RenderTarget that does not lose it's content from one frame to another.

If the renderer is unable to offer such a thing, 0 should be returned.

Returns:
  Pointer to a TextureTarget object that is suitable for caching imagery, or 0 if the renderer is unable to offer such a thing.

Implements CEGUI::Renderer.

static void CEGUI::OpenGLRenderer::destroy | ( | OpenGLRenderer & | renderer | ) | `[static]`

Destroy an OpenGLRenderer object.

Parameters:

  renderer | The OpenGLRenderer object to be destroyed.

void CEGUI::OpenGLRenderer::destroyGeometryBuffer | ( | const GeometryBuffer & | buffer | ) | `[virtual]`

Destroy a GeometryBuffer that was returned when calling the createGeometryBuffer function. Before destroying any GeometryBuffer you should ensure that it has been removed from any RenderQueue that was using it.

Parameters:

  buffer | The GeometryBuffer object to be destroyed.

Implements CEGUI::Renderer.

static void CEGUI::OpenGLRenderer::destroySystem | ( |  | ) | `[static]`

Convenience function to cleanup the CEGUI system and related objects that were created by calling the bootstrapSystem function.

This function will destroy the following objects for you:

- CEGUI::System
- CEGUI::DefaultResourceProvider
- CEGUI::OpenGLRenderer

Note:
  If you did not initialise CEGUI by calling the bootstrapSystem function, you should not call this, but rather delete any objects you created manually.

void CEGUI::OpenGLRenderer::destroyTexture | ( | Texture & | texture | ) | `[virtual]`

Destroy a Texture object that was previously created by calling the createTexture functions.

Parameters:

  texture | Texture object to be destroyed.

Implements CEGUI::Renderer.

void CEGUI::OpenGLRenderer::destroyTextureTarget | ( | TextureTarget * | target | ) | `[virtual]`

Function that cleans up TextureTarget objects created with the createTextureTarget function.

Parameters:

  target | A pointer to a TextureTarget object that was previously returned from a call to createTextureTarget.

Implements CEGUI::Renderer.

void CEGUI::OpenGLRenderer::enableExtraStateSettings | ( | bool | setting | ) |

Tells the renderer to initialise some extra states beyond what it directly needs itself for CEGUI.

This option is useful in cases where you've made changes to the default OpenGL state and do not want to save/restore those between CEGUI rendering calls. Note that this option will not deal with every possible state or extension - if you want a state added here, make a request and we'll consider it ;)

Size CEGUI::OpenGLRenderer::getAdjustedTextureSize | ( | const Size & | sz | ) | const

Helper to return a valid texture size according to reported OpenGL capabilities.

Parameters:

  sz | Size object containing input size.

Returns:
  Size object containing - possibly different - output size.

RenderingRoot& CEGUI::OpenGLRenderer::getDefaultRenderingRoot | ( |  | ) | `[virtual]`

Return the default rendering root for the renderer. The default rendering root is typically a RenderingRoot that targets the entire screen (or rendering window).

Returns:
  RenderingRoot object that is the default RenderingSurface provided by the Renderer.

Implements CEGUI::Renderer.

const Vector2& CEGUI::OpenGLRenderer::getDisplayDPI | ( |  | ) | const`[virtual]`

Return the resolution of the display or host window in dots per inch.

Returns:
  Vector2 object that describes the resolution of the display or host window in DPI.

Implements CEGUI::Renderer.

const Size& CEGUI::OpenGLRenderer::getDisplaySize | ( |  | ) | const`[virtual]`

Return the size of the display or host window in pixels.

Returns:
  Size object describing the pixel dimesntions of the current display or host window.

Implements CEGUI::Renderer.

const String& CEGUI::OpenGLRenderer::getIdentifierString | ( |  | ) | const`[virtual]`

Return identification string for the renderer module.

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

Implements CEGUI::Renderer.

uint CEGUI::OpenGLRenderer::getMaxTextureSize | ( |  | ) | const`[virtual]`

Return the pixel size of the maximum supported texture.

Returns:
  Size of the maximum supported texture in pixels.

Implements CEGUI::Renderer.

void CEGUI::OpenGLRenderer::setDisplaySize | ( | const Size & | size | ) | `[virtual]`

Set the size of the display or host window in pixels for this Renderer object.

This is intended to be called by the System as part of the notification process when display size changes are notified to it via the System::notifyDisplaySizeChanged function.

Note:
  The Renderer implementation should not use this function other than to perform internal state updates on the Renderer and related objects.

Parameters:

  size | Size object describing the dimesions of the current or host window in pixels.

Implements CEGUI::Renderer.