#include <PhTexture.h>
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. | |
PhTextureManager * | txtmgr |
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. |
Provides a wrapper to OpenGL textures.
phoenix::PhTexture::PhTexture | ( | PhTextureManager * | t | ) |
Constructor.
Simple constructor that makes a texture object that contains no texture.
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.
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.
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.
text | An OpenGL texture identifier. |
GLuint phoenix::PhTexture::getTexture | ( | ) |
Get texture.
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.
nm | The name of the string (It is usually the filename of the texture loaded). |
std::string phoenix::PhTexture::getName | ( | ) |
Get name.
Gets the name of this texture.
void phoenix::PhTexture::setModified | ( | bool | a | ) |
Set modified.
Overrides the modifed value.
a | The new modified value. |
bool phoenix::PhTexture::getModified | ( | ) |
Get modified.
Returns true if the texture has been modified by the setPixel() command.
void phoenix::PhTexture::setWidth | ( | int | var | ) |
Set width.
Changes the width of the current texture (Power of 2).
var | The new width. |
int phoenix::PhTexture::getWidth | ( | ) |
void phoenix::PhTexture::setHeight | ( | int | var | ) |
Set height.
Changes the height of the current texture (Power of 2).
var | The new height. |
int phoenix::PhTexture::getHeight | ( | ) |
bool phoenix::PhTexture::lockTexture | ( | ) |
Lock texture.
Locks the texture. Before getPixel() or setPixel() can be called, this must be called first.
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().
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.
x | X value of the pixel. | |
y | Y value of the pixel. | |
col | The new color of the pixel. |
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.
x | X value of the pixel. | |
y | Y value of the pixel. |
bool phoenix::PhTexture::bindTexture | ( | ) |
Bind texture.
Binds this texture as the current openGL texture use for drawing.
unsigned char* phoenix::PhTexture::data [protected] |