GLC_Context Class Reference

GLC_Context : Encapsulates OpenGL rendering context. More...

#include <glc_context.h>

List of all members.

Public Member Functions

Constructor / Destructor

 GLC_Context (const QGLFormat &format)
virtual ~GLC_Context ()
OpenGL Functions

void glcMatrixMode (GLenum mode)
 Set the matrix mode.
void glcLoadIdentity ()
 Replace the current matrix with the identity.
void glcPushMatrix ()
 push and pop the current matrix stack
void glcPopMatrix ()
void glcLoadMatrix (const GLC_Matrix4x4 &matrix)
 Replace the current matrix with the specified matrix.
void glcMultMatrix (const GLC_Matrix4x4 &matrix)
 Multiply the current matrix with the specified matrix.
void glcTranslated (double x, double y, double z)
 Multiply the current matrix by a translation matrix.
void glcScaled (double x, double y, double z)
 Multiply the current matrix by a general scaling matrix.
void glcOrtho (double left, double right, double bottom, double top, double nearVal, double farVal)
 Multiply the current matrix with an orthographic matrix.
void glcFrustum (double left, double right, double bottom, double top, double nearVal, double farVal)
 Multiply the current matrix by a perspective matrix.
void glcEnableLighting (bool enable)
 Enable lighting.
Set Functions

virtual void makeCurrent ()
 Make this context the current one.
virtual void doneCurrent ()
 Make no context to be the current one.
void updateUniformVariables ()
 Update uniform variable.

Private Attributes

GLenum m_CurrentMatrixMode
 The current matrix mode.
QHash< GLenum, QStack
< GLC_Matrix4x4 > * > 
m_MatrixStackHash
 Mapping between matrixMode and matrix stack.
QSharedPointer
< GLC_ContextSharedData
m_ContextSharedData
 The context shared data.
GLC_UniformShaderData m_UniformShaderData
 The uniform data of the current shader.
QStack< bool > m_LightingIsEnable
 Enable lighting state.
QHash< GLenum, bool > m_LightsEnableState
 Lights enable state.

Static Private Attributes

static GLC_Contextm_pCurrentContext = NULL
 The current context.

Get Functions



GLC_Matrix4x4 modelViewMatrix () const
 Return the model view matrix.
GLC_Matrix4x4 projectionMatrix () const
 Return the projection matrix.
bool lightingIsEnable () const
 Return lighting enable state.
static GLC_Contextcurrent ()
 Return the current context.

Private services Functions



virtual bool chooseContext (const QGLContext *shareContext=0)
void init ()
 Init this context state.

Detailed Description

GLC_Context : Encapsulates OpenGL rendering context.

The GLC_Context class store all GLC state associated to an OpenGL rendering context. This class is also used to simplified OpenGL and OpenGL-ES interoperability

Definition at line 59 of file glc_context.h.


Constructor & Destructor Documentation

GLC_Context::GLC_Context ( const QGLFormat &  format  ) 
GLC_Context::~GLC_Context (  )  [virtual]

Member Function Documentation

bool GLC_Context::chooseContext ( const QGLContext *  shareContext = 0  )  [protected, virtual]

Definition at line 252 of file glc_context.cpp.

References m_ContextSharedData.

GLC_Context * GLC_Context::current (  )  [static]
void GLC_Context::doneCurrent (  )  [virtual]

Make no context to be the current one.

Definition at line 245 of file glc_context.cpp.

References GLC_ContextManager::instance(), m_pCurrentContext, and GLC_ContextManager::setCurrent().

void GLC_Context::glcEnableLighting ( bool  enable  ) 
void GLC_Context::glcFrustum ( double  left,
double  right,
double  bottom,
double  top,
double  nearVal,
double  farVal 
)

Multiply the current matrix by a perspective matrix.

Definition at line 187 of file glc_context.cpp.

References glcMultMatrix(), and GLC_Matrix4x4::setData().

Referenced by GLC_Viewport::updateProjectionMat().

