Manages textures.
More...
#include <texture.h>
|
| void | set_parameter (GLenum name, int parameter) |
| | Sets a texture parameter.
|
| void | set_parameter (GLenum name, float parameter) |
| | Sets a texture parameter.
|
| void | set_parameter (GLenum name, float *parameter) |
| | Sets a texture parameter.
|
| virtual void | bind (unsigned int texture_unit=0)=0 |
| | Bind the texture to be used by the shader.
|
| virtual void | unbind (unsigned int texture_unit=0)=0 |
| | Unbind the texture.
|
| void | bind_image (GLuint unit, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format) |
| | Binds a level of a texture to an image unit.
|
|
| static void | add_path (std::string path) |
| | Adds a path to the list of paths to be searched for image files.
|
| static bool | store_texture (std::string name, std::shared_ptr< Texture > texture) |
| | Stores a texture object in an internal map using the name parameter as key (no duplicates)
|
| static std::shared_ptr< Texture > | find_texture (std::string name) |
| | Finds a texture in the internal map using the name as key.
|
|
| GLenum | target |
| | The texture target.
|
| GLuint | texture |
| | The texture name.
|
| unsigned int | width |
| | The width of the texture.
|
| unsigned int | height |
| | The height of the texture.
|
| unsigned int | num_layers |
| | The number of layers.
|
Manages textures.
Definition at line 13 of file texture.h.
◆ Texture()
◆ ~Texture()
◆ add_path()
| void Texture::add_path |
( |
std::string | path | ) |
|
|
static |
Adds a path to the list of paths to be searched for image files.
- Parameters
-
| path | The path to add to the list |
- Note
- To avoid duplicates this function first performs a search on existing entries.
Definition at line 47 of file texture.cpp.
◆ bind()
| virtual void sgltk::Texture::bind |
( |
unsigned int | texture_unit = 0 | ) |
|
|
pure virtual |
◆ bind_image()
| void Texture::bind_image |
( |
GLuint | unit, |
|
|
GLint | level, |
|
|
GLboolean | layered, |
|
|
GLint | layer, |
|
|
GLenum | access, |
|
|
GLenum | format ) |
Binds a level of a texture to an image unit.
- Parameters
-
| unit | The index of the image unit to which to bind the texture |
| level | The level of the texture that is to be bound |
| layered | Specifies whether a layered texture binding is to be established |
| layer | If layered is GL_FALSE, specifies the layer of texture to be bound to the image unit, ignored otherwise |
| access | Specifies the type of access that will be performed on the image |
| format | Specifies the format that the elements of the image will be treated as |
Definition at line 51 of file texture.cpp.
◆ find_texture()
| std::shared_ptr< Texture > Texture::find_texture |
( |
std::string | name | ) |
|
|
static |
Finds a texture in the internal map using the name as key.
- Parameters
-
| name | The key used to find the texture |
- Returns
- Returns a pointer to the found texture object or nullptr if no texture with such name could be found.
Definition at line 40 of file texture.cpp.
◆ set_parameter() [1/3]
| void Texture::set_parameter |
( |
GLenum | name, |
|
|
float * | parameter ) |
Sets a texture parameter.
- Parameters
-
| name | The name of the texture parameter |
| parameter | The parameter value |
Definition at line 30 of file texture.cpp.
◆ set_parameter() [2/3]
| void Texture::set_parameter |
( |
GLenum | name, |
|
|
float | parameter ) |
Sets a texture parameter.
- Parameters
-
| name | The name of the texture parameter |
| parameter | The parameter value |
Definition at line 24 of file texture.cpp.
◆ set_parameter() [3/3]
| void Texture::set_parameter |
( |
GLenum | name, |
|
|
int | parameter ) |
Sets a texture parameter.
- Parameters
-
| name | The name of the texture parameter |
| parameter | The parameter value |
Definition at line 18 of file texture.cpp.
◆ store_texture()
| bool Texture::store_texture |
( |
std::string | name, |
|
|
std::shared_ptr< Texture > | texture ) |
|
static |
Stores a texture object in an internal map using the name parameter as key (no duplicates)
- Parameters
-
| name | The key used to store the texture |
| texture | The texture to be stored |
- Returns
- Returns true if the insertion was successful, false otherwise
Definition at line 36 of file texture.cpp.
◆ unbind()
| virtual void sgltk::Texture::unbind |
( |
unsigned int | texture_unit = 0 | ) |
|
|
pure virtual |
◆ height
| unsigned int sgltk::Texture::height |
The height of the texture.
Definition at line 42 of file texture.h.
◆ num_layers
| unsigned int sgltk::Texture::num_layers |
The number of layers.
Definition at line 46 of file texture.h.
◆ target
| GLenum sgltk::Texture::target |
The texture target.
Definition at line 30 of file texture.h.
◆ texture
| GLuint sgltk::Texture::texture |
The texture name.
Definition at line 34 of file texture.h.
◆ width
| unsigned int sgltk::Texture::width |
The width of the texture.
Definition at line 38 of file texture.h.
The documentation for this class was generated from the following files:
- /home/fstdb/proj/sgltk_example/sgltk/src/texture.h
- /home/fstdb/proj/sgltk_example/sgltk/src/texture.cpp