ClanSoft logo
ClanSoft logo
Entire Class Index Main Class Index Cross Index Global Index

Class CL_Texture

Texture loading class for OpenGL.
Contained in: global
Derived from: none
Derived by: none
Group: GL (OpenGL)

#include <ClanLib/gl.h>


public function member index:

Construction:

static CL_Texture* create(CL_SurfaceProvider* provider, bool delete_provider=false);
static CL_Texture* load(const std::string& id, CL_ResourceManager* manager);
virtual ~CL_Texture();

Attributes:

virtual CL_SurfaceProvider* get_provider() const;
virtual void reload();
virtual int get_width() const;
virtual int get_height() const;
virtual int get_num_frames() const;

Operations:

virtual void bind(int texture_no=0);
virtual void flush(CL_DisplayCard* card = NULL);
 

Description:

This class can load the image(s) from surface provider into OpenGL textures.

This class works just like a CL_Surface, except that it requires the image width to be 2^n.


Function Member Descriptions:

CL_Texture::bind - Bind the texture in OpenGL.
virtual void bind(int texture_no=0);
texture_no - Subframe in the provider to bind.



CL_Texture::create - Creates a texture from a surface provider.
static CL_Texture* create(CL_SurfaceProvider* provider, bool delete_provider=false);
provider - Surface provider to use as image source.
delete_provider - If true, surface provider will be deleted
when the texture is deleted.



CL_Texture::flush - completely flushes textures (removes from video/system-memory)
virtual void flush(CL_DisplayCard* card = NULL);


CL_Texture::get_height - Returns the height of the texture
virtual int get_height() const;
Returns - Height of the texture.



CL_Texture::get_num_frames - Returns the number of subtextures in the texture
virtual int get_num_frames() const;
Returns - Number of subtextures in texture.



CL_Texture::get_provider - Returns the surface provider.
virtual CL_SurfaceProvider* get_provider() const;


CL_Texture::get_width - Returns the width of the surface
virtual int get_width() const;
Returns - Width of the texture.



CL_Texture::load - Load the texture from a surface resource.
static CL_Texture* load(const std::string& id, CL_ResourceManager* manager);
id - Resource ID of the surface resource.
manager - Resource manager used to load the resource from.



CL_Texture::reload - Forces surface to reload texture data from provider.
virtual void reload();


CL_Texture::~CL_Texture - Texture Destructor
virtual ~CL_Texture();