Texture Class Reference

The Texture class contains methods for loading textures from disk and binding textures in OpenGL. More...

#include <Texture.h>

List of all members.

Static Public Member Functions

static int LoadTIFFImage (ImageHandle &image, const char path[])
 Load a tiff image from disk.
static int LoadAndBindTexture (GLuint *tex, const char path[])
 Load a tiff image from disk and bind it as the current texture.
static int LoadAndBindTexture (GLuint *tex, const char path[], GLuint mode)
 Load a tiff image from disk and bind it as the current texture.
static int LoadTextureForName (const char name[], const char path[])
 Load a tiff image from disk, bind it as the current texture and associate it with a name for later reference.
static int GetTextureByName (const char name[])
 Get the texture id for a texture name.
static void FreeTextureForName (const char name[])
 Release memory occupied by a texture accosiated with a name.

Static Protected Attributes

static IntNameMap textureMap


Detailed Description

The Texture class contains methods for loading textures from disk and binding textures in OpenGL.

The class also provides a mechanism for mapping textures to names (strings) for easy reference.

Currently supported formats are: TIFF.

Depends on: libtiff.

Author:
Daniel Aarno <macbishop@users.sf.net>
Version:
0.1.0


Member Function Documentation

static void Texture::FreeTextureForName ( const char  name[]  )  [static]

Release memory occupied by a texture accosiated with a name.

Parameters:
name The name associated with the texture.

static int Texture::GetTextureByName ( const char  name[]  )  [static]

Get the texture id for a texture name.

Parameters:
name The name associated with the texture.
Returns:
The texture id assocated with the specified name, -1 if name is invalid.

static int Texture::LoadAndBindTexture ( GLuint *  tex,
const char  path[],
GLuint  mode 
) [static]

Load a tiff image from disk and bind it as the current texture.

Parameters:
tex Pointer to an GLuint that stores the ID of the texture loaded.
path The path specifying where the TIFF image can be found.
mode The internal GL storage mode
Returns:
0 on success, -EIO on error reading the TIFF image, 1 if the image does not conform to stric openGL standard and TEXTURE_FORCE_MAX_128 was defined when compiled, 2 if the image is not a power of 2 and TEXTURE_FORCE_POWER_OF_2 was defined when compiled.

static int Texture::LoadAndBindTexture ( GLuint *  tex,
const char  path[] 
) [static]

Load a tiff image from disk and bind it as the current texture.

Parameters:
tex Pointer to an GLuint that stores the ID of the texture loaded.
path The path specifying where the TIFF image can be found.
Returns:
0 on success, -EIO on error reading the TIFF image, 1 if the image does not conform to stric openGL standard and TEXTURE_FORCE_MAX_128 was defined when compiled, 2 if the image is not a power of 2 and TEXTURE_FORCE_POWER_OF_2 was defined when compiled.

static int Texture::LoadTextureForName ( const char  name[],
const char  path[] 
) [static]

Load a tiff image from disk, bind it as the current texture and associate it with a name for later reference.

Note that the parameter name must be unique!

Parameters:
name The name that should be associated with this texture.
path The path specifying where the TIFF image can be found.
Returns:
0 on success, -EIO on error reading the TIFF image, 3 if the name is already taken. Any error that can be reported by LoadAndBindTexture can also occure.

static int Texture::LoadTIFFImage ( ImageHandle image,
const char  path[] 
) [static]

Load a tiff image from disk.

Parameters:
image A reference to a TIFF ImageHandle to hold the image data. If the image already contains data, the memory occupied by this data is returned to the system and the data is replaced by the new image data.
path The path specifying where the TIFF image can be found.
Returns:
0 on success, -EIO on error reading the TIFF image.


Member Data Documentation

IntNameMap Texture::textureMap [static, protected]


The documentation for this class was generated from the following file:
Generated on Sun Mar 11 15:33:26 2007 for MetalWarriors by  doxygen 1.4.7