#include <Shader.h>
Public Member Functions | |
| Shader (void) | |
| virtual | ~Shader (void) |
| bool | loadShader (string vertexShaderFile, string fragmentShaderFile) |
| bool | isInitialized () |
| void | use () |
| void | passUniformSampler3D (const string &variableName, const Texture3D *tex3D) |
| void | passUniformSampler1D (const string &variableName, const Texture1D *tex3D) |
Static Public Member Functions | |
| static void | dropCurrentShader () |
Private Member Functions | |
| const char * | readTextFile (string filename) |
Static Private Member Functions | |
| static void | releaseActiveTextureUnits () |
Private Attributes | |
| GLenum | m_shaderProgram |
| GLenum | m_vertexShader |
| GLenum | m_fragmentShader |
| bool | m_initialized |
Static Private Attributes | |
| static Shader * | m_activeShader = NULL |
| static int | m_textureUnitTargets [64] = {0} |
| static int | m_activeTextureUnit = 0 |
| Shader::Shader | ( | void | ) |
| Shader::~Shader | ( | void | ) | [virtual] |
| void Shader::dropCurrentShader | ( | ) | [static] |
Deactivates the current used shader program. Internally calls glUseProgramObjectARB(0) and releases all active texture units
| bool Shader::isInitialized | ( | ) |
Loads a Shader program from the given vertesShader- and fragmentShader-File. TODO: extended error handling and and report if shader files have syntax errors and so on
Resets the internal activeTextureunit-Counter to zero. Call this function before each sequence of passUniformSampler3D()-call.
void Shader::beginPassTextures() { Disable all prviously used targets in the Active Texture Units Shader::releaseActiveTextureUnits();
m_activeTextureUnit = 0; }
| const char * Shader::readTextFile | ( | string | filename | ) | [private] |
Reads a textfile from the harddrive, and returns as const char* buffer. Used for shader source loading Remarks: The const char* buffer allocated in this method is to be released by a delete[] call later
| filename | the path to the textfile to load |
| void Shader::releaseActiveTextureUnits | ( | ) | [static, private] |
Disables all targets of the active Shader previously enabled in Active Texture Units and sets it internal activeTextureUnit counter to 0
| void Shader::use | ( | ) |
Uses this Shader's program in the following shading operations
Shader * Shader::m_activeShader = NULL [static, private] |
int Shader::m_activeTextureUnit = 0 [static, private] |
GLenum Shader::m_fragmentShader [private] |
bool Shader::m_initialized [private] |
GLenum Shader::m_shaderProgram [private] |
int Shader::m_textureUnitTargets = {0} [static, private] |
GLenum Shader::m_vertexShader [private] |
1.5.7.1