A renderizable object suitable for rendering with OpenGL's display lists.
The idea is to use the derived classes' ::render() method to save all the primitives into one display list, then in subsequent rendering events, just execute the list. This method is normally faster since it avoids the bottleneck between CPU-GPU. On the other hand, it demands more memory on the graphic card.
Instructions for implementing derived classes:
Definition at line 54 of file CRenderizableDisplayList.h.
#include <mrpt/opengl/CRenderizableDisplayList.h>
Public Member Functions | |
CRenderizableDisplayList () | |
virtual | ~CRenderizableDisplayList () |
CRenderizableDisplayList * | clone () const |
Interface for the stlplus smart pointer class. | |
virtual void | render () const |
Render the object, regenerating the display list if needed, otherwise just calling it. | |
Changes the appearance of the object to render (methods from CRenderizable that need to be redefined) | |
virtual CRenderizable & | setColorR (const double r) |
Color components in the range [0,1]. | |
virtual CRenderizable & | setColorG (const double g) |
Color components in the range [0,1]. | |
virtual CRenderizable & | setColorB (const double b) |
Color components in the range [0,1]. | |
virtual CRenderizable & | setColorA (const double a) |
Color components in the range [0,1]. | |
virtual CRenderizable & | setColor (const mrpt::utils::TColorf &c) |
Changes the default object color. | |
virtual CRenderizable & | setColor (double R, double G, double B, double A=1) |
Set the color components of this object (R,G,B,Alpha, in the range 0-1) | |
Protected Member Functions | |
Methods accesible or implemented by derived classes | |
EIGEN_STRONG_INLINE void | notifyChange () const |
Must be called to notify that the object has changed (so, the display list must be updated) | |
virtual void | render_dl () const =0 |
Derived classes must implement this method to the render the object. | |
virtual bool | should_skip_display_list_cache () const |
Optional: If the object has some state in which creating a display list is NOT preferred over direct rendering, implement this method and return "true" in those cases. | |
void | readFromStreamRender (mrpt::utils::CStream &in) |
Private Attributes | |
unsigned int | m_dl |
Display list ID, for derived classes that want to use it (it's automatically deleted and freed on destruction of this base class). | |
bool | m_dl_recreate |
If using display lists, this is true when the list must be updated (the object changes, it's the first rendering, etc...). | |
RTTI stuff | |
static const mrpt::utils::TRuntimeClassId | classCRenderizableDisplayList |
class | mrpt::utils::CStream |
static const mrpt::utils::TRuntimeClassId * | _GetBaseClass () |
virtual const mrpt::utils::TRuntimeClassId * | GetRuntimeClass () const |
Returns information about the class of an object in runtime. |
mrpt::opengl::CRenderizableDisplayList::CRenderizableDisplayList | ( | ) |
virtual mrpt::opengl::CRenderizableDisplayList::~CRenderizableDisplayList | ( | ) | [virtual] |
static const mrpt::utils::TRuntimeClassId* mrpt::opengl::CRenderizableDisplayList::_GetBaseClass | ( | ) | [static, protected] |
Reimplemented from mrpt::opengl::CRenderizable.
Reimplemented in mrpt::opengl::CAngularObservationMesh, mrpt::opengl::CPlanarLaserScan, mrpt::opengl::C3DSScene, mrpt::opengl::CArrow, mrpt::opengl::CAxis, mrpt::opengl::CBox, mrpt::opengl::CCylinder, mrpt::opengl::CDisk, mrpt::opengl::CEllipsoid, mrpt::opengl::CGeneralizedCylinder, mrpt::opengl::CGridPlaneXY, mrpt::opengl::CGridPlaneXZ, mrpt::opengl::CMesh, mrpt::opengl::COpenGLStandardObject, mrpt::opengl::CPolyhedron, mrpt::opengl::CSetOfLines, mrpt::opengl::CSetOfTexturedTriangles, mrpt::opengl::CSetOfTriangles, mrpt::opengl::CSimpleLine, mrpt::opengl::CSphere, mrpt::opengl::CTexturedObject, and mrpt::opengl::CTexturedPlane.
CRenderizableDisplayList* mrpt::opengl::CRenderizableDisplayList::clone | ( | ) | const [inline] |
Interface for the stlplus smart pointer class.
Reimplemented from mrpt::opengl::CRenderizable.
Definition at line 89 of file CRenderizableDisplayList.h.
virtual const mrpt::utils::TRuntimeClassId* mrpt::opengl::CRenderizableDisplayList::GetRuntimeClass | ( | ) | const [virtual] |
Returns information about the class of an object in runtime.
Reimplemented from mrpt::opengl::CRenderizable.
Reimplemented in mrpt::opengl::CAngularObservationMesh, mrpt::opengl::CPlanarLaserScan, mrpt::opengl::C3DSScene, mrpt::opengl::CArrow, mrpt::opengl::CAxis, mrpt::opengl::CBox, mrpt::opengl::CCylinder, mrpt::opengl::CDisk, mrpt::opengl::CEllipsoid, mrpt::opengl::CGeneralizedCylinder, mrpt::opengl::CGridPlaneXY, mrpt::opengl::CGridPlaneXZ, mrpt::opengl::CMesh, mrpt::opengl::COpenGLStandardObject, mrpt::opengl::CPolyhedron, mrpt::opengl::CSetOfLines, mrpt::opengl::CSetOfTexturedTriangles, mrpt::opengl::CSetOfTriangles, mrpt::opengl::CSimpleLine, mrpt::opengl::CSphere, mrpt::opengl::CTexturedObject, and mrpt::opengl::CTexturedPlane.
EIGEN_STRONG_INLINE void mrpt::opengl::CRenderizableDisplayList::notifyChange | ( | ) | const [inline, protected] |
Must be called to notify that the object has changed (so, the display list must be updated)
Definition at line 67 of file CRenderizableDisplayList.h.
Referenced by mrpt::opengl::CGeneralizedCylinder::addVisibleSectionAtEnd(), mrpt::opengl::CGeneralizedCylinder::addVisibleSectionAtStart(), mrpt::opengl::CSetOfLines::appendLine(), mrpt::opengl::CSetOfLines::appendLines(), mrpt::opengl::CSetOfLines::begin(), mrpt::opengl::CSetOfLines::clear(), mrpt::opengl::CSetOfTriangles::clearTriangles(), mrpt::opengl::CSetOfTexturedTriangles::clearTriangles(), mrpt::opengl::COpenGLStandardObject::disable(), mrpt::opengl::COpenGLStandardObject::enable(), mrpt::opengl::CMesh::enableColorFromZ(), mrpt::opengl::CEllipsoid::enableDrawSolid3D(), mrpt::opengl::C3DSScene::enableExtraAmbientLight(), mrpt::opengl::CSphere::enableRadiusIndependentOfEyeDistance(), mrpt::opengl::CAxis::enableTickMarks(), mrpt::opengl::CSetOfTriangles::enableTransparency(), mrpt::opengl::CMesh::enableTransparency(), mrpt::opengl::CAngularObservationMesh::enableTransparency(), mrpt::opengl::CMesh::enableWireFrame(), mrpt::opengl::CSetOfLines::end(), mrpt::opengl::CSetOfTexturedTriangles::getTriangle(), mrpt::opengl::CSetOfTriangles::insertTriangle(), mrpt::opengl::CSetOfTexturedTriangles::insertTriangle(), mrpt::opengl::CSetOfTriangles::insertTriangles(), mrpt::opengl::CSetOfTriangles::reserve(), mrpt::opengl::CSetOfLines::reserve(), mrpt::opengl::CSetOfLines::resize(), mrpt::opengl::CEllipsoid::set2DsegmentsCount(), mrpt::opengl::CEllipsoid::set3DsegmentsCount(), mrpt::opengl::CGeneralizedCylinder::setAllSectionsInvisible(), mrpt::opengl::CGeneralizedCylinder::setAllSectionsVisible(), mrpt::opengl::CArrow::setArrowEnds(), mrpt::opengl::CArrow::setArrowYawPitchRoll(), mrpt::opengl::CGeneralizedCylinder::setAxis(), mrpt::opengl::CAxis::setAxisLimits(), mrpt::opengl::CGeneralizedCylinder::setClosed(), mrpt::opengl::CDisk::setDiskRadius(), mrpt::opengl::COpenGLStandardObject::setFlags(), mrpt::opengl::CAxis::setFrequency(), mrpt::opengl::CGeneralizedCylinder::setGeneratrix(), mrpt::opengl::CGridPlaneXZ::setGridFrequency(), mrpt::opengl::CGridPlaneXY::setGridFrequency(), mrpt::opengl::CMesh::setGridLimits(), mrpt::opengl::CCylinder::setHasBases(), mrpt::opengl::CArrow::setHeadRatio(), mrpt::opengl::CCylinder::setHeight(), mrpt::opengl::CArrow::setLargeRadius(), mrpt::opengl::CSetOfLines::setLineByIndex(), mrpt::opengl::CSimpleLine::setLineCoords(), mrpt::opengl::CSimpleLine::setLineWidth(), mrpt::opengl::CSetOfLines::setLineWidth(), mrpt::opengl::CPolyhedron::setLineWidth(), mrpt::opengl::CBox::setLineWidth(), mrpt::opengl::CAxis::setLineWidth(), mrpt::opengl::CDisk::setLoopsCount(), mrpt::opengl::COpenGLStandardObject::setNormal(), mrpt::opengl::CSphere::setNumberDivsLatitude(), mrpt::opengl::CSphere::setNumberDivsLongitude(), mrpt::opengl::CTexturedPlane::setPlaneCorners(), mrpt::opengl::CGridPlaneXZ::setPlaneLimits(), mrpt::opengl::CGridPlaneXY::setPlaneLimits(), mrpt::opengl::CGridPlaneXZ::setPlaneYcoord(), mrpt::opengl::CGridPlaneXY::setPlaneZcoord(), mrpt::opengl::CEllipsoid::setQuantiles(), mrpt::opengl::CCylinder::setRadii(), mrpt::opengl::CSphere::setRadius(), mrpt::opengl::CCylinder::setRadius(), mrpt::opengl::CPlanarLaserScan::setScan(), mrpt::opengl::CDisk::setSlicesCount(), mrpt::opengl::CCylinder::setSlicesCount(), mrpt::opengl::CArrow::setSmallRadius(), mrpt::opengl::CCylinder::setStacksCount(), mrpt::opengl::CTexturedPlane::setTextureCornerCoords(), mrpt::opengl::CGeneralizedCylinder::setVisibleSections(), mrpt::opengl::CPolyhedron::setWireframe(), mrpt::opengl::CBox::setWireframe(), mrpt::opengl::CAngularObservationMesh::setWireframe(), mrpt::opengl::CMesh::setXBounds(), mrpt::opengl::CMesh::setXMax(), mrpt::opengl::CMesh::setXMin(), mrpt::opengl::CMesh::setYBounds(), mrpt::opengl::CMesh::setYMax(), and mrpt::opengl::CMesh::setYMin().
void mrpt::opengl::CRenderizableDisplayList::readFromStreamRender | ( | mrpt::utils::CStream & | in | ) | [inline, protected] |
Reimplemented from mrpt::opengl::CRenderizable.
Definition at line 76 of file CRenderizableDisplayList.h.
References mrpt::opengl::CRenderizable::readFromStreamRender().
virtual void mrpt::opengl::CRenderizableDisplayList::render | ( | ) | const [virtual] |
Render the object, regenerating the display list if needed, otherwise just calling it.
Implements mrpt::opengl::CRenderizable.
virtual void mrpt::opengl::CRenderizableDisplayList::render_dl | ( | ) | const [protected, pure virtual] |
Derived classes must implement this method to the render the object.
Implemented in mrpt::opengl::CAngularObservationMesh, mrpt::opengl::CPlanarLaserScan, mrpt::opengl::C3DSScene, mrpt::opengl::CArrow, mrpt::opengl::CAxis, mrpt::opengl::CBox, mrpt::opengl::CCylinder, mrpt::opengl::CDisk, mrpt::opengl::CEllipsoid, mrpt::opengl::CGeneralizedCylinder, mrpt::opengl::CGridPlaneXY, mrpt::opengl::CGridPlaneXZ, mrpt::opengl::CMesh, mrpt::opengl::COpenGLStandardObject, mrpt::opengl::CPolyhedron, mrpt::opengl::CSetOfLines, mrpt::opengl::CSetOfTriangles, mrpt::opengl::CSimpleLine, mrpt::opengl::CSphere, and mrpt::opengl::CTexturedObject.
virtual CRenderizable& mrpt::opengl::CRenderizableDisplayList::setColor | ( | const mrpt::utils::TColorf & | c | ) | [virtual] |
Changes the default object color.
Reimplemented from mrpt::opengl::CRenderizable.
Reimplemented in mrpt::opengl::CSetOfTriangles.
virtual CRenderizable& mrpt::opengl::CRenderizableDisplayList::setColor | ( | double | R, |
double | G, | ||
double | B, | ||
double | A = 1 |
||
) | [virtual] |
Set the color components of this object (R,G,B,Alpha, in the range 0-1)
Reimplemented from mrpt::opengl::CRenderizable.
Reimplemented in mrpt::opengl::CSetOfTriangles.
virtual CRenderizable& mrpt::opengl::CRenderizableDisplayList::setColorA | ( | const double | a | ) | [inline, virtual] |
Color components in the range [0,1].
Reimplemented from mrpt::opengl::CRenderizable.
Reimplemented in mrpt::opengl::CSetOfTriangles.
Definition at line 104 of file CRenderizableDisplayList.h.
virtual CRenderizable& mrpt::opengl::CRenderizableDisplayList::setColorB | ( | const double | b | ) | [inline, virtual] |
Color components in the range [0,1].
Reimplemented from mrpt::opengl::CRenderizable.
Reimplemented in mrpt::opengl::CSetOfTriangles.
Definition at line 103 of file CRenderizableDisplayList.h.
virtual CRenderizable& mrpt::opengl::CRenderizableDisplayList::setColorG | ( | const double | g | ) | [inline, virtual] |
Color components in the range [0,1].
Reimplemented from mrpt::opengl::CRenderizable.
Reimplemented in mrpt::opengl::CSetOfTriangles.
Definition at line 102 of file CRenderizableDisplayList.h.
virtual CRenderizable& mrpt::opengl::CRenderizableDisplayList::setColorR | ( | const double | r | ) | [inline, virtual] |
Color components in the range [0,1].
Reimplemented from mrpt::opengl::CRenderizable.
Reimplemented in mrpt::opengl::CSetOfTriangles.
Definition at line 101 of file CRenderizableDisplayList.h.
virtual bool mrpt::opengl::CRenderizableDisplayList::should_skip_display_list_cache | ( | ) | const [inline, protected, virtual] |
Optional: If the object has some state in which creating a display list is NOT preferred over direct rendering, implement this method and return "true" in those cases.
Reimplemented in mrpt::opengl::CSphere.
Definition at line 74 of file CRenderizableDisplayList.h.
friend class mrpt::utils::CStream [friend] |
Reimplemented from mrpt::opengl::CRenderizable.
Reimplemented in mrpt::opengl::CTexturedObject.
Definition at line 56 of file CRenderizableDisplayList.h.
const mrpt::utils::TRuntimeClassId mrpt::opengl::CRenderizableDisplayList::classCRenderizableDisplayList [static] |
Definition at line 56 of file CRenderizableDisplayList.h.
unsigned int mrpt::opengl::CRenderizableDisplayList::m_dl [mutable, private] |
Display list ID, for derived classes that want to use it (it's automatically deleted and freed on destruction of this base class).
Definition at line 59 of file CRenderizableDisplayList.h.
bool mrpt::opengl::CRenderizableDisplayList::m_dl_recreate [mutable, private] |
If using display lists, this is true when the list must be updated (the object changes, it's the first rendering, etc...).
Definition at line 60 of file CRenderizableDisplayList.h.
Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:40:17 UTC 2011 |