Main MRPT website > C++ reference
MRPT logo
Public Member Functions | Protected Member Functions | Protected Attributes

mrpt::opengl::CTexturedObject Class Reference


Detailed Description

A base class for all OpenGL objects with loadable textures.

See also:
opengl::COpenGLScene, opengl::CTexturedPlane, opengl::CSetOfTexturedTriangles

Definition at line 47 of file CTexturedObject.h.

#include <mrpt/opengl/CTexturedObject.h>

Inheritance diagram for mrpt::opengl::CTexturedObject:
Inheritance graph
[legend]

List of all members.

Public Member Functions

void assignImage (const mrpt::utils::CImage &img, const mrpt::utils::CImage &imgAlpha)
 Assigns a texture and a transparency image, and enables transparency (If the images are not 2^N x 2^M, they will be internally filled to its dimensions to be powers of two)
void assignImage (const mrpt::utils::CImage &img)
 Assigns a texture image, and disable transparency.
void assignImage_fast (mrpt::utils::CImage &img, mrpt::utils::CImage &imgAlpha)
 Similar to assignImage, but the passed images will be returned as empty: it avoids making a copy of the whole image, just copies a pointer.
void assignImage_fast (mrpt::utils::CImage &img)
 Similar to assignImage, but the passed images will be returned as empty: it avoids making a copy of the whole image, just copies a pointer.
void loadTextureInOpenGL () const
 VERY IMPORTANT: If you use a multi-thread application, you MUST call this from the same thread that will later destruct the object in order to the OpenGL texture memory to be correctly deleted.
virtual void render_dl () const
 Derived classes must implement this method to the render the object.

Protected Member Functions

 CTexturedObject ()
virtual ~CTexturedObject ()
void unloadTexture ()
virtual void render_pre () const
virtual void render_post () const
virtual void render_texturedobj () const =0
 Must be implemented by derived classes.
void writeToStreamTexturedObject (mrpt::utils::CStream &out) const
void readFromStreamTexturedObject (mrpt::utils::CStream &in)

Protected Attributes

unsigned int m_glTextureName
bool m_texture_is_loaded
mrpt::utils::CImage m_textureImage
mrpt::utils::CImage m_textureImageAlpha
bool m_enableTransparency
 Of the texture using "m_textureImageAlpha".
int r_width
int r_height
 Size of the texture image, rounded up to next power of 2.
int m_fill_x_left
int m_fill_y_top
int m_fill_x_right
int m_fill_y_bottom
 The size of the fill in pixels in the textured image, w.r.t the image passed by the user.

RTTI stuff

static const
mrpt::utils::TRuntimeClassId 
classCTexturedObject
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.

Constructor & Destructor Documentation

mrpt::opengl::CTexturedObject::CTexturedObject (  ) [protected]
virtual mrpt::opengl::CTexturedObject::~CTexturedObject (  ) [protected, virtual]

Member Function Documentation

static const mrpt::utils::TRuntimeClassId* mrpt::opengl::CTexturedObject::_GetBaseClass (  ) [static, protected]
void mrpt::opengl::CTexturedObject::assignImage ( const mrpt::utils::CImage img,
const mrpt::utils::CImage imgAlpha 
)

Assigns a texture and a transparency image, and enables transparency (If the images are not 2^N x 2^M, they will be internally filled to its dimensions to be powers of two)

Note:
Images are copied, the original ones can be deleted.
void mrpt::opengl::CTexturedObject::assignImage ( const mrpt::utils::CImage img )

Assigns a texture image, and disable transparency.

Note:
Images are copied, the original ones can be deleted.
void mrpt::opengl::CTexturedObject::assignImage_fast ( mrpt::utils::CImage img,
mrpt::utils::CImage imgAlpha 
)

Similar to assignImage, but the passed images will be returned as empty: it avoids making a copy of the whole image, just copies a pointer.

void mrpt::opengl::CTexturedObject::assignImage_fast ( mrpt::utils::CImage img )

Similar to assignImage, but the passed images will be returned as empty: it avoids making a copy of the whole image, just copies a pointer.

virtual const mrpt::utils::TRuntimeClassId* mrpt::opengl::CTexturedObject::GetRuntimeClass (  ) const [virtual]

Returns information about the class of an object in runtime.

Reimplemented from mrpt::opengl::CRenderizableDisplayList.

Reimplemented in mrpt::opengl::CSetOfTexturedTriangles, and mrpt::opengl::CTexturedPlane.

void mrpt::opengl::CTexturedObject::loadTextureInOpenGL (  ) const

VERY IMPORTANT: If you use a multi-thread application, you MUST call this from the same thread that will later destruct the object in order to the OpenGL texture memory to be correctly deleted.

Calling this method more than once has no effects. If you use one thread, this method will be automatically called when rendering, so there is no need to explicitly call it.

void mrpt::opengl::CTexturedObject::readFromStreamTexturedObject ( mrpt::utils::CStream in ) [protected]
virtual void mrpt::opengl::CTexturedObject::render_dl (  ) const [virtual]

Derived classes must implement this method to the render the object.

Implements mrpt::opengl::CRenderizableDisplayList.

virtual void mrpt::opengl::CTexturedObject::render_post (  ) const [protected, virtual]
virtual void mrpt::opengl::CTexturedObject::render_pre (  ) const [protected, virtual]
virtual void mrpt::opengl::CTexturedObject::render_texturedobj (  ) const [protected, pure virtual]

Must be implemented by derived classes.

Implemented in mrpt::opengl::CSetOfTexturedTriangles, and mrpt::opengl::CTexturedPlane.

void mrpt::opengl::CTexturedObject::unloadTexture (  ) [protected]

Reimplemented in mrpt::opengl::CTexturedPlane.

void mrpt::opengl::CTexturedObject::writeToStreamTexturedObject ( mrpt::utils::CStream out ) const [protected]

Friends And Related Function Documentation

friend class mrpt::utils::CStream [friend]

Reimplemented from mrpt::opengl::CRenderizableDisplayList.

Definition at line 49 of file CTexturedObject.h.


Member Data Documentation

Definition at line 49 of file CTexturedObject.h.

Of the texture using "m_textureImageAlpha".

Definition at line 56 of file CTexturedObject.h.

Definition at line 58 of file CTexturedObject.h.

Definition at line 58 of file CTexturedObject.h.

The size of the fill in pixels in the textured image, w.r.t the image passed by the user.

Definition at line 58 of file CTexturedObject.h.

Definition at line 58 of file CTexturedObject.h.

unsigned int mrpt::opengl::CTexturedObject::m_glTextureName [mutable, protected]

Definition at line 52 of file CTexturedObject.h.

Definition at line 53 of file CTexturedObject.h.

Definition at line 54 of file CTexturedObject.h.

Definition at line 55 of file CTexturedObject.h.

int mrpt::opengl::CTexturedObject::r_height [mutable, protected]

Size of the texture image, rounded up to next power of 2.

Definition at line 57 of file CTexturedObject.h.

int mrpt::opengl::CTexturedObject::r_width [mutable, protected]

Definition at line 57 of file CTexturedObject.h.




Page generated by Doxygen 1.7.2 for MRPT 0.9.4 SVN: at Mon Jan 10 22:46:17 UTC 2011