Rune Engine  Version 0.2.7-alpha
Documentation for how to make games using the Rune Engine.
rune::Shader Class Reference

A shader that can be used to render objects to the screen. More...

#include <shader.h>

Public Member Functions

 Shader ()
 Default empty constructor.
 
 Shader (const std::string &filePath)
 Default constructor to create and load a shader. More...
 
 Shader (const char *sourceCode)
 Constructor that will compile a character array into a shader. More...
 
 Shader (ShaderProgramSource)
 Create a shader from a rune::ShaderProgramSource. More...
 
void makeNewShader (std::string const &filePath)
 This is the base function that the different constructors call. More...
 
void bind (void)
 Configure the shader to be active on the GPU, must be done before drawing something.
 
int getShaderID ()
 Get the ID of the shader used by the GPU.
 
void setShader (int shaderID)
 Set which ID the shader should use to communicate with the GPU.
 
void setUniform1f (std::string const &name, float value)
 Set a float shader uniform. More...
 
void setUniform2f (std::string const &name, float v0, float v1)
 Set a vec2 shader uniform. More...
 
void setUniform3f (std::string const &name, float v0, float v1, float v2)
 Set a vec3 shader uniform.
 
void setUniform4f (std::string const &name, float v0, float v1, float v2, float v3)
 Set a vec4 shader uniform. More...
 
void setUniform1i (std::string const &name, int value)
 Set an integer shader uniform. More...
 

Detailed Description

A shader that can be used to render objects to the screen.

Author
Thomas Montano
Date
April 25 2020

Constructor & Destructor Documentation

◆ Shader() [1/3]

rune::Shader::Shader ( const std::string &  filePath)

Default constructor to create and load a shader.

Parameters
filePathThe file path for the shader code to be compiled.

◆ Shader() [2/3]

rune::Shader::Shader ( const char *  sourceCode)

Constructor that will compile a character array into a shader.

Create a new shader off of a string literal

Parameters
sourceCodea const char * to the code you would like to use. There are several included in the Rune Engine.

◆ Shader() [3/3]

rune::Shader::Shader ( ShaderProgramSource  source)

Create a shader from a rune::ShaderProgramSource.

Parameters
sourceA rune::ShaderProgramSource that should be loaded onto the GPU and used as the active shader.

Member Function Documentation

◆ makeNewShader()

void rune::Shader::makeNewShader ( std::string const &  filePath)

This is the base function that the different constructors call.

Parameters
filePathThe file path to the GLSL code that should be loaded onto the GPU.

◆ setUniform1f()

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

Set a float shader uniform.

Parameters
nameThe exact name of the uniform that is being created.
valueThe value being passed to the uniform.

◆ setUniform1i()

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

Set an integer shader uniform.

Parameters
nameThe exact name of the uniform that is being created.
valueThe value being passed to the uniform.

◆ setUniform2f()

void rune::Shader::setUniform2f ( std::string const &  name,
float  v0,
float  v1 
)

Set a vec2 shader uniform.

Parameters
nameThe name of the vec2 to be modified.
v0The x coordinate of the vector.
v1The y coordinate of the vector.

◆ setUniform4f()

void rune::Shader::setUniform4f ( std::string const &  name,
float  v0,
float  v1,
float  v2,
float  v3 
)

Set a vec4 shader uniform.

Parameters
nameThe exact name of the uniform that is being created.
v0The value being passed to the uniform.
v1The value being passed to the uniform.
v2The value being passed to the uniform.
v3The value being passed to the uniform.

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