chai3d::cTexture1d Class Reference

This class implements a 1D texture map. More...

#include <CTexture1d.h>

Inheritance diagram for chai3d::cTexture1d:

Public Member Functions

 cTexture1d ()
 Constructor of cTexture1d. More...
 
virtual ~cTexture1d ()
 Destructor of cTexture1d. More...
 
void setTextureUnit (const GLenum a_textureUnit)
 This method set the texture unit where a_textureUnit is GL_TEXTUREi_ARB, where 0i<GL_MAX_TEXTURE_UNITS_ARB. More...
 
GLenum getTextureUnit () const
 This method returns the texture unit value. More...
 
void setTextureId (const GLuint a_textureId)
 This method sets the texture ID. More...
 
GLuint getTextureId ()
 This method returns the texture ID. More...
 
cTexture1dPtr copy ()
 This method creates a copy of itself. More...
 
virtual bool loadFromFile (const std::string &a_fileName)
 This method load a texture image from a file. More...
 
virtual bool saveToFile (const std::string &a_fileName)
 This method save a texture image to a file. More...
 
virtual void renderInitialize (cRenderOptions &a_options)
 This method enables texturing and sets this texture as the current texture. More...
 
virtual void renderFinalize (cRenderOptions &a_options)
 This method disables texture rendering. This method should be called after triangles have been rendered. More...
 
virtual void markForUpdate ()
 This method marks this texture for GPU update. More...
 
virtual void markForDeleteAndUpdate ()
 This method marks this texture for GPU deletion and reinitialization. More...
 
void setEnvironmentMode (const GLint &a_environmentMode)
 This method sets the environment mode (GL_MODULATE, GL_DECAL, GL_BLEND, GL_REPLACE). More...
 
GLint getEnvironmentMode ()
 This method returns the environment mode status. More...
 
virtual void setWrapModeS (const GLint &a_wrapModeS)
 This method set the texture wrap mode of s. More...
 
GLint getWrapModeS () const
 This method returns the texture wrap mode of s. More...
 
void setMagFunction (const GLint a_magFunction)
 This method sets the magnification function value. More...
 
GLint getMagFunction () const
 This method returns the current magnification function value. More...
 
void setMinFunction (const GLint a_minFunction)
 This method sets the minification function value. More...
 
GLint getMinFunction () const
 This method returns the current minification function value. More...
 
void setSphericalMappingEnabled (const bool a_enabled)
 This method enables of disables the spherical mapping mode. More...
 
bool getSphericalMappingEnabled () const
 This method returns thestatus of the spherical mapping mode. More...
 
void setUseMipmaps (bool a_useMipmaps)
 This method enables or disables the use of mipmaps. More...
 
bool getUseMipmaps ()
 This returns the the status of mipmaps. More...
 
bool setImage (cImagePtr a_image)
 This method assigns an image to this texture. More...
 
- Public Member Functions inherited from chai3d::cGenericTexture
 cGenericTexture ()
 Constructor of cGenericTexture. More...
 
virtual ~cGenericTexture ()
 Destructor of cGenericTexture. More...
 
void setEnabled (bool a_enabled)
 This method enables or disables texture mapping. More...
 
bool getEnabled () const
 This method returns true if the texture map is enabled, false otherwise. More...
 

Static Public Member Functions

static cTexture1dPtr create ()
 Shared cTexture1d allocator. More...
 
- Static Public Member Functions inherited from chai3d::cGenericTexture
static cGenericTexturePtr create ()
 Shared cGenericTexture allocator. More...
 

Public Attributes

cImagePtr m_image
 Image object associated with texture (use this to get data about the texture itself). More...
 
cColorf m_color
 Environmental color. More...
 

Protected Member Functions

virtual void reset ()
 This method resets all internal variables. This function should be called only by constructors. More...
 
virtual void update (cRenderOptions &a_options)
 This method update the OpenGL texture to GPU. More...
 

Protected Attributes

bool m_deleteTextureFlag
 If true, texture bitmap needs to be deleted from GPU memory. More...
 
bool m_updateTextureFlag
 If true, texture bitmap needs to be updated to GPU memory. More...
 
GLuint m_textureID
 OpenGL texture ID number. More...
 
GLint m_wrapModeS
 Texture wrap parameter along s (GL_REPEAT or GL_CLAMP). More...
 
