Public Member Functions | |
GlShaderMgr () | |
Constructor. | |
bool | loadAndAttachShaderFromFile (const GLuint &progId, const GLenum shaderType, const char *shaderFileName, GLuint &dstShaderId) |
Load GLSL shader code from textfile, compile and attach it to program object. Uses Singleton pattern. | |
bool | loadAndAttachShaderFromString (const GLuint &progId, const GLenum shaderType, const std::string &shaderSource, GLuint &dstShaderId) |
Load GLSL shader code from string, compile and attach it to program object. Uses Singleton pattern. | |
bool | registerProgObj (const std::string &str, GLuint &progId) |
Register a GLSL program object. Uses Time elapsed: 0.073425 --> 13.6193 fps Singleton pattern. | |
virtual | ~GlShaderMgr () |
Static Public Member Functions | |
static int | checkSupportForProgrammableShaders () |
Check if programmable shaders are supported by OpenGL version. | |
static int | convertShaderFileToString (const char *srcFileName, const char *dstFileName, bool appendToFile=true) |
Convert the shader code of a text files to a string for inclusion in a header file The resulting string has the name of the text file with "." replaced by "_". | |
static bool | linkShadersToProgram (const GLuint program) |
Link Shaders to program object. | |
static void | printProgramInfoLog (const GLuint program) |
Print program object log information. | |
static void | printShaderInfoLog (const GLuint shader) |
Print Shader object log information. | |
static unsigned char * | readShaderFile (const char *fileName) |
Read shader code from file. | |
static void | resetProgObj () |
static void | useProgObj (const GLuint progId) |
opentl::cvprocess::GlShaderMgr::GlShaderMgr | ( | ) |
Constructor.
virtual opentl::cvprocess::GlShaderMgr::~GlShaderMgr | ( | ) | [virtual] |
static int opentl::cvprocess::GlShaderMgr::checkSupportForProgrammableShaders | ( | ) | [static] |
Check if programmable shaders are supported by OpenGL version.
static int opentl::cvprocess::GlShaderMgr::convertShaderFileToString | ( | const char * | srcFileName, | |
const char * | dstFileName, | |||
bool | appendToFile = true | |||
) | [static] |
Convert the shader code of a text files to a string for inclusion in a header file The resulting string has the name of the text file with "." replaced by "_".
srcFileName | Name of source text file. | |
dstFileName | Name of header file. | |
appendToFile | Flag if destination file should be overwritten. |
static bool opentl::cvprocess::GlShaderMgr::linkShadersToProgram | ( | const GLuint | program | ) | [static] |
Link Shaders to program object.
bool opentl::cvprocess::GlShaderMgr::loadAndAttachShaderFromFile | ( | const GLuint & | progId, | |
const GLenum | shaderType, | |||
const char * | shaderFileName, | |||
GLuint & | dstShaderId | |||
) |
Load GLSL shader code from textfile, compile and attach it to program object. Uses Singleton pattern.
progId | Attach shader code to program object. | |
shaderType | GL_VERTEX_SHADER or GL_FRAGMENT_SHADER | |
shaderFileName | Path and file name of (GLSL) shader code | |
dstShaderId | Resulting shader Id. |
bool opentl::cvprocess::GlShaderMgr::loadAndAttachShaderFromString | ( | const GLuint & | progId, | |
const GLenum | shaderType, | |||
const std::string & | shaderSource, | |||
GLuint & | dstShaderId | |||
) |
Load GLSL shader code from string, compile and attach it to program object. Uses Singleton pattern.
progId | Attach shader code to program object. | |
shaderType | GL_VERTEX_SHADER or GL_FRAGMENT_SHADER | |
shaderSource | String containing (GLSL) shader code (for generation see, convertShaderFileToString()) | |
dstShaderId | Resulting shader Id. |
static void opentl::cvprocess::GlShaderMgr::printProgramInfoLog | ( | const GLuint | program | ) | [static] |
Print program object log information.
static void opentl::cvprocess::GlShaderMgr::printShaderInfoLog | ( | const GLuint | shader | ) | [static] |
Print Shader object log information.
static unsigned char* opentl::cvprocess::GlShaderMgr::readShaderFile | ( | const char * | fileName | ) | [static] |
Read shader code from file.
fileName | Path and name of shader code file to read. |
bool opentl::cvprocess::GlShaderMgr::registerProgObj | ( | const std::string & | str, | |
GLuint & | progId | |||
) |
Register a GLSL program object. Uses Time elapsed: 0.073425 --> 13.6193 fps Singleton pattern.
str | Arbitrary name of program object. | |
progId | Program Id of new registered or already registered program. |
static void opentl::cvprocess::GlShaderMgr::resetProgObj | ( | ) | [static] |
static void opentl::cvprocess::GlShaderMgr::useProgObj | ( | const GLuint | progId | ) | [static] |