BMC Engine v1.0.0
An open-source game engine powered by C and C++
Loading...
Searching...
No Matches
Texture Class Reference

#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
 

Detailed Description

Simple container for OpenGL textures.

Constructor & Destructor Documentation

◆ Texture()

Texture::Texture ( const char * image,
GLenum texType,
GLuint slot,
GLenum format,
GLenum pixelType )

Creates the texture object.

Parameters
imageThe path to the image file.
texTypeThe type of texture to store
slotThe OpenGL texture slot to store the texture to.
formatThe texture's color format (ex. RGBA)
pixelTypeThe texture's pixel type (ex. GL_UNSIGNED_BYTE)

Member Function Documentation

◆ bind()

void Texture::bind ( )

Bind the texture.

◆ cleanup()

void Texture::cleanup ( )

Delete the texture.

◆ texUnit()

void Texture::texUnit ( Shader * shader,
const char * uniform,
GLuint unit )

Assigns the texture to the shader.

Parameters
shaderThe Shader object to assign the texture to.
uniformThe name of the uniform in the fragment shader for the texture.
unitThe texture's slot, as an integer.

◆ unbind()

void Texture::unbind ( )

Unbind the texture.

Member Data Documentation

◆ ID

GLuint Texture::ID

The ID to store the texture to.

◆ type

GLenum Texture::type

The type of texture to store.

◆ unit

GLuint Texture::unit

The OpenGL texture slot to store the texture to.


The documentation for this class was generated from the following files: