LibCarna Version 3.4.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
LibCarna::base::Texture< dimension > Class Template Reference

Represents an OpenGL texture object. This class realizes the RAII-idiom. More...

#include <Texture.hpp>

+ Inheritance diagram for LibCarna::base::Texture< dimension >:
+ Collaboration diagram for LibCarna::base::Texture< dimension >:

Public Types

typedef Eigen::Matrix< unsigned int, dimension, 1 > Resolution
 

Public Member Functions

 Texture (int internalFormat, int pixelFormat)
 Creates OpenGL texture object.
 
const Resolutionsize () const
 Tells the resolution of this texture.
 
bool isValid () const
 Tells whether the texture has been initialized, i.e. it has a size.
 
void bind (unsigned int unit) const
 Binds this texture to unit. Consider using TextureBase::SETUP_UNIT if you're binding the texture temporarily.
 
void update (const Resolution &size, int bufferType, const void *bufferPtr)
 
void update (const Resolution &size)
 
- Public Member Functions inherited from LibCarna::base::TextureBase
virtual ~TextureBase ()
 Deletes the maintained OpenGL texture object.
 

Public Attributes

const int internalFormat
 Holds the number of color components in the texture, e.g. GL_RGBA8UI or GL_INTENSITY16.
 
const int pixelFormat
 Holds the format of the pixel data, e.g. GL_RED, GL_RGB or GL_RGBA.
 
- Public Attributes inherited from LibCarna::base::TextureBase
const unsigned int id
 Holds the ID of the represented OpenGL texture object.
 

Static Public Attributes

static const unsigned int DIMENSION = dimension
 Holds the dimension of this texture.
 
- Static Public Attributes inherited from LibCarna::base::TextureBase
static const unsigned int SETUP_UNIT = 0
 Texture unit that is fine to be used for temporal bindings, i.e. for setting textures up. This unit shouldn't be used for lasting bindings.
 

Additional Inherited Members

- Static Public Member Functions inherited from LibCarna::base::TextureBase
static unsigned int maxTextureSize ()
 Queries GL_MAX_TEXTURE_SIZE from the current GL context.
 
- Protected Member Functions inherited from LibCarna::base::TextureBase
 TextureBase ()
 Creates OpenGL texture object.
 
void uploadGLTextureData (const Eigen::Matrix< unsigned int, 1, 1 > &size, int internalFormat, int pixelFormat, int bufferType, const void *bufferPtr)
 Wraps glTexImage1d.
 
void uploadGLTextureData (const math::Vector2ui &size, int internalFormat, int pixelFormat, int bufferType, const void *bufferPtr)
 Wraps glTexImage2d.
 
void uploadGLTextureData (const math::Vector3ui &size, int internalFormat, int pixelFormat, int bufferType, const void *bufferPtr)
 Wraps glTexImage3d.
 

Detailed Description

template<unsigned int dimension>
class LibCarna::base::Texture< dimension >

Represents an OpenGL texture object. This class realizes the RAII-idiom.

Author
Leonid Kostrykin

Definition at line 159 of file Texture.hpp.

Member Typedef Documentation

◆ Resolution

template<unsigned int dimension>
typedef Eigen::Matrix< unsigned int, dimension, 1 > LibCarna::base::Texture< dimension >::Resolution

Holds the resolution type of this texture.

Definition at line 166 of file Texture.hpp.

Constructor & Destructor Documentation

◆ Texture()

template<unsigned int dimension>
LibCarna::base::Texture< dimension >::Texture ( int  internalFormat,
int  pixelFormat 
)

Creates OpenGL texture object.

Postcondition
isValid() == false
Parameters
internalFormatspecifies the number of color components in the texture, e.g. GL_RGBA8UI or GL_INTENSITY16.
pixelFormatspecifies the format of the pixel data, e.g. GL_RED, GL_RGB or GL_RGBA.
See also
Valid values for the parameters are available here: https://www.opengl.org/sdk/docs/man3/xhtml/glTexImage3D.xml

Definition at line 243 of file Texture.hpp.

Member Function Documentation

◆ bind()

template<unsigned int dimension>
void LibCarna::base::Texture< dimension >::bind ( unsigned int  unit) const

Binds this texture to unit. Consider using TextureBase::SETUP_UNIT if you're binding the texture temporarily.

Definition at line 253 of file Texture.hpp.

◆ isValid()

template<unsigned int dimension>
bool LibCarna::base::Texture< dimension >::isValid ( ) const

Tells whether the texture has been initialized, i.e. it has a size.

Definition at line 260 of file Texture.hpp.

◆ size()

template<unsigned int dimension>
const Eigen::Matrix< unsigned int, dimension, 1 > & LibCarna::base::Texture< dimension >::size ( ) const

Tells the resolution of this texture.

Precondition
isValid() == true

Definition at line 267 of file Texture.hpp.

◆ update() [1/2]

template<unsigned int dimension>
void LibCarna::base::Texture< dimension >::update ( const Resolution size)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 299 of file Texture.hpp.

◆ update() [2/2]

template<unsigned int dimension>
void LibCarna::base::Texture< dimension >::update ( const Resolution size,
int  bufferType,
const void bufferPtr 
)

Binds this texture to TextureBase::SETUP_UNIT, updates its size and data.

Postcondition
isValid() == true
Parameters
sizeis the new resolution of this texture.
bufferTypespecifies the data type of the pixel data pointed to by bufferPtr.
bufferPtrpoints to the pixel data that will be uploaded to the texture.

No data is uploaded to the texture if nullptr is given for bufferPtr. The value of bufferType has no meaning than.

Definition at line 275 of file Texture.hpp.

Member Data Documentation

◆ DIMENSION

template<unsigned int dimension>
const unsigned int LibCarna::base::Texture< dimension >::DIMENSION = dimension
static

Holds the dimension of this texture.

Definition at line 190 of file Texture.hpp.

◆ internalFormat

template<unsigned int dimension>
const int LibCarna::base::Texture< dimension >::internalFormat

Holds the number of color components in the texture, e.g. GL_RGBA8UI or GL_INTENSITY16.

Definition at line 203 of file Texture.hpp.

◆ pixelFormat

template<unsigned int dimension>
const int LibCarna::base::Texture< dimension >::pixelFormat

Holds the format of the pixel data, e.g. GL_RED, GL_RGB or GL_RGBA.

Definition at line 204 of file Texture.hpp.


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