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

void draw (GLenum mode, uint nofElement)
 draw the nofElement first elements More...
 
void draw (GLenum mode, uint start, uint end)
 draw a range of elements More...
 
void draw (GLenum mode, const std::vector< uint > *pIndexes)
 draw an indexed subset More...
 
void drawUnitCube (void)
 
void drawUnitSphere (int level=0)
 
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 forceMatrixTarget (GLenum matrixTarget)
 
 GpuHelper ()
 
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)
 
template<typename Scalar , int _Flags>
void multMatrix (const Matrix< Scalar, 4, 4, _Flags, 4, 4 > &mat, GLenum matrixTarget)
 
void popMatrix (GLenum matrixTarget)
 
void popProjectionMode2D ()
 
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 pushProjectionMode2D (ProjectionMode2D pm)
 
void setMatrixTarget (GLenum matrixTarget)
 
 ~GpuHelper ()
 

Protected Member Functions

void update (void)
 

Protected Attributes

GLuint mColorBufferId
 
GLenum mCurrentMatrixTarget
 
bool mInitialized
 
int mVpHeight
 
int mVpWidth
 

Detailed Description

Definition at line 21 of file gpuhelper.h.

Member Enumeration Documentation

Enumerator
PM_Normalized 
PM_Viewport 

Definition at line 29 of file gpuhelper.h.

Constructor & Destructor Documentation

GpuHelper::GpuHelper ( )

Definition at line 20 of file gpuhelper.cpp.

GpuHelper::~GpuHelper ( )

Definition at line 27 of file gpuhelper.cpp.

Member Function Documentation

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

draw the nofElement first elements

Definition at line 191 of file gpuhelper.h.

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

draw a range of elements

Definition at line 202 of file gpuhelper.h.

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

draw an indexed subset

Definition at line 197 of file gpuhelper.h.

void GpuHelper::drawUnitCube ( void  )

Definition at line 98 of file gpuhelper.cpp.

void GpuHelper::drawUnitSphere ( int  level = 0)

Definition at line 120 of file gpuhelper.cpp.

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

Definition at line 56 of file gpuhelper.cpp.

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

Definition at line 77 of file gpuhelper.cpp.

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.

Definition at line 63 of file gpuhelper.h.

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

Definition at line 157 of file gpuhelper.h.

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

Definition at line 148 of file gpuhelper.h.

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

Definition at line 141 of file gpuhelper.h.

void GpuHelper::popMatrix ( GLenum  matrixTarget)
inline

Pop the OpenGL matrix matrixTarget

Definition at line 185 of file gpuhelper.h.

void GpuHelper::popProjectionMode2D ( void  )

Definition at line 50 of file gpuhelper.cpp.

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.

Definition at line 170 of file gpuhelper.h.

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

Definition at line 177 of file gpuhelper.h.

void GpuHelper::pushMatrix ( GLenum  matrixTarget)
inline

Push and clone the OpenGL matrix matrixTarget

Definition at line 163 of file gpuhelper.h.

void GpuHelper::pushProjectionMode2D ( ProjectionMode2D  pm)

Definition at line 31 of file gpuhelper.cpp.

void GpuHelper::setMatrixTarget ( GLenum  matrixTarget)
inline

Definition at line 134 of file gpuhelper.h.

void GpuHelper::update ( void  )
protected

Member Data Documentation

GLuint GpuHelper::mColorBufferId
protected

Definition at line 103 of file gpuhelper.h.

GLenum GpuHelper::mCurrentMatrixTarget
protected

Definition at line 105 of file gpuhelper.h.

bool GpuHelper::mInitialized
protected

Definition at line 106 of file gpuhelper.h.

int GpuHelper::mVpHeight
protected

Definition at line 104 of file gpuhelper.h.

int GpuHelper::mVpWidth
protected

Definition at line 104 of file gpuhelper.h.


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


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:51:48