Represents an OpenGL texture object.
Texture()
Default constructor that initializes the texture ID to 0.
const std::string & getLastError() const
Gets the last error message generated by texture operations.
Texture(TextureImage image)
Constructor that creates an OpenGL texture from a TextureImage.
~Texture()
Destructor that deletes the OpenGL texture.
TextureType type
Specifies the type of texture (2D or Cubemap)
Texture(const std::vector< std::string > &faces)
Constructs a cubemap texture from six image files.
void bind(int unit) const
Binds the texture to a texture unit.
static std::shared_ptr< Texture > loadCubemap(const std::vector< std::string > &faces)
Loads a cubemap texture from six image files.
static std::shared_ptr< Texture > loadTexture(const std::string &texturePath)
Loads a texture from a file and creates an OpenGL texture object.
Represents an image containing texture data.
~TextureImage()
Destructor that frees the image data.
unsigned char * data
Pointer to the raw image data.
int n_channel
Number of channels in the image (e.g., 3 for RGB, 4 for RGBA).
TextureImage(unsigned char *data, int width, int height, int n_channel)
Construct a TextureImage object.
TextureType
Specifies the type of texture.