![]() |
LibCarna Version 3.4.0
|
Represents an OpenGL texture object. This class realizes the RAII-idiom. More...
#include <Texture.hpp>
Public Types | |
typedef Eigen::Matrix< unsigned int, dimension, 1 > | Resolution |
Public Member Functions | |
Texture (int internalFormat, int pixelFormat) | |
Creates OpenGL texture object. | |
const Resolution & | size () 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) |
![]() | |
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 | |
![]() | |
static unsigned int | maxTextureSize () |
Queries GL_MAX_TEXTURE_SIZE from the current GL context. | |
![]() | |
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.
Definition at line 159 of file Texture.hpp.
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.
LibCarna::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 . |
Definition at line 243 of file Texture.hpp.
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.
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.
const Eigen::Matrix< unsigned int, dimension, 1 > & LibCarna::base::Texture< dimension >::size | ( | ) | const |
Tells the resolution of this texture.
isValid() == true
Definition at line 267 of file Texture.hpp.
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.
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.
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.
Definition at line 275 of file Texture.hpp.
Holds the dimension of this texture.
Definition at line 190 of file Texture.hpp.
Holds the number of color components in the texture, e.g. GL_RGBA8UI
or GL_INTENSITY16
.
Definition at line 203 of file Texture.hpp.
Holds the format of the pixel data, e.g. GL_RED
, GL_RGB
or GL_RGBA
.
Definition at line 204 of file Texture.hpp.
Written by Leonid Kostrykin © 2021–2025. Based on Carna (© 2010-2016).
Documentation generated by Doxygen