Crazy Eddie's GUI System  0.8.7
CEGUI::OpenGL3Renderer Class Reference

Renderer class to interface with desktop OpenGL version >= 3.2 or OpenGL ES version >= 2. More...

+ Inheritance diagram for CEGUI::OpenGL3Renderer:
+ Collaboration diagram for CEGUI::OpenGL3Renderer:

Public Member Functions

OpenGL3Shader *& getShaderStandard ()
 Helper to return the reference to the pointer to the standard shader of the Renderer. More...
 
GLint getShaderStandardPositionLoc ()
 Helper to return the attribute location of the position variable in the standard shader. More...
 
GLint getShaderStandardTexCoordLoc ()
 Helper to return the attribute location of the texture coordinate variable in the standard shader. More...
 
GLint getShaderStandardColourLoc ()
 Helper to return the attribute location of the colour variable in the standard shader. More...
 
GLint getShaderStandardMatrixUniformLoc ()
 Helper to return the uniform location of the matrix variable in the standard shader. More...
 
OpenGL3StateChangeWrappergetOpenGLStateChanger ()
 Helper to get the wrapper used to check for redundant OpenGL state changes. More...
 
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.
 
Sizef getAdjustedTextureSize (const Sizef &sz) const
 Helper to return a valid texture size according to reported OpenGL capabilities. More...
 
bool isS3TCSupported () const
 
void setupRenderingBlendMode (const BlendMode mode, const bool force=false)
 set the render states for the specified BlendMode.
 
- Public Member Functions inherited from CEGUI::OpenGLRendererBase
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 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 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. 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'.
 
virtual const mat4PimplgetViewProjectionMatrix ()
 Helper to return view projection matrix. More...
 
virtual void setViewProjectionMatrix (const mat4Pimpl *viewProjectionMatrix)
 Helper to set the view projection matrix. More...
 
const CEGUI::RectfgetActiveViewPort ()
 Helper to get the viewport. More...
 
void setActiveRenderTarget (RenderTarget *renderTarget)
 Helper to set the active render target. More...
 
RenderTargetgetActiveRenderTarget ()
 Helper to get the active render target. More...
 
bool isTexCoordSystemFlipped () const
 Returns if the texture coordinate system is vertically flipped or not. The original of a texture coordinate system is typically located either at the the top-left or the bottom-left. CEGUI, Direct3D and most rendering engines assume it to be on the top-left. OpenGL assumes it to be at the bottom left. More...
 
- Public Member Functions inherited from CEGUI::Renderer
virtual ~Renderer ()
 Destructor.
 

Static Public Member Functions

static OpenGL3RendererbootstrapSystem (const int abi=CEGUI_VERSION_ABI)
 Convenience function that creates the required objects to initialise the CEGUI system. More...
 