GLint m_magFunction
 Texture magnification function value. (GL_NEAREST or GL_LINEAR). More...
 
GLint m_minFunction
 Texture minification function value. (GL_NEAREST or GL_LINEAR). More...
 
bool m_useMipmaps
 If true, mipmaps are enabled. More...
 
bool m_useSphericalMapping
 If true, spherical mapping is enable. More...
 
GLint m_environmentMode
 OpenGL texture mode (GL_MODULATE, GL_DECAL, GL_BLEND, or GL_REPLACE). More...
 
GLenum m_textureUnit
 Texture unit number. More...
 
GLint m_magFunctionMipmapsOFF
 Texture magnification function when mipmapping is OFF. More...
 
GLint m_minFunctionMipmapsOFF
 Texture minification function when mipmapping is OFF. More...
 
GLint m_magFunctionMipmapsON
 Texture magnification function when mipmapping is ON. More...
 
GLint m_minFunctionMipmapsON
 Texture minification function when mipmapping is ON. More...
 
- Protected Attributes inherited from chai3d::cGenericTexture
bool m_enabled
 If true, this texture is enabled, false otherwise. More...
 

Detailed Description

This class implements a 1D texture map.

Constructor & Destructor Documentation

chai3d::cTexture1d::cTexture1d ( )

Constructor of cTexture1d.

chai3d::cTexture1d::~cTexture1d ( )
virtual

Destructor of cTexture1d.

Member Function Documentation

static cTexture1dPtr chai3d::cTexture1d::create ( )
inlinestatic
void chai3d::cTexture1d::setTextureUnit ( const GLenum  a_textureUnit)
inline
GLenum chai3d::cTexture1d::getTextureUnit ( ) const
inline
void chai3d::cTexture1d::setTextureId ( const GLuint  a_textureId)
inline
GLuint chai3d::cTexture1d::getTextureId ( )
inline
cTexture1dPtr chai3d::cTexture1d::copy ( )

This method creates a copy of itself.

Returns
Pointer to new object.
bool chai3d::cTexture1d::loadFromFile ( const std::string &  a_fileName)
virtual

This method loads a texture image file.

Parameters
a_fileNameFilename.

Reimplemented from chai3d::cGenericTexture.

Reimplemented in chai3d::cTextureVideo.

bool chai3d::cTexture1d::saveToFile ( const std::string &  a_fileName)
virtual

This method saves this texture to a file.

Parameters
a_fileNameFilename.

Reimplemented from chai3d::cGenericTexture.

void chai3d::cTexture1d::renderInitialize ( cRenderOptions a_options)
virtual

This method enables texturing and sets this texture as the current texture.

Parameters
a_optionsRendering options.

Reimplemented from chai3d::cGenericTexture.

Reimplemented in chai3d::cTexture2d, chai3d::cTextureVideo, and chai3d::cTexture3d.

void chai3d::cTexture1d::renderFinalize ( cRenderOptions a_options)
virtual

This method is called to disable this texture once all triangles have been rendered.

Parameters
a_optionsRendering options.

Reimplemented from chai3d::cGenericTexture.

Reimplemented in chai3d::cTexture2d, and chai3d::cTexture3d.

void chai3d::cTexture1d::markForUpdate ( )
virtual

This method marks this texture for GPU update. This method should be called if the image data has changed at the CPU level and needs to be updated to the GPU memory.

Reimplemented from chai3d::cGenericTexture.

void chai3d::cTexture1d::markForDeleteAndUpdate ( )
virtual

This method marks the texture for deletion from GPU memory and update. This method should be called if the image format or size has changed.

Reimplemented from chai3d::cGenericTexture.

void chai3d::cTexture1d::setEnvironmentMode ( const GLint &  a_environmentMode)
inline
GLint chai3d::cTexture1d::getEnvironmentMode ( )
inline
void chai3d::cTexture1d::setWrapModeS ( const GLint &  a_wrapModeS)
virtual

This method sets the wrap parameter for texture coordinate S to either GL_CLAMP or GL_REPEAT.

GL_CLAMP causes s coordinates to be clamped to the range [0,1] and is useful for preventing wrapping artifacts when mapping a single image onto an object.

