redhand::texture2D class

This class is a simple 2 Dimensional texture.

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_properties that define this texture.

This allows easy copying/moving of the texture because it can just be recreated from the configuration.