Bubba-3D
0.9.0
Awesome game engine!
|
Class for maintaining OpenGL shader programs. More...
#include <ShaderProgram.h>
Public Member Functions | |
void | loadShader (IShader *vertexShader, IShader *fragmentShader) |
void | use () |
void | backupCurrentShaderProgram () |
void | restorePreviousShaderProgram () |
void | setUniform1i (std::string name, int value) |
void | setUniform1f (std::string name, float value) |
void | setUniform2f (std::string name, chag::float2 value) |
void | setUniform3f (std::string name, chag::float3 value) |
void | setUniform4f (std::string name, chag::float4 value) |
void | setUniformMatrix4fv (std::string name, chag::float4x4 matrix) |
void | setUniformBufferObjectBinding (std::string bufferName, int index) |
void | initUniformBufferObject (std::string bufferName, int size, int index) |
void | setUniformBufferSubData (std::string bufferName, int offset, int size, const GLvoid *data) |
Class for maintaining OpenGL shader programs.
The class maintains information about where the shaders are saved on the graphics card. It caches the uniform locations as they are used to speed up the next call.
Definition at line 39 of file ShaderProgram.h.
void ShaderProgram::backupCurrentShaderProgram | ( | ) |
Saves the shader currently active on the graphics card. This is useful if later calculations may depend on the currently active shader. Then you can save it, perform this shader objects calculation, and restore the previous shader.
Definition at line 66 of file ShaderProgram.cpp.
Compiles, links and creates a program of the specified shaders.
Definition at line 27 of file ShaderProgram.cpp.
void ShaderProgram::restorePreviousShaderProgram | ( | ) |
Restores a shader saved by backupCurrentShaderProgram();
Definition at line 70 of file ShaderProgram.cpp.
void ShaderProgram::use | ( | ) |
Activates the shader on the graphics card
Definition at line 62 of file ShaderProgram.cpp.