GL_REPEAT causes the integer part of the s coordinate to be ignored; OpenGL uses only the fractional part, thereby creating a repeating pattern. Border texture elements are accessed only if wrapping is set to GL_CLAMP.

Parameters
a_wrapModeSValue shall be either GL_REPEAT or GL_CLAMP.
GLint chai3d::cTexture1d::getWrapModeS ( ) const
inline
void chai3d::cTexture1d::setMagFunction ( const GLint  a_magFunction)

This method sets the texture magnification function to either GL_NEAREST or GL_LINEAR.

The texture magnification function is used when the pixel being textured maps to an area less than or equal to one texture element.

Parameters
a_magFunctionvalue shall be either GL_NEAREST or GL_LINEAR.
GLint chai3d::cTexture1d::getMagFunction ( ) const
inline
void chai3d::cTexture1d::setMinFunction ( const GLint  a_minFunction)

This method sets the minifying value.

The texture minifying function is used whenever the pixel being textured maps to an area greater than one texture element. There are six defined minifying functions. Two of them use the nearest one or nearest four texture elements to compute the texture value. The other four use mipmaps. A mipmap is an ordered set of arrays representing the same image at progressively lower resolutions. If the texture has dimensions 2nx2m there are max(n, m) + 1 mipmaps. The first mipmap is the original texture, with dimensions 2nx2m. Each subsequent mipmap has dimensions 2k1x2l1 where 2 kx2l are the dimensions of the previous mipmap, until either k = 0 or l = 0. At that point, subsequent mipmaps have dimension 1x2l1 or 2k1x1 until the final mipmap, which has dimension 1x1. Mipmaps are defined using glTexImage1D or glTexImage2D with the level-of-detail argument indicating the order of the mipmaps. Level 0 is the original texture; level bold max(n, m) is the final 1x1 mipmap.

Parameters
a_minFunctionvalue shall be either GL_NEAREST or GL_LINEAR.
GLint chai3d::cTexture1d::getMinFunction ( ) const
inline
void chai3d::cTexture1d::setSphericalMappingEnabled ( const bool  a_enabled)
inline
bool chai3d::cTexture1d::getSphericalMappingEnabled ( ) const
inline
void chai3d::cTexture1d::setUseMipmaps ( bool  a_useMipmaps)

This method enables or disables mipmapping. Please note that this function does not work with all graphics cards! (ATI graphic cards seem to have problems)

Parameters
a_useMipmapsMipmaps status.
bool chai3d::cTexture1d::getUseMipmaps ( )
inline
bool chai3d::cTexture1d::setImage ( cImagePtr  a_image)

This method assign image associated with the texture.

Parameters
a_imagePointer to image.
Returns
true if operation succeeds, false otherwise.
void chai3d::cTexture1d::reset ( )
protectedvirtual

This method resets all internal variables. This methos must only be called by constructors.

Reimplemented in chai3d::cTexture3d, and chai3d::cTexture2d.

void chai3d::cTexture1d::update ( cRenderOptions a_options)
protectedvirtual

This method updates the texture from memory data to GPU.

Parameters
a_optionsRendering options.

Reimplemented in chai3d::cTexture3d, and chai3d::cTexture2d.

Member Data Documentation

cImagePtr chai3d::cTexture1d::m_image
cColorf chai3d::cTexture1d::m_color
bool chai3d::cTexture1d::m_deleteTextureFlag
protected
bool chai3d::cTexture1d::m_updateTextureFlag
protected
GLuint chai3d::cTexture1d::m_textureID
protected
GLint chai3d::cTexture1d::m_wrapModeS
protected
GLint chai3d::cTexture1d::m_magFunction
protected
GLint chai3d::cTexture1d::m_minFunction
protected
bool chai3d::cTexture1d::m_useMipmaps
protected
bool chai3d::cTexture1d::m_useSphericalMapping
protected
GLint chai3d::cTexture1d::m_environmentMode
protected
GLenum chai3d::cTexture1d::m_textureUnit
protected
GLint chai3d::cTexture1d::m_magFunctionMipmapsOFF
protected
GLint chai3d::cTexture1d::m_minFunctionMipmapsOFF
protected
GLint chai3d::cTexture1d::m_magFunctionMipmapsON
protected
GLint chai3d::cTexture1d::m_minFunctionMipmapsON
protected

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