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

#include <Shader.h>

Public Member Functions

 Shader (const char *vertexPath, const char *fragmentPath)
 
void use ()
 
void setBool (const std::string &name, bool value) const
 
void setInt (const std::string &name, int value) const
 
void setFloat (const std::string &name, float value) const
 
void setMat4 (const std::string &name, glm::mat4 value) const
 
void setVec3 (const std::string &name, glm::vec3 value) const
 
void setVec4 (const std::string &name, glm::vec4 value) const
 
void vertexAttribPointer (int index, int length, int type, int totalSize)
 

Public Attributes

GLuint ID
 

Detailed Description

Makes OpenGL shader creation easier by providing simple functions.

Constructor & Destructor Documentation

◆ Shader()

Shader::Shader ( const char * vertexPath,
const char * fragmentPath )

The ID to assign the shader to.

Member Function Documentation

◆ setBool()

void Shader::setBool ( const std::string & name,
bool value ) const

Sets a boolean uniform in the shader.

Parameters
nameThe name of the uniform.
valueThe value to set it to.

◆ setFloat()

void Shader::setFloat ( const std::string & name,
float value ) const

Sets a float uniform in the shader.

Parameters
nameThe name of the uniform.
valueThe value to set it to.

◆ setInt()

void Shader::setInt ( const std::string & name,
int value ) const

Sets an integer uniform in the shader.

Parameters
nameThe name of the uniform.
valueThe value to set it to.

◆ setMat4()

void Shader::setMat4 ( const std::string & name,
glm::mat4 value ) const

Sets a mat4 uniform in the shader.

Parameters
nameThe name of the uniform.
valueThe value to set it to.

◆ setVec3()

void Shader::setVec3 ( const std::string & name,
glm::vec3 value ) const

Sets a vec3 uniform in the shader.

Parameters
nameThe name of the uniform.
valueThe value to set it to.

◆ setVec4()

void Shader::setVec4 ( const std::string & name,
glm::vec4 value ) const

Sets a vec4 uniform in the shader.

Parameters
nameThe name of the uniform.
valueThe value to set it to.

◆ use()

void Shader::use ( )

The ID to assign the shader to.

◆ vertexAttribPointer()

void Shader::vertexAttribPointer ( int index,
int length,
int type,
int totalSize )

Create a vertex attribute pointer.

Parameters
indexThe index in the vertices array.
lengthThe length of the vertex attribute pointer (ex. a vec3 would be 3).
typeThe type of the data in the vertices array.
totalSizeThe length of 1 vertex in the vertices array.

Member Data Documentation

◆ ID

GLuint Shader::ID

The ID to assign the shader to.


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