Track::Texture Class Reference

Wrapper for OpenGL Texture object. More...

#include <Texture.h>

Inheritance diagram for Track::Texture:

Graphics::CubeMap List of all members.

Public Member Functions

 Texture (std::istream &source)
 Load filename from a stream.
 Texture (std::string filename)
 Take given filename.
 Texture ()
virtual ~Texture ()
const std::string & get_filename () const
 Get a reference to the filename containing the texture's image data.
virtual void bind () const
 Bind the texture so it can be used in OpenGL.
void make_cache () const
 Load the texture without binding it.

Protected Member Functions

GLuint * load_gl_texture () const
 Create the OpenGL texture obect.
virtual void load_from_file () const
 Load the file and specify mipmap textures from it.

Static Protected Member Functions

static void delete_gl_texture (GLuint *texture)
 Delete the OpenGL texture object with the given name.

Protected Attributes

std::string m_filename
 filename for the texture.
GLuint m_texture_name
 OpenGL texture name.
boost::shared_ptr< GLuint > m_texture_name_ref
 Reference counter for the texture name.
GLenum m_target
 OpenGL texture target, normally GL_TEXTURE_2D.
unsigned int m_width
 Number of texels horizontally across the image.
unsigned int m_height
 Number of texels vertically across the image.
bool m_has_alpha
 True if the texture has an alpha component, false otherwise.

Detailed Description

Wrapper for OpenGL Texture object.

Also loads images from a file. Can find the filename from a stream.

Definition at line 26 of file Texture.h.


Constructor & Destructor Documentation

Track::Texture::Texture ( std::istream &  source  ) 

Load filename from a stream.

Definition at line 22 of file Texture.cpp.

Track::Texture::Texture ( std::string  filename  ) 

Take given filename.

Definition at line 29 of file Texture.cpp.

Track::Texture::Texture (  ) 

Definition at line 36 of file Texture.cpp.

Track::Texture::~Texture (  )  [virtual]

Definition at line 42 of file Texture.cpp.


Member Function Documentation

void Track::Texture::bind (  )  const [virtual]

Bind the texture so it can be used in OpenGL.

Definition at line 52 of file Texture.cpp.

void Track::Texture::delete_gl_texture ( GLuint *  texture  )  [static, protected]

Delete the OpenGL texture object with the given name.

This is static to meet boost::shared_ptr requirements.

Parameters:
texture pointer to the name of the texture object to delete.

Definition at line 69 of file Texture.cpp.

const std::string & Track::Texture::get_filename (  )  const

Get a reference to the filename containing the texture's image data.

Definition at line 47 of file Texture.cpp.

void Track::Texture::load_from_file (  )  const [protected, virtual]

Load the file and specify mipmap textures from it.

Todo:
implement loading paletted images.

Todo:
swizzle.

Definition at line 85 of file Texture.cpp.

GLuint * Track::Texture::load_gl_texture (  )  const [protected]

Create the OpenGL texture obect.

Returns:
the name of the texture object. This value is also assigned to m_texture_name.

Definition at line 74 of file Texture.cpp.

void Track::Texture::make_cache (  )  const

Load the texture without binding it.

Loads the image file into an OpenGL texture. After the texture has been loaded, has no effect. Requires an OpenGL context.

Definition at line 61 of file Texture.cpp.


Member Data Documentation

std::string Track::Texture::m_filename [protected]

filename for the texture.

Definition at line 49 of file Texture.h.

bool Track::Texture::m_has_alpha [mutable, protected]

True if the texture has an alpha component, false otherwise.

Definition at line 75 of file Texture.h.

unsigned int Track::Texture::m_height [mutable, protected]

Number of texels vertically across the image.

Definition at line 73 of file Texture.h.

GLenum Track::Texture::m_target [mutable, protected]

OpenGL texture target, normally GL_TEXTURE_2D.

Definition at line 68 of file Texture.h.

GLuint Track::Texture::m_texture_name [mutable, protected]

OpenGL texture name.

Definition at line 58 of file Texture.h.

boost::shared_ptr<GLuint> Track::Texture::m_texture_name_ref [mutable, protected]

Reference counter for the texture name.

When there are no more users, the OpenGL texture is deleted using this. The OpenGL texture object remains until all copies of the object that created it have been destroyed.

Definition at line 65 of file Texture.h.

unsigned int Track::Texture::m_width [mutable, protected]

Number of texels horizontally across the image.

Definition at line 71 of file Texture.h.


The documentation for this class was generated from the following files:
Get Racer at SourceForge.net. Fast, secure and Free Open Source software downloads

Generated at Mon Sep 6 00:41:19 2010 by Doxygen version 1.4.7 for Racer version svn335.