CIvfTexture Class Reference

#include <ivf/IvfTexture.h>

Inheritance diagram for CIvfTexture:

CIvfObject CIvfBase CIvfRefCountBase CIvfRTTIBase List of all members.

Public Member Functions

 CIvfTexture ()
virtual ~CIvfTexture ()
 IvfClassInfo ("CIvfTexture", CIvfObject)
void setTextureEnvColor (float red, float green, float blue, float alfa)
void setEnvColor (float red, float green, float blue, float alfa)
void getTextureEnvColor (float &red, float &green, float &blue, float &alfa)
void getEnvColor (float &red, float &green, float &blue, float &alfa)
void setGenerateMipmaps (bool flag)
void setTextureMode (GLenum mode)
void setMode (GLenum mode)
void setFilters (GLenum minFilter, GLenum magFilter)
void setTextureRepeat (GLenum repeatS, GLenum repeatT)
void setRepeat (GLenum repeatS, GLenum repeatT)
void setTextureModifier (double scaleX, double scaleY, double rotate)
void setModifier (double scaleX, double scaleY, double rotate)
void setTextureTranslate (double x, double y)
void setTranslate (double x, double y)
void setImage (CIvfImage *image)
void setImageMap (void *imageMap)
void setSize (int width, int height)
void getSize (int &width, int &height)
bool isBound ()
void apply ()
void bind ()
GLuint getName ()
void setLoadImages (bool flag)
void setGenerateName (bool flag)
void setName (GLuint name)
void activate ()
void deactivate ()
bool isActive ()

Detailed Description

OpenGL texture definition

The IvfTexture class manages a texture in OpenGL. All shape nodes can be assigned a IvfTexture. To be able to see a texture on a shape it must also render texture coordinates. An example of how a texture is used is shown below:

 CIvfJpegImage* image = new CIvfJpegImage();
 image->setFileName("textures/architecture8.jpg");
 image->read();
 
 CIvfTexture* texture = new CIvfTexture();
 texture->setImage(image);
 texture->setFilters(GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR);
 texture->setGenerateMipmaps(true);
 
 .
 .
 
 CIvfSphere* sphere = new CIvfSphere();
 sphere->setMaterial(...)
 sphere->setTexture(texture);

Author:
Jonas Lindemann
Examples:

advgeom.cpp, and textures.cpp.

Definition at line 62 of file IvfTexture.h.


Constructor & Destructor Documentation

CIvfTexture::CIvfTexture  ) 
 

Constructor

virtual CIvfTexture::~CIvfTexture  )  [virtual]
 

Destructor


Member Function Documentation

void CIvfTexture::activate  ) 
 

Activates texture

If active, the texture will be applied in the rendering process.

void CIvfTexture::apply  ) 
 

Applies the texture

Sets the texture as the current texture in OpenGL. The bind() method must be called before the apply() method is called.

void CIvfTexture::bind  ) 
 

Binds texture in OpenGL

Binds a texture image to a texture name in OpenGL. Must be called before apply().

void CIvfTexture::deactivate  ) 
 

Activates texture

If active, the texture will be applied in the rendering process.

void CIvfTexture::getEnvColor float &  red,
float &  green,
float &  blue,
float &  alfa
 

Return texture environment color

GLuint CIvfTexture::getName  ) 
 

Texture name

This name is used in conjunction with the OpenGL command glBindTexture, to bind the texture with the geometry.

Reimplemented from CIvfObject.

void CIvfTexture::getSize int &  width,
int &  height
 

Returns the size of the current loaded image or imagemap.

void CIvfTexture::getTextureEnvColor float &  red,
float &  green,
float &  blue,
float &  alfa
 

Return texture environment color (Obsolete! Use getEnvColor() instead)

bool CIvfTexture::isActive  ) 
 

Returns texture active state

bool CIvfTexture::isBound  ) 
 

Returns true if a texture is bound

void CIvfTexture::setEnvColor float  red,
float  green,
float  blue,
float  alfa
 

Set texture environment color

Corresponds to an OpenGL

        glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, ...);

void CIvfTexture::setFilters GLenum  minFilter,
GLenum  magFilter
 

