Vis 2 Demo  1.0
Technical illustration type real-time rendering of geometry
 All Classes Namespaces Files Functions Variables Typedefs Macros
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
vis2::Texture Class Reference

This class manages textures. More...

Public Member Functions

 Texture ()
 Empty constructor. More...
 
 Texture (const std::string &_str_path)
 Constructor for creating a texture from a JPEG file. More...
 
 Texture (const unsigned int _width, const unsigned int _height, const unsigned int _type)
 Constructor for creating an empty texture for rendering. More...
 
 ~Texture ()
 Destructor. More...
 
void textureBind (const int _unit)
 This function binds texture as a source. More...
 
void textureBind2FBO (const int _unit)
 This function binds texture to a bound FBO as a rendering target. More...
 
unsigned int getTextureType () const
 getter for the texture attributes: type More...
 
unsigned int getTextureWidth () const
 getter for the texture attributes: width More...
 
unsigned int getTextureHeight () const
 getter for the texture attributes: height More...
 

Static Public Member Functions

static void initDevIL ()
 Function for calling the DevIL library. More...
 

Private Member Functions

void loadTextureFromFile (const std::string _file_path)
 Hidden copy-constructor. More...
 
 Texture (const Texture &)
 

Private Attributes

ILuint image_data_handle
 is the id of this texture data as implemented by DevIL More...
 
GLuint texture_handle
 is the id of this texture on the Graphics Card More...
 
unsigned int texture_type
 holds the type of the texture More...
 
unsigned int texture_width
 holds the width of the texture More...
 
unsigned int texture_height
 holds the height of the texture More...
 

Detailed Description

This class manages textures.

This class contains functionality for loading textures from JPEG files
as well as creating empty textures for rendering.

Definition at line 19 of file Texture.h.

Constructor & Destructor Documentation

vis2::Texture::Texture ( )
inline

Empty constructor.

Definition at line 23 of file Texture.h.

Texture::Texture ( const std::string &  _str_path)

Constructor for creating a texture from a JPEG file.

This constructor laods the texture to the Graphics Card
and defines interpolation parameters and calls mipmap generation.

Parameters
[in]_str_pathis the path to the JPEG file

Definition at line 6 of file Texture.cpp.

Texture::Texture ( const unsigned int  _width,
const unsigned int  _height,
const unsigned int  _type 
)

Constructor for creating an empty texture for rendering.

Color textures have GLRGB8 or GL_RGBA8 format, depth textures have GL_DEPTH_COMPONENT32F format.

Parameters
[in]_widthis the width of the new texture,
[in]_heightis the height of the new texture,
[in]_typecan be VIS2_TEX_TYPE_RGB, VIS2_TEX_TYPE_RGBA or VIS2_TEX_TYPE_DEPTH.

Definition at line 30 of file Texture.cpp.

Texture::~Texture ( )

Destructor.

Definition at line 73 of file Texture.cpp.

vis2::Texture::Texture ( const Texture )
private

Member Function Documentation

unsigned int vis2::Texture::getTextureHeight ( ) const
inline

getter for the texture attributes: height

Returns
the texture height

Definition at line 60 of file Texture.h.

unsigned int vis2::Texture::getTextureType ( ) const
inline

getter for the texture attributes: type

Returns
the texture type

Definition at line 54 of file Texture.h.

unsigned int vis2::Texture::getTextureWidth ( ) const
inline

getter for the texture attributes: width

Returns
the texture width

Definition at line 57 of file Texture.h.

static void vis2::Texture::initDevIL ( )
static

Function for calling the DevIL library.

void Texture::loadTextureFromFile ( const std::string  _file_path)
private

Hidden copy-constructor.

Parameters
[in]isthe path to the file on the local system

Definition at line 106 of file Texture.cpp.

void Texture::textureBind ( const int  _unit)

This function binds texture as a source.

Definition at line 81 of file Texture.cpp.

void Texture::textureBind2FBO ( const int  _unit)

This function binds texture to a bound FBO as a rendering target.

Parameters
[in]_unitis the id of the color or depth attachment, to which to bind the texture

Definition at line 87 of file Texture.cpp.

Member Data Documentation

ILuint vis2::Texture::image_data_handle
private

is the id of this texture data as implemented by DevIL

Definition at line 67 of file Texture.h.

GLuint vis2::Texture::texture_handle
private

is the id of this texture on the Graphics Card

Definition at line 70 of file Texture.h.

unsigned int vis2::Texture::texture_height
private

holds the height of the texture

This function calls DevIL to load image data from a file

Definition at line 73 of file Texture.h.

unsigned int vis2::Texture::texture_type
private

holds the type of the texture

Definition at line 71 of file Texture.h.

unsigned int vis2::Texture::texture_width
private

holds the width of the texture

Definition at line 72 of file Texture.h.


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