Cafu Engine
OpenGLStateT Class Reference

This class encapsulates the OpenGL state, with the intention of minimizing actual OpenGL state changes. More...

#include "OpenGLState.hpp"

Public Types

enum  MatrixModeT { MODELVIEW, PROJECTION, TEXTURE, MATRIX0 }
 

Public Member Functions

void Reset ()
 
void ActiveTextureUnit (GLenum texUnit)
 
void AlphaFunc (GLenum func, GLclampf ref)
 
void BlendFunc (GLenum sfactor, GLenum dfactor)
 
void DepthFunc (GLenum func)
 
void ActiveStencilFace (GLenum mode)
 
void StencilFunc (GLenum func, GLint ref, GLuint mask)
 
void StencilOp (GLenum fail, GLenum zfail, GLenum zpass)
 
void ColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
 
void DepthMask (GLboolean flag)
 
void CullFace (GLenum mode)
 
void FrontFace (GLenum mode)
 
void PolygonMode (GLenum mode)
 
void PolygonOffset (GLfloat factor, GLfloat units)
 
void Enable (GLenum cap)
 
void Disable (GLenum cap)
 
void LoadMatrix (MatrixModeT MatrixMode, const DepRelMatrixT &Matrix)
 This method loads a matrix. More...
 
void BindTexture (GLenum target, GLuint texture)
 
void TexEnv (GLenum target, GLenum pname, GLint param)
 
void TexEnv (GLenum target, GLenum pname, GLfloat param)
 
void TexEnv (GLenum target, GLenum pname, GLint *param)
 
void TexEnv (GLenum target, GLenum pname, GLfloat *param)
 

Static Public Member Functions

static OpenGLStateTGetInstance ()
 

Static Public Attributes

static const GLenum MeshToOpenGLType [] ={ GL_POINTS, GL_LINES, GL_LINE_STRIP, GL_LINE_LOOP, GL_TRIANGLES, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_QUADS, GL_QUAD_STRIP, GL_POLYGON }
 Translates from MeshT primitive types to OpenGL rendering primitives. More...
 
static const GLenum WindingToOpenGL [] ={ GL_CW, GL_CCW }
 Translates from MeshT windings to OpenGL windings (cw or ccw). More...
 
static const GLenum BlendFactorToOpenGL [] ={ GL_ZERO, GL_ZERO, GL_ONE, GL_DST_COLOR, GL_SRC_COLOR, GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_DST_ALPHA, GL_SRC_ALPHA, GL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA }
 Translates from MaterialT blend factors to OpenGL blend factors. More...
 
static const GLenum PolygonModeToOpenGL [] ={ GL_FILL, GL_LINE, GL_POINT }
 Translates from MaterialT::PolygonModeT to OpenGL polygon modes. More...
 
static const GLenum PolygonModeToOpenGL_Offset [] ={ GL_POLYGON_OFFSET_FILL, GL_POLYGON_OFFSET_LINE, GL_POLYGON_OFFSET_POINT }
 Translates from MaterialT::PolygonModeT to OpenGL depth offset polygon modes. More...
 
static const GLenum MatrixModeToOpenGL [] ={ GL_MODELVIEW, GL_PROJECTION, GL_TEXTURE, GL_MATRIX0_ARB }
 Translates from our MatrixModeT modes to OpenGL matrix modes. More...
 

Detailed Description

This class encapsulates the OpenGL state, with the intention of minimizing actual OpenGL state changes.

Member Function Documentation

void OpenGLStateT::LoadMatrix ( MatrixModeT  MatrixMode,
const DepRelMatrixT Matrix 
)

This method loads a matrix.

Parameters
MatrixModeThe matrix mode for which the matrix should be loaded (MODELVIEW, PROJECTION, TEXTURE, MATRIX0, ...).
MatrixThe matrix that is to be loaded. The matrix must be up-to-date already, i.e. Matrix.Update() must have been called by the caller! Note that individual matrices are discriminated by their ID(!), not by their actual content value. Also, the age of a matrix should increase whenever the matrix is modified.

Member Data Documentation

const GLenum OpenGLStateT::BlendFactorToOpenGL ={ GL_ZERO, GL_ZERO, GL_ONE, GL_DST_COLOR, GL_SRC_COLOR, GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_DST_ALPHA, GL_SRC_ALPHA, GL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA }
static

Translates from MaterialT blend factors to OpenGL blend factors.

const GLenum OpenGLStateT::MatrixModeToOpenGL ={ GL_MODELVIEW, GL_PROJECTION, GL_TEXTURE, GL_MATRIX0_ARB }
static

Translates from our MatrixModeT modes to OpenGL matrix modes.

const GLenum OpenGLStateT::MeshToOpenGLType ={ GL_POINTS, GL_LINES, GL_LINE_STRIP, GL_LINE_LOOP, GL_TRIANGLES, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_QUADS, GL_QUAD_STRIP, GL_POLYGON }
static

Translates from MeshT primitive types to OpenGL rendering primitives.

const GLenum OpenGLStateT::PolygonModeToOpenGL ={ GL_FILL, GL_LINE, GL_POINT }
static

Translates from MaterialT::PolygonModeT to OpenGL polygon modes.

const GLenum OpenGLStateT::PolygonModeToOpenGL_Offset ={ GL_POLYGON_OFFSET_FILL, GL_POLYGON_OFFSET_LINE, GL_POLYGON_OFFSET_POINT }
static

Translates from MaterialT::PolygonModeT to OpenGL depth offset polygon modes.

const GLenum OpenGLStateT::WindingToOpenGL ={ GL_CW, GL_CCW }
static

Translates from MeshT windings to OpenGL windings (cw or ccw).


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