Set magnification and minification filters

Values for

Parameters:
minFilter are:
GL_NEAREST, GL_LINEAR, GL_NEAREST_MIPMAP_NEAREST, GL_LINEAR_MIPMAP_NEAREST, GL_NEAREST_MIPMAP_LINEAR, GL_LINEAR_MIPMAP_LINEAR

Values for

Parameters:
maxFilter are:
GL_NEAREST, GL_LINEAR

void CIvfTexture::setGenerateMipmaps bool  flag  ) 
 

Mipmap generation flag

void CIvfTexture::setGenerateName bool  flag  ) 
 

Name generation flag

if set to true (default) texture names will be automatically generated. If false the texture name set with setName() will be used.

void CIvfTexture::setImage CIvfImage image  ) 
 

Sets texture image (required)

Assigns an image to the texture. An image can be loaded using the ivfimage library.

void CIvfTexture::setImageMap void *  imageMap  ) 
 

Set raw image map

If the image has been loaded using other methods than the IvfImage class a pointer to the image can be set using this method.

void CIvfTexture::setLoadImages bool  flag  ) 
 

Image loading flag

if set to true textures are not bound using glTexImage2D or glBuild2dMipmaps

void CIvfTexture::setMode GLenum  mode  ) 
 

Set texture mode

Sets the OpenGL texture function used. Values are

GL_MODULATE, GL_BLEND, GL_DECAL

void CIvfTexture::setModifier double  scaleX,
double  scaleY,
double  rotate
 

Set texture modifiers

This method sets additional texture modifiers such as scaling and rotation, which are applied using the glMatrixMode(GL_TEXTURE)

void CIvfTexture::setName GLuint  name  ) 
 

Set texture name

If automatic texture generation is not used this method specifies the name to use instead.

void CIvfTexture::setRepeat GLenum  repeatS,
GLenum  repeatT
 

Set texture repeat mode

If a parameter is set to GL_CLAMP texture coordinates are clamped to [0,1] if set to GL_REPEAT OpenGL uses only the fractional part, see OpenGL reference.

Parameters:
repeatS can be GL_REPEAT or GL_CLAMP
repeatY can be GL_REPEAT or GL_CLAMP

void CIvfTexture::setSize int  width,
int  height
 

Set texture image size

This method should be used if a raw image map is used, to set the image size information.

void CIvfTexture::setTextureEnvColor float  red,
float  green,
float  blue,
float  alfa
 

Set texture environment color (Obsolete! Use setEnvColor() instead)

Corresponds to an OpenGL

        glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, ...);

void CIvfTexture::setTextureMode GLenum  mode  ) 
 

Set texture mode (Obsolete! Use setMode() instead)

Sets the OpenGL texture function used. Values are

GL_MODULATE, GL_BLEND, GL_DECAL

void CIvfTexture::setTextureModifier double  scaleX,
double  scaleY,
double  rotate
 

Set texture modifiers (Obsolete! Use setModifier() instead)

This method sets additional texture modifiers such as scaling and rotation, which are applied using the glMatrixMode(GL_TEXTURE)

void CIvfTexture::setTextureRepeat GLenum  repeatS,
GLenum  repeatT
 

Set texture repeat mode (Obsolete! Use setRepeat instead.)

If a parameter is set to GL_CLAMP texture coordinates are clamped to [0,1] if set to GL_REPEAT OpenGL uses only the fractional part, see OpenGL reference.

Parameters:
repeatS can be GL_REPEAT or GL_CLAMP
repeatY can be GL_REPEAT or GL_CLAMP

void CIvfTexture::setTextureTranslate double  x,
double  y
 

Set texture translation (Obsolete! use setTranslate() instead)

This method sets additional texture modifiers translation, which are applied using the glMatrixMode(GL_TEXTURE)

void CIvfTexture::setTranslate double  x,
double  y
 

Set texture translation

This method sets additional texture modifiers translation, which are applied using the glMatrixMode(GL_TEXTURE)


The documentation for this class was generated from the following file:
Generated on Fri Sep 1 15:36:59 2006 for Interactive Visualisation Framework - Ivf++ by  doxygen 1.4.6-NO