Class for storing textures.
More...
#include <Texture.hpp>
|
| enum class | Axis { x
, y
, s
, t
} |
| |
|
|
MYGL_EXPORT | Texture () noexcept=default |
| | Creates an empty texture whiwh is not usable until an image has been loaded.
|
| |
| MYGL_EXPORT | Texture (const std::string &filename) |
| | Creates a texture from an image file.
|
| |
| MYGL_EXPORT | Texture (const Image &image) |
| | Creates a texture fron an image.
|
| |
| MYGL_EXPORT | Texture (unsigned int textureId, unsigned int width, unsigned int height) |
| | Cretes a texture from an existing opengl texture.
|
| |
| MYGL_EXPORT bool | load (const std::string &filename) |
| | Loads a texture, this texture should not be used if the operation fails.
|
| |
| MYGL_EXPORT bool | load (const Image &image) |
| | Creates a texture from an Image.
|
| |
| MYGL_EXPORT unsigned int | getId () const noexcept |
| | Return a texture's OpenGL id.
|
| |
| MYGL_EXPORT unsigned int | getWidth () const noexcept |
| | Gives the texture's original width in pixels.
|
| |
| MYGL_EXPORT unsigned int | getHeight () const noexcept |
| | Gives the texture's original height in pixels.
|
| |
|
MYGL_EXPORT void | bind () const |
| | Binds this texture to GL_TEXTURE_2D.
|
| |
| MYGL_EXPORT void | setTextureWrapMethod (Axis axis, GLenum method) |
| | Sets the wrapping method for a given axis.
|
| |
| MYGL_EXPORT void | setBorderColor (uint8_t r, uint8_t g, uint8_t b, uint8_t alpha=255) |
| | Sets the border color used with GL_CLAMP_TO_BORDER wrapping method.
|
| |
| MYGL_EXPORT void | setBorderColor (const Color &color) |
| | Sets the border color used with GL_CLAMP_TO_BORDER wrapping method.
|
| |
Class for storing textures.
Definition at line 20 of file Texture.hpp.
◆ Axis
◆ Texture() [1/3]
| MYGL_EXPORT Texture |
( |
const std::string & | filename | ) |
|
Creates a texture from an image file.
- Parameters
-
| filename | The path to the image |
◆ Texture() [2/3]
Creates a texture fron an image.
- Parameters
-
◆ Texture() [3/3]
| MYGL_EXPORT Texture |
( |
unsigned int | textureId, |
|
|
unsigned int | width, |
|
|
unsigned int | height ) |
Cretes a texture from an existing opengl texture.
- Parameters
-
| textureId | The texture's id, created with glGenTextures |
| width | The texture's width in pixels |
| height | The texture's height in pixels |
◆ getHeight()
| MYGL_EXPORT unsigned int getHeight |
( |
| ) |
const |
|
noexcept |
Gives the texture's original height in pixels.
- Returns
- The texture's height
◆ getId()
| MYGL_EXPORT unsigned int getId |
( |
| ) |
const |
|
noexcept |
Return a texture's OpenGL id.
- Returns
- The texture's id
◆ getWidth()
| MYGL_EXPORT unsigned int getWidth |
( |
| ) |
const |
|
noexcept |
Gives the texture's original width in pixels.
- Returns
- The texture's width
◆ load() [1/2]
| MYGL_EXPORT bool load |
( |
const Image & | image | ) |
|
Creates a texture from an Image.
- Parameters
-
- Returns
- True if the texture has been successfuly created, false if an error has occured
◆ load() [2/2]
| MYGL_EXPORT bool load |
( |
const std::string & | filename | ) |
|
Loads a texture, this texture should not be used if the operation fails.
- Parameters
-
| filename | The path to the image |
- Returns
- True if the image has been successfuly loaded, false if an error has occured
◆ setBorderColor() [1/2]
| MYGL_EXPORT void setBorderColor |
( |
const Color & | color | ) |
|
Sets the border color used with GL_CLAMP_TO_BORDER wrapping method.
- Parameters
-
| color | The color to be applied |
◆ setBorderColor() [2/2]
| MYGL_EXPORT void setBorderColor |
( |
uint8_t | r, |
|
|
uint8_t | g, |
|
|
uint8_t | b, |
|
|
uint8_t | alpha = 255 ) |
Sets the border color used with GL_CLAMP_TO_BORDER wrapping method.
- Parameters
-
| r | The red component |
| g | The green component |
| b | The blue component |
| alpha | The alpha component |
◆ setTextureWrapMethod()
| MYGL_EXPORT void setTextureWrapMethod |
( |
Axis | axis, |
|
|
GLenum | method ) |
Sets the wrapping method for a given axis.
- Parameters
-
| axis | the axis (s/x or t/y) we want to apply the wrapping method to |
| method | The wrapping method to be applied (valid methods are GL_REPEAT, GL_MIRRORED_REPEAT, GL_CLAMP_TO_EDGE and GL_CLAMP_TO_BORDER) |
The documentation for this class was generated from the following file: