ContRap-Libraries
Public Types | Public Member Functions

crp::GLTexture Class Reference

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.

Detailed Description

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.

Author:
Aless Lasaruk <lasaruk@fmi.uni-passau.de>

Member Enumeration Documentation

Enumerates raw data formats.

Enumerator:
GRAYVALUE 
RGB 
ARGB 
RGBA 

Constructor & Destructor Documentation

crp::GLTexture::GLTexture ( )

Creates an empty unbinded texture.

crp::GLTexture::GLTexture ( std::string  file_name)

Constructor loads the texture.

Parameters:
file_nameis the name of the texture file.
crp::GLTexture::~GLTexture ( )

Destructor.


Member Function Documentation

unsigned char* crp::GLTexture::get_data ( )

Returns a pointer to the byte data of the bitmap.

Returns:
a pointer to the byte data of the bitmap.
int crp::GLTexture::get_height ( ) const

Returns the height of the bitmap.

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.

Returns:
the width of the bitmap.
bool crp::GLTexture::is_active ( ) const [inline]

Retuns true if the texture is active.

Returns:
true if the texture is active.
bool crp::GLTexture::load ( const std::string &  file_name)

Loader, which automatically selects the type of the image.

Parameters:
file_nameName of the file
Returns:
True iff loading was successfull
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.

Parameters:
widthWidth of the texture
heightHeight of the texture
pixelsRaw texture data coded in ARGB

The documentation for this class was generated from the following file: