OSVR-Core
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
GpuHelper Class Reference

Public Types

enum  ProjectionMode2D { PM_Normalized = 1, PM_Viewport = 2 }
 

Public Member Functions

void pushProjectionMode2D (ProjectionMode2D pm)
 
void popProjectionMode2D ()
 
template<typename Scalar , int _Flags>
void multMatrix (const Matrix< Scalar, 4, 4, _Flags, 4, 4 > &mat, GLenum matrixTarget)
 Multiply the OpenGL matrix matrixTarget by the matrix mat. More...
 
template<typename Scalar , int _Flags>
void loadMatrix (const Eigen::Matrix< Scalar, 4, 4, _Flags, 4, 4 > &mat, GLenum matrixTarget)
 Load the matrix mat to the OpenGL matrix matrixTarget. More...
 
template<typename Scalar , typename Derived >
void loadMatrix (const Eigen::CwiseNullaryOp< Eigen::internal::scalar_identity_op< Scalar >, Derived > &, GLenum matrixTarget)
 
void forceMatrixTarget (GLenum matrixTarget)
 Make the matrix matrixTarget the current OpenGL matrix target. More...
 
void setMatrixTarget (GLenum matrixTarget)
 
template<typename Scalar , int _Flags>
void pushMatrix (const Matrix< Scalar, 4, 4, _Flags, 4, 4 > &mat, GLenum matrixTarget)
 Push the OpenGL matrix matrixTarget and load mat.
 
template<typename Scalar , typename Derived >
void pushMatrix (const Eigen::CwiseNullaryOp< Eigen::internal::scalar_identity_op< Scalar >, Derived > &, GLenum matrixTarget)
 
void pushMatrix (GLenum matrixTarget)
 Push and clone the OpenGL matrix matrixTarget.
 
void popMatrix (GLenum matrixTarget)
 Pop the OpenGL matrix matrixTarget.
 
void drawVector (const Vector3f &position, const Vector3f &vec, const Color &color, float aspect=50.)
 
void drawVectorBox (const Vector3f &position, const Vector3f &vec, const Color &color, float aspect=50.)
 
void drawUnitCube (void)
 
void drawUnitSphere (int level=0)
 
void draw (GLenum mode, uint nofElement)
 draw the nofElement first elements
 
void draw (GLenum mode, uint start, uint end)
 draw a range of elements
 
void draw (GLenum mode, const std::vector< uint > *pIndexes)
 draw an indexed subset
 

Protected Member Functions

void update (void)
 

Protected Attributes

GLuint mColorBufferId
 
int mVpWidth
 
int mVpHeight
 
GLenum mCurrentMatrixTarget
 
bool mInitialized
 

Member Function Documentation

§ forceMatrixTarget()

void GpuHelper::forceMatrixTarget ( GLenum  matrixTarget)
inline

Make the matrix matrixTarget the current OpenGL matrix target.

Call this function before loadMatrix() or multMatrix() if you cannot guarantee that glMatrixMode() has never been called after the last loadMatrix() or multMatrix() calls.

Todo:
provides a debug mode checking the sanity of the cached matrix mode.

§ loadMatrix()

template<typename Scalar , int _Flags>
void GpuHelper::loadMatrix ( const Eigen::Matrix< Scalar, 4, 4, _Flags, 4, 4 > &  mat,
GLenum  matrixTarget 
)

Load the matrix mat to the OpenGL matrix matrixTarget.

Essentially, this helper function automatically calls glMatrixMode(matrixTarget) if required and does a proper call to the right glLoadMatrix*() or glLoadIdentity() function according to the scalar type and storage order.

Warning
glMatrixMode() must never be called directly. If your're unsure, use forceMatrixMode().
See also
Matrix, multMatrix(), forceMatrixMode()

§ multMatrix()

template<typename Scalar , int _Flags>
void GpuHelper::multMatrix ( const Matrix< Scalar, 4, 4, _Flags, 4, 4 > &  mat,
GLenum  matrixTarget 
)

Multiply the OpenGL matrix matrixTarget by the matrix mat.

Essentially, this helper function automatically calls glMatrixMode(matrixTarget) if required and does a proper call to the right glMultMatrix*() function according to the scalar type and storage order.

Warning
glMatrixMode() must never be called directly. If your're unsure, use forceMatrixMode().
See also
Matrix, loadMatrix(), forceMatrixMode()

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