Crazy Eddie's GUI System  0.8.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
CEGUI::OpenGLESRenderer Class Reference

Renderer class to interface with OpenGLES. More...

+ Inheritance diagram for CEGUI::OpenGLESRenderer:
+ Collaboration diagram for CEGUI::OpenGLESRenderer:

Public Types

enum  TextureTargetType { TTT_AUTO, TTT_FBO, TTT_PBUFFER, TTT_NONE }
 Enumeration of valid texture target types. More...
 

Public Member Functions

RenderTargetgetDefaultRenderTarget ()
 Returns the default RenderTarget object. The default render target is is typically one that targets the entire screen (or rendering window). More...
 
GeometryBuffercreateGeometryBuffer ()
 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. More...
 
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. More...
 
void destroyAllGeometryBuffers ()
 Destroy all GeometryBuffer objects created by this Renderer.
 
TextureTargetcreateTextureTarget ()
 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. More...
 
void destroyTextureTarget (TextureTarget *target)
 Function that cleans up TextureTarget objects created with the createTextureTarget function. More...
 
void destroyAllTextureTargets ()
 Destory all TextureTarget objects created by this Renderer.
 
TexturecreateTexture (const String &name)
 Create a 'null' Texture object. More...
 
TexturecreateTexture (const String &name, const String &filename, const String &resourceGroup)
 Create a Texture object using the given image file. More...
 
TexturecreateTexture (const String &name, const Sizef &size)
 Create a Texture object with the given pixel dimensions as specified by size. More...
 
void destroyTexture (Texture &texture)
 Destroy a Texture object that was previously created by calling the createTexture functions. More...
 
void destroyTexture (const String &name)
 Destroy a Texture object that was previously created by calling the createTexture functions. More...
 
void destroyAllTextures ()
 Destroy all Texture objects created by this Renderer.
 
TexturegetTexture (const String &name) const
 Return a Texture object that was previously created by calling the createTexture functions. More...
 
bool isTextureDefined (const String &name) const
 Return whether a texture with the given name exists.
 
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 Sizef &sz)
 Set the size of the display or host window in pixels for this Renderer object. More...
 
const SizefgetDisplaySize () const
 Return the size of the display or host window in pixels. More...
 
const Vector2fgetDisplayDPI () const
 Return the resolution of the display or host window in dots per inch. More...
 
uint getMaxTextureSize () const
 Return the pixel size of the maximum supported texture. More...
 
const StringgetIdentifierString () const
 Return identification string for the renderer module. More...
 
TexturecreateTexture (const String &name, GLuint tex, const Sizef &sz)
 Create a texture that uses an existing OpenGLES texture with the specified size. Note that it is your responsibility to ensure that the OpenGLES texture is valid and that the specified size is accurate. More...
 
void enableExtraStateSettings (bool setting)
 Tells the renderer to initialise some extra states beyond what it directly needs itself for CEGUI. More...
 
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'.
 
Sizef getAdjustedTextureSize (const Sizef &sz) const
 Helper to return a valid texture size according to reported OpenGLES capabilities. More...
 
- Public Member Functions inherited from CEGUI::Renderer
virtual ~Renderer ()
 Destructor.
 

Static Public Member Functions

static OpenGLESRendererbootstrapSystem (const TextureTargetType tt_type=TTT_AUTO, const int abi=CEGUI_VERSION_ABI)
 Convenience function that creates the required objects to initialise the CEGUI system. More...
 
static OpenGLESRendererbootstrapSystem (const Sizef &display_size, const TextureTargetType tt_type=TTT_AUTO, const int abi=CEGUI_VERSION_ABI)
 Convenience function that creates the required objects to initialise the CEGUI system. More...
 
static void destroySystem ()
 Convenience function to cleanup the CEGUI system and related objects that were created by calling the bootstrapSystem function. More...
 
static OpenGLESRenderercreate (const TextureTargetType tt_type=TTT_AUTO, const int abi=CEGUI_VERSION_ABI)
 Create an OpenGLESRenderer object. More...
 
static OpenGLESRenderercreate (const Sizef &display_size, const TextureTargetType tt_type=TTT_AUTO, const int abi=CEGUI_VERSION_ABI)
 Create an OpenGLESRenderer object. More...
 
static void destroy (OpenGLESRenderer &renderer)
 Destroy an OpenGLESRenderer object. More...
 
static bool isGLExtensionSupported (const char *extension)
 Check if provided extension is supported on current platform. Khronos reference implementation. More...
 
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 OpenGLES.

Member Enumeration Documentation

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 OpenGLESRenderer& CEGUI::OpenGLESRenderer::bootstrapSystem ( const TextureTargetType  tt_type = TTT_AUTO,
const int  abi = CEGUI_VERSION_ABI 
)
static

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

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

This will create and initialise the following objects for you:
- CEGUI::OpenGLESRenderer
- CEGUI::DefaultResourceProvider
- CEGUI::System
Parameters
tt_typeSpecifies one of the TextureTargetType enumerated values indicating the desired TextureTarget type to be used. Defaults to TTT_AUTO.
abiThis must be set to CEGUI_VERSION_ABI
Returns
Reference to the CEGUI::OpenGLESRenderer object that was created.
static OpenGLESRenderer& CEGUI::OpenGLESRenderer::bootstrapSystem ( const Sizef display_size,
const TextureTargetType  tt_type = TTT_AUTO,
const int  abi = CEGUI_VERSION_ABI 
)
static

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