static OpenGL3RendererbootstrapSystem (const Sizef &display_size, 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 OpenGL3Renderercreate (const int abi=CEGUI_VERSION_ABI)
 Create an OpenGL3Renderer object. More...
 
static OpenGL3Renderercreate (const Sizef &display_size, const int abi=CEGUI_VERSION_ABI)
 Create an OpenGL3Renderer object. More...
 
static void destroy (OpenGL3Renderer &renderer)
 Destroy an OpenGL3Renderer object. More...
 
- Static Public Member Functions inherited from CEGUI::OpenGLRendererBase
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.
 

Protected Member Functions

virtual ~OpenGL3Renderer ()
 Destructor for OpenGL3Renderer objects.
 
- Protected Member Functions inherited from CEGUI::OpenGLRendererBase
 OpenGLRendererBase (const Sizef &display_size)
 Constructor. More...
 
 OpenGLRendererBase (bool set_glew_experimental)
 
 OpenGLRendererBase (const Sizef &display_size, bool set_glew_experimental)
 Constructor. More...
 
void init (bool init_glew=false, bool set_glew_experimental=false)
 
virtual ~OpenGLRendererBase ()
 Destructor!
 
void initialiseMaxTextureSize ()
 helper to set (rough) max texture size.
 
void initialiseDisplaySizeWithViewportSize ()
 helper to set display size with current viewport size.
 

Additional Inherited Members

- Protected Types inherited from CEGUI::OpenGLRendererBase
typedef std::vector< TextureTarget * > TextureTargetList
 container type used to hold TextureTargets we create.
 
typedef std::vector< OpenGLGeometryBufferBase * > GeometryBufferList
 container type used to hold GeometryBuffers created.
 
typedef std::map< String, OpenGLTexture *, StringFastLessCompare CEGUI_MAP_ALLOC(String, OpenGLTexture *)> TextureMap
 container type used to hold Textures we create.
 
- Static Protected Member Functions inherited from CEGUI::OpenGLRendererBase
static void logTextureCreation (const String &name)
 helper to safely log the creation of a named texture
 
static void logTextureDestruction (const String &name)
 helper to safely log the destruction of a named texture
 
- Protected Attributes inherited from CEGUI::OpenGLRendererBase
Sizef d_displaySize
 What the renderer considers to be the current display size.
 
Vector2f d_displayDPI
 What the renderer considers to be the current display DPI resolution.
 
RenderTargetd_defaultTarget
 The default RenderTarget.
 
TextureTargetList d_textureTargets
 Container used to track texture targets.
 
GeometryBufferList d_geometryBuffers
 Container used to track geometry buffers.
 
TextureMap d_textures
 Container used to track textures.
 
uint d_maxTextureSize
 What the renderer thinks the max texture size is.
 
bool d_initExtraStates
 option of whether to initialise extra states that may not be at default
 
BlendMode d_activeBlendMode
 What blend mode we think is active.
 
mat4Pimpld_viewProjectionMatrix
 View projection matrix.
 
RenderTargetd_activeRenderTarget
 The active RenderTarget.
 
- Static Protected Attributes inherited from CEGUI::OpenGLRendererBase
static String d_rendererID
 String holding the renderer identification text.
 

Detailed Description

Renderer class to interface with desktop OpenGL version >= 3.2 or OpenGL ES version >= 2.

Note: to use this renderer with OpenGL ES 2.0, the Epoxy OpenGL loading library (https://github.com/yaronct/libepoxy, major version 1) must first be installed, and CEGUI must be configured with "-DCEGUI_BUILD_RENDERER_OPENGL=OFF -DCEGUI_BUILD_RENDERER_OPENGL3=ON -DCEGUI_USE_EPOXY=ON -DCEGUI_USE_GLEW=OFF".

Note: Your OpenGL context must already be initialised when you call this; CEGUI will not create the OpenGL context itself. Nothing special has to be done to choose between desktop OpenGL and OpenGL ES: the type is automatically determined by the type of the current OpenGL context.

Member Function Documentation

static OpenGL3Renderer& CEGUI::OpenGL3Renderer::bootstrapSystem ( 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 viewport as it's default surface size.

This will create and initialise the following objects for you:

Parameters
abiThis must be set to CEGUI_VERSION_ABI
Returns
Reference to the CEGUI::OpenGL3Renderer object that was created.
static OpenGL3Renderer& CEGUI::OpenGL3Renderer::bootstrapSystem ( const Sizef display_size,
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 viewport as it's default surface size.

This will create and initialise the following objects for you:

Parameters
display_sizeSize object describing the initial display resolution.
abiThis must be set to CEGUI_VERSION_ABI
Returns
Reference to the CEGUI::OpenGL3Renderer object that was created.
static OpenGL3Renderer& CEGUI::OpenGL3Renderer::create ( const int  abi = CEGUI_VERSION_ABI)
static

Create an OpenGL3Renderer 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 OpenGL3Renderer& CEGUI::OpenGL3Renderer::create ( const Sizef display_size,
const int  abi = CEGUI_VERSION_ABI 
)
static

Create an OpenGL3Renderer 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
static void CEGUI::OpenGL3Renderer::destroy ( OpenGL3Renderer renderer)
static

Destroy an OpenGL3Renderer object.

Parameters
rendererThe OpenGL3Renderer object to be destroyed.
static void CEGUI::OpenGL3Renderer::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:

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.
Sizef CEGUI::OpenGL3Renderer::getAdjustedTextureSize ( const Sizef sz) const
virtual

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

Parameters
szSize object containing input size.
Returns
Size object containing - possibly different - output size.

Reimplemented from CEGUI::OpenGLRendererBase.

OpenGL3StateChangeWrapper* CEGUI::OpenGL3Renderer::getOpenGLStateChanger ( )

Helper to get the wrapper used to check for redundant OpenGL state changes.

Returns
The active OpenGL state change wrapper object.
OpenGL3Shader*& CEGUI::OpenGL3Renderer::getShaderStandard ( )

Helper to return the reference to the pointer to the standard shader of the Renderer.

Returns
Reference to the pointer to the standard shader of the Renderer
GLint CEGUI::OpenGL3Renderer::getShaderStandardColourLoc ( )

Helper to return the attribute location of the colour variable in the standard shader.

Returns
Attribute location of the colour variable in the standard shader
GLint CEGUI::OpenGL3Renderer::getShaderStandardMatrixUniformLoc ( )

Helper to return the uniform location of the matrix variable in the standard shader.

Returns
Uniform location of the matrix variable in the standard shader
GLint CEGUI::OpenGL3Renderer::getShaderStandardPositionLoc ( )

Helper to return the attribute location of the position variable in the standard shader.

Returns
Attribute location of the position variable in the standard shader
GLint CEGUI::OpenGL3Renderer::getShaderStandardTexCoordLoc ( )

Helper to return the attribute location of the texture coordinate variable in the standard shader.

Returns
Attribute location of the texture coordinate variable in the standard shader
bool CEGUI::OpenGL3Renderer::isS3TCSupported ( ) const
virtual
Deprecated:
  • the OpenGL Info class should be used in the future for this purpose

Implements CEGUI::OpenGLRendererBase.