ContRap-Libraries
|
Class Texture provides basic functions to assign and load a texture. More...
#include <gltexture.h>
Public Types | |
enum | Format { GRAYVALUE, RGB, ARGB, RGBA } |
Enumerates raw data formats. More... | |
Public Member Functions | |
GLTexture () | |
Creates an empty unbinded texture. | |
GLTexture (std::string file_name) | |
Constructor loads the texture. | |
~GLTexture () | |
Destructor. | |
void | make_current () const |
Makes the texture current by binding it. | |
int | get_height () const |
Returns the height of the bitmap. | |
int | get_width () const |
Returns the width of the bitmap. | |
void | set_data (int width, int height, char *pixels, Format format) |
Creates the texture from raw data. | |
unsigned char * | get_data () |
Returns a pointer to the byte data of the bitmap. | |
bool | is_active () const |
Retuns true if the texture is active. | |
unsigned int | get_texture_handle () const |
Returns the texture number handle. | |
bool | load (const std::string &file_name) |
Loader, which automatically selects the type of the image. |
Class Texture provides basic functions to assign and load a texture.
The textures are light-weighted objects. They do not copy the bitmap data, but rely on the OpenGL implementation to copy the data to the graphic chip memory.
crp::GLTexture::GLTexture | ( | ) |
Creates an empty unbinded texture.
crp::GLTexture::GLTexture | ( | std::string | file_name | ) |
Constructor loads the texture.
file_name | is the name of the texture file. |
crp::GLTexture::~GLTexture | ( | ) |
Destructor.
unsigned char* crp::GLTexture::get_data | ( | ) |
Returns a pointer to the byte data of the bitmap.
int crp::GLTexture::get_height | ( | ) | const |
Returns the height of the bitmap.
unsigned int crp::GLTexture::get_texture_handle | ( | ) | const |
Returns the texture number handle.
int crp::GLTexture::get_width | ( | ) | const |
Returns the width of the bitmap.
bool crp::GLTexture::is_active | ( | ) | const [inline] |
Retuns true if the texture is active.
bool crp::GLTexture::load | ( | const std::string & | file_name | ) |
Loader, which automatically selects the type of the image.
file_name | Name of the file |
void crp::GLTexture::make_current | ( | ) | const |
Makes the texture current by binding it.
void crp::GLTexture::set_data | ( | int | width, |
int | height, | ||
char * | pixels, | ||
Format | format | ||
) |
Creates the texture from raw data.
width | Width of the texture |
height | Height of the texture |
pixels | Raw texture data coded in ARGB |