phoenix::PhTexture Class Reference

Texture class. More...

#include <PhTexture.h>

List of all members.

Public Member Functions

 PhTexture (PhTextureManager *t)
 Constructor.
 PhTexture (PhTextureManager *t, int a, int b)
 Constructor.
 ~PhTexture ()
 Destructor.
void setTexture (GLuint text)
 Set texture.
GLuint getTexture ()
 Get texture.
void setName (std::string nm)
 Set name.
std::string getName ()
 Get name.
void setModified (bool a)
 Set modified.
bool getModified ()
 Get modified.
void setWidth (int var)
 Set width.
int getWidth ()
 Get width.
void setHeight (int var)
 Set height.
int getHeight ()
 Get height.
bool lockTexture ()
 Lock texture.
void unlockTexture ()
 Unlock texture.
void setPixel (int x, int y, PhColor col)
 Set pixel.
PhColor getPixel (int x, int y)
 Get pixel.
bool bindTexture ()
 Bind texture.

Protected Attributes

GLuint texture
 Pointer to the OpenGL Texture.
PhTextureManagertxtmgr
 Pointer to the texture manager.
int width
 Width of the texture.
int height
 Height of the texture.
unsigned char * data
 Data used during texture manipulation.
std::string name
 The texture's name.


Detailed Description

Texture class.

Provides a wrapper to OpenGL textures.


Constructor & Destructor Documentation

phoenix::PhTexture::PhTexture ( PhTextureManager t  ) 

Constructor.

Simple constructor that makes a texture object that contains no texture.

Parameters:
t A pointer to the texture manager (for garbage collection).

phoenix::PhTexture::PhTexture ( PhTextureManager t,
int  a,
int  b 
)

Constructor.

Constructor that creates a texture object with the given dimensions.

Parameters:
t A pointer to the texture manager (for garbage collection).
a The width of the texture.
b The height of the texture.

phoenix::PhTexture::~PhTexture (  ) 

Destructor.

Destroys this texture object and deletes the OpenGL texture.


Member Function Documentation

void phoenix::PhTexture::setTexture ( GLuint  text  ) 

Set texture.

Sets the OpenGL texture identifier of this texture object. Should never be called directly by the user, but can be used by custom image loading routines.

Parameters:
text An OpenGL texture identifier.
See also:
getTexture()

GLuint phoenix::PhTexture::getTexture (  ) 

Get texture.

Returns:
The openGL texture identifier stored by this object.

void phoenix::PhTexture::setName ( std::string  nm  ) 

Set name.

Sets a name for this texture, can be used by the user to keep track of textures.

Parameters:
nm The name of the string (It is usually the filename of the texture loaded).
See also:
setName(), phoenix::PhTextureManager

std::string phoenix::PhTexture::getName (  ) 

Get name.

Gets the name of this texture.

Returns:
A string containing the name of this texture.
See also:
getName(), phoenix::PhTextureManager

void phoenix::PhTexture::setModified ( bool  a  ) 

Set modified.

Overrides the modifed value.

Parameters:
a The new modified value.
See also:
getModified()

bool phoenix::PhTexture::getModified (  ) 

Get modified.

Returns true if the texture has been modified by the setPixel() command.

Returns:
True if the texture has been modified.
See also:
setModified(), setPixel()

void phoenix::PhTexture::setWidth ( int  var  ) 

Set width.

Changes the width of the current texture (Power of 2).

Parameters:
var The new width.
See also:
getWidth()

int phoenix::PhTexture::getWidth (  ) 

Get width.

Returns:
The current width of the texture.
See also:
setWidth()

void phoenix::PhTexture::setHeight ( int  var  ) 

Set height.

Changes the height of the current texture (Power of 2).

Parameters:
var The new height.
See also:
getHeight()

int phoenix::PhTexture::getHeight (  ) 

Get height.

Returns:
The current height of the texture.
See also:
setHeight()

bool phoenix::PhTexture::lockTexture (  ) 

Lock texture.

Locks the texture. Before getPixel() or setPixel() can be called, this must be called first.

Returns:
True if it was able to lock the texture.
See also:
unlockTexture(), setPixel(), getPixel()

void phoenix::PhTexture::unlockTexture (  ) 

Unlock texture.

Unlocks the texture. It transfers all the texture data back into video memory. This must be called after the user is done modifying the texture with setPixel().

See also:
lockTexture(), setPixel(), getPixel()

void phoenix::PhTexture::setPixel ( int  x,
int  y,
PhColor  col 
)

Set pixel.

Changes a pixel to the given color. lockTexture() must be called before this is possible.

Parameters:
x X value of the pixel.
y Y value of the pixel.
col The new color of the pixel.
See also:
getPixel(), lockTexture()

PhColor phoenix::PhTexture::getPixel ( int  x,
int  y 
)

Get pixel.

Gives the color of the given pixel. lockTexture() must be called before this is possible.

Parameters:
x X value of the pixel.
y Y value of the pixel.
Returns:
The color of the pixel at position (x,y)
See also:
setPixel(), lockTexture()

bool phoenix::PhTexture::bindTexture (  ) 

Bind texture.

Binds this texture as the current openGL texture use for drawing.

Returns:
True if it was able to bind.


Member Data Documentation

unsigned char* phoenix::PhTexture::data [protected]

Data used during texture manipulation.

See also:
lockTexture(),unlockTexture(),setPixel(),getPixel()


The documentation for this class was generated from the following file:
Generated on Tue Nov 20 21:59:25 2007 for Phoenix by  doxygen 1.5.4