OGRE  1.10.5
Object-Oriented Graphics Rendering Engine
Ogre::GLES2StateCacheManager Class Reference

An in memory cache of the OpenGL ES state. More...

#include <OgreGLES2StateCacheManager.h>

+ Inheritance diagram for Ogre::GLES2StateCacheManager:

Public Member Functions

 GLES2StateCacheManager (void)
 
 ~GLES2StateCacheManager (void)
 
bool activateGLTextureUnit (unsigned char unit)
 Activate an OpenGL texture unit. More...
 
void bindGLBuffer (GLenum target, GLuint buffer, bool force=false)
 Bind an OpenGL buffer of any type. More...
 
void bindGLTexture (GLenum target, GLuint texture)
 Bind an OpenGL texture of any type. More...
 
void clearCache ()
 Clears all cached values. More...
 
void deleteGLBuffer (GLenum target, GLuint buffer, bool force=false)
 Delete an OpenGL buffer of any type. More...
 
GLenum getBlendEquation (void) const
 Gets the current blend equation setting. More...
 
GLclampf getClearDepth (void) const
 Gets the clear depth in the range from [0..1]. More...
 
vector< GLboolean >::type & getColourMask (void)
 Gets the current colour mask setting. More...
 
GLenum getCullFace (void) const
 Sets the face culling mode. More...
 
GLenum getDepthFunc (void) const
 Gets the current depth test function. More...
 
GLboolean getDepthMask (void) const
 Gets the current depth mask setting. More...
 
unsigned int getDiscardBuffers (void) const
 Gets the mask of buffers to be discarded if GL_EXT_discard_framebuffer is supported. More...
 
GLenum getPolygonMode (void) const
 Gets the current polygon rendering mode, fill, wireframe, points, etc. More...
 
GLuint getStencilMask (void) const
 Gets the current stencil mask. More...
 
void getTexParameterfv (GLenum target, GLenum pname, GLfloat *param)
 Sets a float parameter value per texture target. More...
 
void initializeCache ()
 Initialize our cache variables and sets the GL states on the current context. More...
 
void invalidateStateForTexture (GLuint texture)
 Invalidates the state associated with a particular texture ID. More...
 
void setBlendEquation (GLenum eq)
 Sets the current blend equation setting. More...
 
void setBlendFunc (GLenum source, GLenum dest)
 Sets the blending function. More...
 
