#include <ovshader.h>
Public Member Functions | |
OVShader () | |
Constructor for the shader class. | |
OVShader (const char *name) | |
Constructor for the shader class. | |
~OVShader () | |
Destructor for the shader class. | |
void | Compile (const char *shaderName) |
Compile a shader program. | |
void | UpdateUniforms () |
Update all uniform variables. | |
void | UpdateUniformsLocation () |
Update locations for all uniform variables. | |
void | Activate () |
Activate shader program. | |
void | Deactivate () |
Deactivate shader program. | |
void | AddUniform (OVUniVar *uniVar) |
Add uniform variable. | |
char * | Txt2char (const char *fileName) |
Read shader program from file. | |
Private Attributes | |
GLuint | m_vertex |
GLuint | m_fragment |
GLuint | m_program |
char * | m_name |
std::vector< OVUniVar * > | m_uniforms |
OV::OVShader::OVShader | ( | ) |
Constructor for the shader class.
Constructor for the shader class, resets all variables.
OV::OVShader::OVShader | ( | const char * | name | ) |
Constructor for the shader class.
Constructor for the shader class, loads and compiles a specified shader.
name | Name of the shader program. |
OV::OVShader::~OVShader | ( | ) |
Destructor for the shader class.
Releases any loaded shaderprogram.
void OV::OVShader::Compile | ( | const char * | shaderName | ) |
Compile a shader program.
Read a vertex and a fragment program from source and compile it.
shaderName | Name of the shader program. |
void OV::OVShader::UpdateUniforms | ( | ) |
Update all uniform variables.
Update all uniform variables that has been connected to this shader program.
void OV::OVShader::UpdateUniformsLocation | ( | ) |
Update locations for all uniform variables.
Update locations for all uniform variables that has been connected to this shader program.
void OV::OVShader::Activate | ( | ) |
Activate shader program.
Set this proram as the active shader program.
void OV::OVShader::Deactivate | ( | ) |
Deactivate shader program.
Set the active shader program to 0.
void OV::OVShader::AddUniform | ( | OVUniVar * | uniVar | ) |
Add uniform variable.
Add a uniform variable to this shader. The added variables will then be updated automaticly by the shader.
char * OV::OVShader::Txt2char | ( | const char * | fileName | ) |
Read shader program from file.
This method opens a file and reads it into a char-buffer.
fileName | Filename to read. |
GLuint OV::OVShader::m_vertex [private] |
Index of vertex program
GLuint OV::OVShader::m_fragment [private] |
Index of fragment program
GLuint OV::OVShader::m_program [private] |
Index of shader program
char* OV::OVShader::m_name [private] |
Name of the shader
std::vector<OVUniVar*> OV::OVShader::m_uniforms [private] |
List of uniform variables