class
#include <include/redhand/texture.hpp>
texture2D This class is a simple 2 Dimensional texture.
Contents
Constructors, destructors, conversion operators
-
texture2D(image_
properties prop) - This constructor creates a 2-dimensional texture from a given filename.
- texture2D(std::string file_location, std::string texture_name)
- This constructor creates a 2-dimensional texture from a given filename and texture name.
- ~texture2D()
- Destroy the texture2D object and cleans the memory.
Public functions
- auto hasErrord() -> bool
- This function returns true if an error has happened.
- auto getID() -> unsigned int
- This function returns the ID of the texture so that it can be activated by shaders.
- void bind(int unit = 0)
- This function binds the texture to the specified texture unit.
- auto getWidth() -> int
- This function retruns the width of the texture.
- auto getHeight() -> int
- This function retruns the height of the texture.
- auto getName() -> std::string_view
- This funtion returns the name of the object.
-
auto getProperties() -> image_
properties - Returns the image_
properties that define this texture.
Function documentation
redhand:: texture2D:: texture2D(image_ properties prop)
This constructor creates a 2-dimensional texture from a given filename.
Parameters | |
---|---|
prop | The properties that should be used to create the image. |
redhand:: texture2D:: texture2D(std::string file_location,
std::string texture_name)
This constructor creates a 2-dimensional texture from a given filename and texture name.
Parameters | |
---|---|
file_location | the location of the file |
texture_name | the internale name of the texture |
All other properties are the DEFAULT_IMAGE_PROPERTIES
void redhand:: texture2D:: bind(int unit = 0)
This function binds the texture to the specified texture unit.
Parameters | |
---|---|
unit | The index of the texture unit the texture will be bound to (0 by default) |
image_ properties redhand:: texture2D:: getProperties()
Returns the image_
This allows easy copying/moving of the texture because it can just be recreated from the configuration.