Carna
Version 3.0.1
|
Represents an OpenGL texture object. This class realizes the RAII-idiom. More...
#include <Texture.h>
Public Types | |
typedef Eigen::Matrix< unsigned int, dimension, 1 > | Resolution |
Public Member Functions | |
Texture (int internalFormat, int pixelFormat) | |
Creates OpenGL texture object. More... | |
const Resolution & | size () const |
Tells the resolution of this texture. More... | |
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) |
![]() | |
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 . | |
![]() | |
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 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 | |
![]() | |
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 . | |
![]() | |
template<unsigned int dimension> | |
void | bindGLTextureObject (unsigned int unit, unsigned int id) |
Binds OpenGL texture object id to texture unit. For internal usage only, use Texture::bind instead. | |
Represents an OpenGL texture object. This class realizes the RAII-idiom.
typedef Eigen::Matrix< unsigned int, dimension, 1 > Carna::base::Texture< dimension >::Resolution |
Carna::base::Texture< dimension >::Texture | ( | int | internalFormat, |
int | pixelFormat | ||
) |
Creates OpenGL texture object.
isValid() == false
internalFormat | specifies the number of color components in the texture, e.g. GL_RGBA8UI or GL_INTENSITY16 . |
pixelFormat | specifies the format of the pixel data, e.g. GL_RED , GL_RGB or GL_RGBA . |
const Eigen::Matrix< unsigned int, dimension, 1 > & Carna::base::Texture< dimension >::size | ( | ) | const |
void Carna::base::Texture< dimension >::update | ( | const Resolution & | size, |
int | bufferType, | ||
const void * | bufferPtr | ||
) |
Binds this texture to TextureBase::SETUP_UNIT, updates its size and data.
isValid() == true
size | is the new resolution of this texture. |
bufferType | specifies the data type of the pixel data pointed to by bufferPtr. |
bufferPtr | points 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.
void Carna::base::Texture< dimension >::update | ( | const Resolution & | size | ) |
Documentation generated by Doxygen