Texture class to wrap OpenGL texture object.
More...
#include <texture.hpp>
|
| | Texture (const Eigen::Vector2i &size, GLuint internal_format, GLuint format, GLuint type, const void *pixels=nullptr) |
| | Constructor.
|
| | ~Texture () |
| | Texture (const Texture &temp_obj)=delete |
| Texture & | operator= (const Texture &temp_obj)=delete |
| GLuint | id () const |
| | Texture ID.
|
| Eigen::Vector2i | size () const |
| | Texture size.
|
| void | set_size (const Eigen::Vector2i &size) |
| | Change the size of the texture. This will invalidate the texture data and change the texture ID.
|
| void | bind () const |
| | Bind the texture.
|
| void | bind (GLenum target) const |
| | Bind the texture to the specified target (e.g., GL_TEXTURE0).
|
| void | unbind () const |
| | Unbind the texture.
|
| void | unbind (GLenum target) const |
| | Unbind the texture from the specified target (e.g., GL_TEXTURE0).
|
| const Texture & | set_filer_mode (GLenum mode) const |
| | Set the filtering mode of the texture (e.g., GL_LINEAR, GL_NEAREST).
|
| const Texture & | set_clamp_mode (GLenum mode) const |
| | Set the clamping mode of the texture (e.g., GL_CLAMP_TO_EDGE, GL_REPEAT).
|
| template<typename T> |
| std::vector< T > | read_pixels (GLuint format=GL_RGBA, GLuint type=GL_UNSIGNED_BYTE, int num_elements=4) const |
| | Read the pixel data from the texture into a vector.
|
Texture class to wrap OpenGL texture object.
◆ Texture() [1/2]
| glk::Texture::Texture |
( |
const Eigen::Vector2i & | size, |
|
|
GLuint | internal_format, |
|
|
GLuint | format, |
|
|
GLuint | type, |
|
|
const void * | pixels = nullptr ) |
Constructor.
- Note
- Default filter mode is GL_LINEAR, and default clamp mode is GL_CLAMP_TO_EDGE.
- Parameters
-
| size | Size (width, height) |
| internal_format | Internal format of the texture (e.g., GL_RGBA8) |
| format | Format of the pixel data (e.g., GL_RGBA) |
| type | Data type of the pixel data (e.g., GL_UNSIGNED_BYTE) |
| pixels | Pointer to the pixel data. If nullptr, the texture is created but not initialized. |
◆ ~Texture()
| glk::Texture::~Texture |
( |
| ) |
|
◆ Texture() [2/2]
| glk::Texture::Texture |
( |
const Texture & | temp_obj | ) |
|
|
delete |
◆ bind() [1/2]
| void glk::Texture::bind |
( |
| ) |
const |
◆ bind() [2/2]
| void glk::Texture::bind |
( |
GLenum | target | ) |
const |
Bind the texture to the specified target (e.g., GL_TEXTURE0).
◆ id()
| GLuint glk::Texture::id |
( |
| ) |
const |
◆ operator=()
◆ read_pixels()
template<typename T>
| std::vector< T > glk::Texture::read_pixels |
( |
GLuint | format = GL_RGBA, |
|
|
GLuint | type = GL_UNSIGNED_BYTE, |
|
|
int | num_elements = 4 ) const |
Read the pixel data from the texture into a vector.
- Template Parameters
-
| T | Data type of the pixel data to read (uint8, uint16, int32, uint32, or float) |
- Parameters
-
| format | Format of the pixel data to read (e.g., GL_RGBA, GL_RGB, GL_RED) |
| type | Data type of the pixel data to read (e.g., GL_UNSIGNED_BYTE, GL_FLOAT) |
| num_elements | Number of elements per pixel (e.g., 4 for RGBA, 3 for RGB, 1 for RED) |
- Returns
- Loaded pixel data.
◆ set_clamp_mode()
| const Texture & glk::Texture::set_clamp_mode |
( |
GLenum | mode | ) |
const |
Set the clamping mode of the texture (e.g., GL_CLAMP_TO_EDGE, GL_REPEAT).
◆ set_filer_mode()
| const Texture & glk::Texture::set_filer_mode |
( |
GLenum | mode | ) |
const |
Set the filtering mode of the texture (e.g., GL_LINEAR, GL_NEAREST).
◆ set_size()
| void glk::Texture::set_size |
( |
const Eigen::Vector2i & | size | ) |
|
Change the size of the texture. This will invalidate the texture data and change the texture ID.
◆ size()
| Eigen::Vector2i glk::Texture::size |
( |
| ) |
const |
◆ unbind() [1/2]
| void glk::Texture::unbind |
( |
| ) |
const |
◆ unbind() [2/2]
| void glk::Texture::unbind |
( |
GLenum | target | ) |
const |
Unbind the texture from the specified target (e.g., GL_TEXTURE0).
The documentation for this class was generated from the following file:
- /home/runner/work/iridescence/iridescence/include/glk/texture.hpp