TR-mbed 1.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
GpuHelper Class Reference

#include <gpuhelper.h>

Public Types

enum  ProjectionMode2D { PM_Normalized = 1 , PM_Viewport = 2 }
 

Public Member Functions

 GpuHelper ()
 
 ~GpuHelper ()
 
void pushProjectionMode2D (ProjectionMode2D pm)
 
void popProjectionMode2D ()
 
template<typename Scalar , int _Flags>
void multMatrix (const Matrix< Scalar, 4, 4, _Flags, 4, 4 > &mat, GLenum matrixTarget)
 
template<typename Scalar , int _Flags>
void loadMatrix (const Eigen::Matrix< Scalar, 4, 4, _Flags, 4, 4 > &mat, GLenum matrixTarget)
 
template<typename Scalar , typename Derived >
void loadMatrix (const Eigen::CwiseNullaryOp< Eigen::internal::scalar_identity_op< Scalar >, Derived > &, GLenum matrixTarget)
 
void forceMatrixTarget (GLenum matrixTarget)
 
void setMatrixTarget (GLenum matrixTarget)
 
template<typename Scalar , int _Flags>
void pushMatrix (const Matrix< Scalar, 4, 4, _Flags, 4, 4 > &mat, GLenum matrixTarget)
 
template<typename Scalar , typename Derived >
void pushMatrix (const Eigen::CwiseNullaryOp< Eigen::internal::scalar_identity_op< Scalar >, Derived > &, GLenum matrixTarget)
 
void pushMatrix (GLenum matrixTarget)
 
void popMatrix (GLenum 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 Enumeration Documentation

◆ ProjectionMode2D

Enumerator
PM_Normalized 
PM_Viewport 

Constructor & Destructor Documentation

◆ GpuHelper()

GpuHelper::GpuHelper ( )

◆ ~GpuHelper()

GpuHelper::~GpuHelper ( )

Member Function Documentation

◆ draw() [1/3]

void GpuHelper::draw ( GLenum  mode,
const std::vector< uint > *  pIndexes 
)
inline

draw an indexed subset

◆ draw() [2/3]

void GpuHelper::draw ( GLenum  mode,
uint  nofElement 
)
inline

draw the nofElement first elements

◆ draw() [3/3]

void GpuHelper::draw ( GLenum  mode,
uint  start,
uint  end 
)
inline

draw a range of elements

◆ drawUnitCube()

void GpuHelper::drawUnitCube ( void  )

◆ drawUnitSphere()

void GpuHelper::drawUnitSphere ( int  level = 0)

◆ drawVector()

void GpuHelper::drawVector ( const Vector3f &  position,
const Vector3f &  vec,
const Color color,
float  aspect = 50. 
)

◆ drawVectorBox()

void GpuHelper::drawVectorBox ( const Vector3f &  position,
const Vector3f &  vec,
const Color color,
float  aspect = 50. 
)

◆ 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() [1/2]

template<typename Scalar , typename Derived >
void GpuHelper::loadMatrix ( const Eigen::CwiseNullaryOp< Eigen::internal::scalar_identity_op< Scalar >, Derived > &  ,
GLenum  matrixTarget 
)

◆ loadMatrix() [2/2]

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()

◆ popMatrix()

void GpuHelper::popMatrix ( GLenum  matrixTarget)
inline

Pop the OpenGL matrix matrixTarget

◆ popProjectionMode2D()

void GpuHelper::popProjectionMode2D ( void  )

◆ pushMatrix() [1/3]

template<typename Scalar , typename Derived >
void GpuHelper::pushMatrix ( const Eigen::CwiseNullaryOp< Eigen::internal::scalar_identity_op< Scalar >, Derived > &  ,
GLenum  matrixTarget 
)

◆ pushMatrix() [2/3]

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

Push the OpenGL matrix matrixTarget and load mat.

◆ pushMatrix() [3/3]

void GpuHelper::pushMatrix ( GLenum  matrixTarget)
inline

Push and clone the OpenGL matrix matrixTarget

◆ pushProjectionMode2D()

void GpuHelper::pushProjectionMode2D ( ProjectionMode2D  pm)

◆ setMatrixTarget()

void GpuHelper::setMatrixTarget ( GLenum  matrixTarget)
inline

◆ update()

void GpuHelper::update ( void  )
protected

Member Data Documentation

◆ mColorBufferId

GLuint GpuHelper::mColorBufferId
protected

◆ mCurrentMatrixTarget

GLenum GpuHelper::mCurrentMatrixTarget
protected

◆ mInitialized

bool GpuHelper::mInitialized
protected

◆ mVpHeight

int GpuHelper::mVpHeight
protected

◆ mVpWidth

int GpuHelper::mVpWidth
protected

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