The created Renderer will use /a display_size as the default surface
size.

This will create and initialise the following objects for you:
- CEGUI::OpenGLESRenderer
- CEGUI::DefaultResourceProvider
- CEGUI::System
Parameters
display_sizeSize object describing the initial display dimensions.
tt_typeSpecifies one of the TextureTargetType enumerated values indicating the desired TextureTarget type to be used. Defaults to TTT_AUTO.
abiThis must be set to CEGUI_VERSION_ABI
Returns
Reference to the CEGUI::OpenGLESRenderer object that was created.
static OpenGLESRenderer& CEGUI::OpenGLESRenderer::create ( const TextureTargetType  tt_type = TTT_AUTO,
const int  abi = CEGUI_VERSION_ABI 
)
static

Create an OpenGLESRenderer object.

Parameters
tt_typeSpecifies one of the TextureTargetType enumerated values indicating the desired TextureTarget type to be used.
abiThis must be set to CEGUI_VERSION_ABI
static OpenGLESRenderer& CEGUI::OpenGLESRenderer::create ( const Sizef display_size,
const TextureTargetType  tt_type = TTT_AUTO,
const int  abi = CEGUI_VERSION_ABI 
)
static

Create an OpenGLESRenderer object.

Parameters
display_sizeSize object describing the initial display resolution.
tt_typeSpecifies one of the TextureTargetType enumerated values indicating the desired TextureTarget type to be used.
abiThis must be set to CEGUI_VERSION_ABI
GeometryBuffer& CEGUI::OpenGLESRenderer::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::OpenGLESRenderer::createTexture ( const String name)
virtual

Create a 'null' Texture object.

Parameters
nameString holding the name for the new texture. Texture names must be unique within the Renderer.
Returns
A newly created Texture object. The returned Texture object has no size or imagery associated with it.

Implements CEGUI::Renderer.

Texture& CEGUI::OpenGLESRenderer::createTexture ( const String name,
const String filename,
const String resourceGroup 
)
virtual

Create a Texture object using the given image file.

Parameters
nameString holding the name for the new texture. Texture names must be unique within the Renderer.
filenameString object that specifies the path and filename of the image file to use when creating the texture.
resourceGroupString 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.

Texture& CEGUI::OpenGLESRenderer::createTexture ( const String name,
const Sizef size 
)
virtual

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

Parameters
nameString holding the name for the new texture. Texture names must be unique within the Renderer.
sizeSize 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::OpenGLESRenderer::createTexture ( const String name,
GLuint  tex,
const Sizef sz 
)

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

Parameters
szSize object that describes the pixel size of the OpenGLES texture identified by tex.
Returns
Texture object that wraps the OpenGLES texture tex, and whose size is specified to be sz.
TextureTarget* CEGUI::OpenGLESRenderer::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::OpenGLESRenderer::destroy ( OpenGLESRenderer renderer)
static

Destroy an OpenGLESRenderer object.

Parameters
rendererThe OpenGLESRenderer object to be destroyed.
void CEGUI::OpenGLESRenderer::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
bufferThe GeometryBuffer object to be destroyed.

Implements CEGUI::Renderer.

static void CEGUI::OpenGLESRenderer::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::OpenGLESRenderer::destroyTexture ( Texture texture)
virtual

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

Parameters
textureTexture object to be destroyed.

Implements CEGUI::Renderer.

void CEGUI::OpenGLESRenderer::destroyTexture ( const String name)
virtual

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

Parameters
nameString holding the name of the texture to destroy.

Implements CEGUI::Renderer.

void CEGUI::OpenGLESRenderer::destroyTextureTarget ( TextureTarget target)
virtual

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

Parameters
targetA pointer to a TextureTarget object that was previously returned from a call to createTextureTarget.

Implements CEGUI::Renderer.

void CEGUI::OpenGLESRenderer::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 OpenGLES 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 ;)

Sizef CEGUI::OpenGLESRenderer::getAdjustedTextureSize ( const Sizef sz) const

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

Parameters
szSize object containing input size.
Returns
Size object containing - possibly different - output size.
RenderTarget& CEGUI::OpenGLESRenderer::getDefaultRenderTarget ( )
virtual

Returns the default RenderTarget object. The default render target is is typically one that targets the entire screen (or rendering window).

Returns
Reference to a RenderTarget object.

Implements CEGUI::Renderer.

const Vector2f& CEGUI::OpenGLESRenderer::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 Sizef& CEGUI::OpenGLESRenderer::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::OpenGLESRenderer::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::OpenGLESRenderer::getMaxTextureSize ( ) const
virtual

Return the pixel size of the maximum supported texture.

Returns
Size of the maximum supported texture in pixels.

Implements CEGUI::Renderer.

Texture& CEGUI::OpenGLESRenderer::getTexture ( const String name) const
virtual

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

Parameters
nameString holding the name of the Texture object to be returned.

Implements CEGUI::Renderer.

static bool CEGUI::OpenGLESRenderer::isGLExtensionSupported ( const char *  extension)
static

Check if provided extension is supported on current platform. Khronos reference implementation.

Parameters
extensionProvided extension string identification
void CEGUI::OpenGLESRenderer::setDisplaySize ( const Sizef 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
sizeSize object describing the dimesions of the current or host window in pixels.

Implements CEGUI::Renderer.