BMC Engine v1.0.0
An open-source game engine powered by C and C++
|
#include <Texture.h>
Public Member Functions | |
Texture (const char *image, GLenum texType, GLuint slot, GLenum format, GLenum pixelType) | |
void | texUnit (Shader *shader, const char *uniform, GLuint unit) |
void | bind () |
void | unbind () |
void | cleanup () |
Public Attributes | |
GLuint | ID |
GLenum | type |
GLuint | unit |
Simple container for OpenGL textures.
Texture::Texture | ( | const char * | image, |
GLenum | texType, | ||
GLuint | slot, | ||
GLenum | format, | ||
GLenum | pixelType ) |
Creates the texture object.
image | The path to the image file. |
texType | The type of texture to store |
slot | The OpenGL texture slot to store the texture to. |
format | The texture's color format (ex. RGBA) |
pixelType | The texture's pixel type (ex. GL_UNSIGNED_BYTE) |
void Texture::bind | ( | ) |
Bind the texture.
void Texture::cleanup | ( | ) |
Delete the texture.
void Texture::texUnit | ( | Shader * | shader, |
const char * | uniform, | ||
GLuint | unit ) |
Assigns the texture to the shader.
shader | The Shader object to assign the texture to. |
uniform | The name of the uniform in the fragment shader for the texture. |
unit | The texture's slot, as an integer. |
void Texture::unbind | ( | ) |
Unbind the texture.
GLuint Texture::ID |
The ID to store the texture to.
GLenum Texture::type |
The type of texture to store.
GLuint Texture::unit |
The OpenGL texture slot to store the texture to.