Level H Engine
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Shader Class Reference

Creates a Shader from an text file, this can then be used with OpenGL. More...

#include <Shader.h>

Collaboration diagram for Shader:
Collaboration graph

Public Member Functions

 Shader (std::string vertexShaderFileName, std::string fragmentShaderFileName)
 Creates a Shader Object using an shader file location and OpenGL. More...
 
 ~Shader ()
 Destructs the Shader Object deleting the Shader Object from memory. More...
 
GLuint getShaderProgram ()
 Returns the shader program. More...
 
void initaliseUniform (std::string uniformID)
 Initalise a uniform for the shader. More...
 
GLint getUniform (std::string uniformID)
 Returns the requested uniform location. More...
 

Private Member Functions

bool CheckShaderCompiled (GLint shader)
 A function to test if the shader compiled successfully. More...
 
void initaliseShader (std::string shaderFileName, char shaderType)
 Initialise a shader. More...
 

Private Attributes

GLuint shaderProgram
 The Shader program of the Shader Object. More...
 
std::unordered_map< std::string, GLint > uniforms
 The Uniform locations for the shader program. More...
 

Detailed Description

Creates a Shader from an text file, this can then be used with OpenGL.

Constructor & Destructor Documentation

◆ Shader()

Shader::Shader ( std::string  vertexShaderFileName,
std::string  fragmentShaderFileName 
)

Creates a Shader Object using an shader file location and OpenGL.

Parameters
vertexShaderFileNameThe name of the vertex shader file.
fragmentShaderFileNameThe name of the fragment shader file.
Here is the call graph for this function:

◆ ~Shader()

Shader::~Shader ( )

Destructs the Shader Object deleting the Shader Object from memory.

Member Function Documentation

◆ CheckShaderCompiled()

bool Shader::CheckShaderCompiled ( GLint  shader)
private

A function to test if the shader compiled successfully.

Parameters
shaderThe shader to test.
Returns
If the shader compiled successfully.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getShaderProgram()

GLuint Shader::getShaderProgram ( )

Returns the shader program.

Returns
The shader program.

◆ getUniform()

GLint Shader::getUniform ( std::string  uniformID)

Returns the requested uniform location.

Parameters
uniformIDThe ID of the uniform.
Returns
The uniform location.

◆ initaliseShader()

void Shader::initaliseShader ( std::string  shaderFileName,
char  shaderType 
)
private

Initialise a shader.

Parameters
shaderFileNameThe name of the shader file.
shaderTypeThe type of the shader.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initaliseUniform()

void Shader::initaliseUniform ( std::string  uniformID)

Initalise a uniform for the shader.

Parameters
uniformIDThe ID of the uniform.
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ shaderProgram

GLuint Shader::shaderProgram
private

The Shader program of the Shader Object.

◆ uniforms

std::unordered_map<std::string, GLint> Shader::uniforms
private

The Uniform locations for the shader program.


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