#include <Texture.hpp>
A texture loaded from a file into the GPU. This class support the move and copy operators. Its underlying GPU texture is refcounted and released when then last smk::Texture is deleted.
The SMK library uses the stb_image. So it supports the same image types:
Definition at line 38 of file Texture.hpp.
Classes | |
| struct | Option |
Public Member Functions | |
| Texture () | |
| The null texture. More... | |
| Texture (const std::string &filename) | |
| Load a texture from a file. More... | |
| Texture (const std::string &filename, const Option &option) | |
| Load a texture from a file. More... | |
| Texture (const uint8_t *data, int width, int height) | |
| Load a texture from memory (RAM) More... | |
| Texture (const uint8_t *data, int width, int height, const Option &option) | |
| Load a texture from memory (RAM) More... | |
| Texture (GLuint id, int width, int height) | |
| Import an already loaded texture. Useful. More... | |
| void | Bind (GLuint active_texture=GL_TEXTURE0) const |
| int | width () const |
| Access the width of the texture. More... | |
| int | height () const |
| Access the height of the texture. More... | |
| GLuint | id () const |
| Access the ID of the texture. More... | |
| operator bool () const | |
| Texture (Texture &&) noexcept | |
| Texture (const Texture &) | |
| Texture & | operator= (Texture &&) noexcept |
| Texture & | operator= (const Texture &) |
| bool | operator== (const Texture &other) const |
| bool | operator!= (const Texture &other) const |
| struct smk::Texture::Option |
Definition at line 40 of file Texture.hpp.
| Class Members | ||
|---|---|---|
| GLint | format | |
| bool | generate_mipmap | |
| GLint | internal_format | |
| GLint | mag_filter | |
| GLint | min_filter | |
| GLint | type | |
| GLint | wrap_s | |
| GLint | wrap_t | |
|
default |
The null texture.
| smk::Texture::Texture | ( | const std::string & | filename | ) |
Load a texture from a file.
| filename | The file name of the image to be loaded |
Definition at line 30 of file Texture.cpp.
| smk::Texture::Texture | ( | const std::string & | filename, |
| const Option & | option | ||
| ) |
Load a texture from a file.
| filename | The file name of the image to be loaded. |
| option | Additionnal option (texture wrap, min filter, mag filter, ...) |
Definition at line 35 of file Texture.cpp.
| smk::Texture::Texture | ( | const uint8_t * | data, |
| int | width, | ||
| int | height | ||
| ) |
Load a texture from memory (RAM)
| data | The memory area to read the image from. |
| width | the image's with. |
| height | the image's height. |
Definition at line 69 of file Texture.cpp.
| smk::Texture::Texture | ( | const uint8_t * | data, |
| int | width, | ||
| int | height, | ||
| const Option & | option | ||
| ) |
Load a texture from memory (RAM)
| data | The memory area to read the image from. |
| width | the image's with. |
| height | the image's height. |
| option | Additionnal option (texture wrap, min filter, mag filter, ...) |
Definition at line 77 of file Texture.cpp.
| smk::Texture::Texture | ( | GLuint | id, |
| int | width, | ||
| int | height | ||
| ) |
Import an already loaded texture. Useful.
| id | The OpenGL identifier of the loaded texture. |
| width | the image's with. |
| height | the image's height. |
Definition at line 110 of file Texture.cpp.
| smk::Texture::~Texture | ( | ) |
Definition at line 115 of file Texture.cpp.
|
noexcept |
Definition at line 141 of file Texture.cpp.
| smk::Texture::Texture | ( | const Texture & | other | ) |
Definition at line 145 of file Texture.cpp.
| void smk::Texture::Bind | ( | GLuint | active_texture = GL_TEXTURE0 | ) | const |
Definition at line 180 of file Texture.cpp.
| int smk::Texture::height | ( | ) | const |
Access the height of the texture.
Definition at line 201 of file Texture.cpp.
| GLuint smk::Texture::id | ( | ) | const |
Access the ID of the texture.
Definition at line 207 of file Texture.cpp.
|
inline |
Definition at line 65 of file Texture.hpp.
| bool smk::Texture::operator!= | ( | const Texture & | other | ) | const |
Definition at line 189 of file Texture.cpp.
Definition at line 158 of file Texture.cpp.
Definition at line 149 of file Texture.cpp.
| bool smk::Texture::operator== | ( | const Texture & | other | ) | const |
Definition at line 185 of file Texture.cpp.
| int smk::Texture::width | ( | ) | const |
Access the width of the texture.
Definition at line 195 of file Texture.cpp.