void GLC_Context::glcLoadIdentity (  ) 
void GLC_Context::glcLoadMatrix ( const GLC_Matrix4x4 matrix  ) 
void GLC_Context::glcMatrixMode ( GLenum  mode  ) 
void GLC_Context::glcMultMatrix ( const GLC_Matrix4x4 matrix  ) 
void GLC_Context::glcOrtho ( double  left,
double  right,
double  bottom,
double  top,
double  nearVal,
double  farVal 
)

Multiply the current matrix with an orthographic matrix.

Definition at line 169 of file glc_context.cpp.

References glcMultMatrix(), and GLC_Matrix4x4::setData().

Referenced by GLC_RepTrackBallMover::glDraw(), GLC_RepFlyMover::glDraw(), GLC_ImagePlane::render(), and GLC_Viewport::updateProjectionMat().

void GLC_Context::glcPopMatrix (  ) 
void GLC_Context::glcPushMatrix (  ) 
void GLC_Context::glcScaled ( double  x,
double  y,
double  z 
)

Multiply the current matrix by a general scaling matrix.

Definition at line 162 of file glc_context.cpp.

References glcMultMatrix(), and GLC_Matrix4x4::setMatScaling().

void GLC_Context::glcTranslated ( double  x,
double  y,
double  z 
) [inline]

Multiply the current matrix by a translation matrix.

Definition at line 113 of file glc_context.h.

void GLC_Context::init (  )  [private]

Init this context state.

Definition at line 277 of file glc_context.cpp.

References m_LightingIsEnable, and m_MatrixStackHash.

Referenced by GLC_Context(), and makeCurrent().

bool GLC_Context::lightingIsEnable (  )  const [inline]

Return lighting enable state.

Definition at line 88 of file glc_context.h.

Referenced by GLC_UniformShaderData::updateAll().

void GLC_Context::makeCurrent (  )  [virtual]

Make this context the current one.

Definition at line 234 of file glc_context.cpp.

References init(), GLC_ContextManager::instance(), GLC_State::isValid(), m_pCurrentContext, and GLC_ContextManager::setCurrent().

GLC_Matrix4x4 GLC_Context::modelViewMatrix (  )  const [inline]

Return the model view matrix.

Definition at line 80 of file glc_context.h.

Referenced by GLC_UniformShaderData::updateAll().

GLC_Matrix4x4 GLC_Context::projectionMatrix (  )  const [inline]

Return the projection matrix.

Definition at line 84 of file glc_context.h.

Referenced by GLC_UniformShaderData::updateAll(), and GLC_Viewport::updateProjectionMat().

void GLC_Context::updateUniformVariables (  )  [inline]

Update uniform variable.

Definition at line 142 of file glc_context.h.

Referenced by GLC_Shader::use().


Member Data Documentation

The context shared data.

Definition at line 180 of file glc_context.h.

Referenced by chooseContext().

The current matrix mode.

Definition at line 174 of file glc_context.h.

Referenced by glcLoadIdentity(), glcLoadMatrix(), glcMatrixMode(), glcMultMatrix(), glcPopMatrix(), and glcPushMatrix().

QStack<bool> GLC_Context::m_LightingIsEnable [private]

Enable lighting state.

Definition at line 189 of file glc_context.h.

Referenced by glcEnableLighting(), and init().

QHash<GLenum, bool> GLC_Context::m_LightsEnableState [private]

Lights enable state.

Definition at line 192 of file glc_context.h.

QHash<GLenum, QStack<GLC_Matrix4x4>* > GLC_Context::m_MatrixStackHash [private]

Mapping between matrixMode and matrix stack.

Definition at line 177 of file glc_context.h.

Referenced by glcLoadIdentity(), glcLoadMatrix(), glcMultMatrix(), glcPopMatrix(), glcPushMatrix(), init(), and ~GLC_Context().

GLC_Context * GLC_Context::m_pCurrentContext = NULL [static, private]

The current context.

Definition at line 186 of file glc_context.h.

Referenced by current(), doneCurrent(), and makeCurrent().

The uniform data of the current shader.

Definition at line 183 of file glc_context.h.

Referenced by glcEnableLighting(), glcLoadIdentity(), glcLoadMatrix(), and glcMultMatrix().


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

SourceForge.net Logo

©2005-2011 Laurent Ribon