void setClearColour (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
 Sets the color to clear to. More...
 
void setClearDepth (GLclampf depth)
 Sets the clear depth in the range from [0..1]. More...
 
void setColourMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
 Sets the current colour mask. More...
 
void setCullFace (GLenum face)
 Sets the face culling setting. More...
 
void setDepthFunc (GLenum func)
 Sets the current depth test function. More...
 
void setDepthMask (GLboolean mask)
 Sets the current depth mask setting. More...
 
void setDisabled (GLenum flag)
 Disables a piece of OpenGL functionality. More...
 
void setDiscardBuffers (unsigned int flags)
 Sets the mask of buffers to be discarded if GL_EXT_discard_framebuffer is supported. More...
 
void setEnabled (GLenum flag)
 Enables a piece of OpenGL functionality. More...
 
void setPolygonMode (GLenum mode)
 Sets the current polygon rendering mode. More...
 
void setStencilMask (GLuint mask)
 Sets the stencil mask. More...
 
void setTexParameterf (GLenum target, GLenum pname, GLfloat param)
 Sets a float parameter value per texture target. More...
 
void setTexParameteri (GLenum target, GLenum pname, GLint param)
 Sets an integer parameter value per texture target. More...
 
void setVertexAttribDisabled (GLuint attrib)
 Disables a vertex attribute. More...
 
void setVertexAttribEnabled (GLuint attrib)
 Enables a vertex attribute. More...
 

Detailed Description

An in memory cache of the OpenGL ES state.

Remarks
State changes can be particularly expensive time wise. This is because a change requires OpenGL to re-evaluate and update the state machine. Because of the general purpose nature of OGRE we often set the state for a specific texture, material, buffer, etc. But this may be the same as the current status of the state machine and is therefore redundant and causes unnecessary work to be performed by OpenGL.
Instead we are caching the state so that we can check whether it actually does need to be updated. This leads to improved performance all around and can be somewhat dramatic in some cases.

Constructor & Destructor Documentation

◆ GLES2StateCacheManager()

Ogre::GLES2StateCacheManager::GLES2StateCacheManager ( void  )

◆ ~GLES2StateCacheManager()

Ogre::GLES2StateCacheManager::~GLES2StateCacheManager ( void  )

Member Function Documentation

◆ initializeCache()

void Ogre::GLES2StateCacheManager::initializeCache ( )

Initialize our cache variables and sets the GL states on the current context.

◆ clearCache()

void Ogre::GLES2StateCacheManager::clearCache ( )

Clears all cached values.

◆ bindGLBuffer()

void Ogre::GLES2StateCacheManager::bindGLBuffer ( GLenum  target,
GLuint  buffer,
bool  force = false 
)

Bind an OpenGL buffer of any type.

Parameters
targetThe buffer target.
bufferThe buffer ID.
forceOptional parameter to force an update.

◆ deleteGLBuffer()

void Ogre::GLES2StateCacheManager::deleteGLBuffer ( GLenum  target,
GLuint  buffer,
bool  force = false 
)

Delete an OpenGL buffer of any type.

Parameters
targetThe buffer target.
bufferThe buffer ID.
forceOptional parameter to force an update.

◆ bindGLTexture()

void Ogre::GLES2StateCacheManager::bindGLTexture ( GLenum  target,
GLuint  texture 
)

Bind an OpenGL texture of any type.

Parameters
targetThe texture target.
textureThe texture ID.

◆ invalidateStateForTexture()

void Ogre::GLES2StateCacheManager::invalidateStateForTexture ( GLuint  texture)

Invalidates the state associated with a particular texture ID.

Parameters
textureThe texture ID.

◆ setTexParameteri()

void Ogre::GLES2StateCacheManager::setTexParameteri ( GLenum  target,
GLenum  pname,
GLint  param 
)

Sets an integer parameter value per texture target.

Parameters
targetThe texture target.
pnameThe parameter name.
paramThe parameter value.

◆ setTexParameterf()

void Ogre::GLES2StateCacheManager::setTexParameterf ( GLenum  target,
GLenum  pname,
GLfloat  param 
)

Sets a float parameter value per texture target.

Parameters
targetThe texture target.
pnameThe parameter name.
paramThe parameter value.

◆ getTexParameterfv()

void Ogre::GLES2StateCacheManager::getTexParameterfv ( GLenum  target,
GLenum  pname,
GLfloat *  param 
)

Sets a float parameter value per texture target.

Parameters
targetThe texture target.
pnameThe parameter name.
paramThe parameter value.

◆ activateGLTextureUnit()

bool Ogre::GLES2StateCacheManager::activateGLTextureUnit ( unsigned char  unit)

Activate an OpenGL texture unit.

Parameters
unitThe texture unit to activate.
Returns
Whether or not the texture unit was successfully activated.

◆ getBlendEquation()

GLenum Ogre::GLES2StateCacheManager::getBlendEquation ( void  ) const
inline

Gets the current blend equation setting.

Returns
The blend equation.

◆ setBlendEquation()

void Ogre::GLES2StateCacheManager::setBlendEquation ( GLenum  eq)

Sets the current blend equation setting.

Parameters
eqThe blend equation to use.

◆ setBlendFunc()

void Ogre::GLES2StateCacheManager::setBlendFunc ( GLenum  source,
GLenum  dest 
)

Sets the blending function.

Parameters
sourceThe blend mode for the source.
destThe blend mode for the destination

◆ getDepthMask()

GLboolean Ogre::GLES2StateCacheManager::getDepthMask ( void  ) const
inline

Gets the current depth mask setting.

Returns
The current depth mask.

◆ setDepthMask()

void Ogre::GLES2StateCacheManager::setDepthMask ( GLboolean  mask)

Sets the current depth mask setting.

Parameters
maskThe depth mask to use.

◆ getDepthFunc()

GLenum Ogre::GLES2StateCacheManager::getDepthFunc ( void  ) const
inline

Gets the current depth test function.

Returns
The current depth test function.

◆ setDepthFunc()

void Ogre::GLES2StateCacheManager::setDepthFunc ( GLenum  func)

Sets the current depth test function.

Parameters
funcThe depth test function to use.

◆ getClearDepth()

GLclampf Ogre::GLES2StateCacheManager::getClearDepth ( void  ) const
inline

Gets the clear depth in the range from [0..1].

Returns
The current clearing depth.

◆ setClearDepth()

void Ogre::GLES2StateCacheManager::setClearDepth ( GLclampf  depth)

Sets the clear depth in the range from [0..1].

Parameters
depthThe clear depth to use.

◆ setClearColour()

void Ogre::GLES2StateCacheManager::setClearColour ( GLclampf  red,
GLclampf  green,
GLclampf  blue,
GLclampf  alpha 
)

Sets the color to clear to.

Parameters
redThe red component.
greenThe green component.
blueThe blue component.
alphaThe alpha component.

◆ getColourMask()

vector<GLboolean>::type& Ogre::GLES2StateCacheManager::getColourMask ( void  )
inline

Gets the current colour mask setting.

Returns
An array containing the mask in RGBA order.

◆ setColourMask()

void Ogre::GLES2StateCacheManager::setColourMask ( GLboolean  red,
GLboolean  green,
GLboolean  blue,
GLboolean  alpha 
)

Sets the current colour mask.

Parameters
redThe red component.
greenThe green component.
blueThe blue component.
alphaThe alpha component.

◆ getStencilMask()

GLuint Ogre::GLES2StateCacheManager::getStencilMask ( void  ) const
inline

Gets the current stencil mask.

Returns
The stencil mask.

◆ setStencilMask()

void Ogre::GLES2StateCacheManager::setStencilMask ( GLuint  mask)

Sets the stencil mask.

Parameters
maskThe stencil mask to use

◆ setEnabled()

void Ogre::GLES2StateCacheManager::setEnabled ( GLenum  flag)

Enables a piece of OpenGL functionality.

Parameters
flagThe function to enable.

◆ setDisabled()

void Ogre::GLES2StateCacheManager::setDisabled ( GLenum  flag)

Disables a piece of OpenGL functionality.

Parameters
flagThe function to disable.

◆ setVertexAttribEnabled()

void Ogre::GLES2StateCacheManager::setVertexAttribEnabled ( GLuint  attrib)

Enables a vertex attribute.

Parameters
attribThe attribute to enable.

◆ setVertexAttribDisabled()

void Ogre::GLES2StateCacheManager::setVertexAttribDisabled ( GLuint  attrib)

Disables a vertex attribute.

Parameters
attribThe attribute to disable.

◆ getDiscardBuffers()

unsigned int Ogre::GLES2StateCacheManager::getDiscardBuffers ( void  ) const
inline

Gets the mask of buffers to be discarded if GL_EXT_discard_framebuffer is supported.

Returns
The buffer mask.

◆ setDiscardBuffers()

void Ogre::GLES2StateCacheManager::setDiscardBuffers ( unsigned int  flags)
inline

Sets the mask of buffers to be discarded if GL_EXT_discard_framebuffer is supported.

Parameters
flagsThe bit mask of buffers to be discarded. Stored as Ogre::FrameBufferType.

◆ getPolygonMode()

GLenum Ogre::GLES2StateCacheManager::getPolygonMode ( void  ) const
inline

Gets the current polygon rendering mode, fill, wireframe, points, etc.

Returns
The current polygon rendering mode.

◆ setPolygonMode()

void Ogre::GLES2StateCacheManager::setPolygonMode ( GLenum  mode)
inline

Sets the current polygon rendering mode.

Parameters
modeThe polygon mode to use.

◆ getCullFace()

GLenum Ogre::GLES2StateCacheManager::getCullFace ( void  ) const
inline

Sets the face culling mode.

Returns
The current face culling mode

◆ setCullFace()

void Ogre::GLES2StateCacheManager::setCullFace ( GLenum  face)

Sets the face culling setting.

Parameters
faceThe face culling mode to use.

The documentation for this class was generated from the following file: