![]() |
scg3
0.6
|
A core to set a shader program to be applied to subsequent nodes. More...
#include "ShaderCore.h"
Public Member Functions | |
ShaderCore (GLuint program, const std::vector< ShaderID > &shaderIDs) | |
virtual | ~ShaderCore () |
void | clear () |
void | init () const |
GLuint | getProgram () const |
GLint | getUniformLoc (const std::string &name) const |
void | setUniform1i (const std::string &name, GLint value) const |
void | setUniform1iv (const std::string &name, GLsizei count, const GLint *value) const |
void | setUniform1f (const std::string &name, GLfloat value) const |
void | setUniform1fv (const std::string &name, GLsizei count, const GLfloat *value) const |
void | setUniform2fv (const std::string &name, GLsizei count, const GLfloat *value) const |
void | setUniform3fv (const std::string &name, GLsizei count, const GLfloat *value) const |
void | setUniform4fv (const std::string &name, GLsizei count, const GLfloat *value) const |
void | setUniformMatrix2fv (const std::string &name, GLsizei count, const GLfloat *value) const |
void | setUniformMatrix3fv (const std::string &name, GLsizei count, const GLfloat *value) const |
void | setUniformMatrix4fv (const std::string &name, GLsizei count, const GLfloat *value) const |
virtual void | render (RenderState *renderState) |
virtual void | renderPost (RenderState *renderState) |
![]() | |
Core () | |
virtual | ~Core ()=0 |
Static Public Member Functions | |
static ShaderCoreSP | create (GLuint program, const std::vector< ShaderID > &shaderIDs) |
Protected Member Functions | |
void | checkCompileError_ (const ShaderID &shaderID) const |
void | checkLinkError_ (GLuint program) const |
Protected Attributes | |
GLuint | program_ |
std::vector< ShaderID > | shaderIDs_ |
ShaderCore * | shaderCoreOld_ |
std::unordered_map< std::string, GLint > | uniformLocMap_ |
A core to set a shader program to be applied to subsequent nodes.
A few member functions are defined in the header file to allow inlining. Method chaining (via returning this pointers) is not supported to ensure maximum performance.
Definition at line 69 of file ShaderCore.h.
scg::ShaderCore::ShaderCore | ( | GLuint | program, |
const std::vector< ShaderID > & | shaderIDs | ||
) |
Constructor with given program and shaders.
|
virtual |
Destructor.
|
protected |
Check for compile errors and print error messages.
|
protected |
Check for link errors and print error messages.
void scg::ShaderCore::clear | ( | ) |
Delete shaders and program.
|
static |
Create shared pointer.
GLuint scg::ShaderCore::getProgram | ( | ) | const |
Get shader program.
|
inline |
Get location of uniform variable.
Definition at line 108 of file ShaderCore.h.
void scg::ShaderCore::init | ( | ) | const |
Initialize shader core, i.e., compile shaders and link program, to be called by ShaderCoreFactory or by application after binding custom attribute and fragment data locations.
|
virtual |
Render shader, i.e., bind shader program.
Implements scg::Core.
|
virtual |
Render shader after traversing sub-tree, i.e., restore previous shader program.
Reimplemented from scg::Core.
|
inline |
Set uniform variable.
Definition at line 141 of file ShaderCore.h.
|
inline |
Set uniform variable.
Definition at line 151 of file ShaderCore.h.
|
inline |
Set uniform variable.
Definition at line 121 of file ShaderCore.h.
|
inline |
Set uniform variable.
Definition at line 131 of file ShaderCore.h.
|
inline |
Set uniform variable.
Definition at line 161 of file ShaderCore.h.
|
inline |
Set uniform variable.
Definition at line 171 of file ShaderCore.h.
|
inline |
Set uniform variable.
Definition at line 181 of file ShaderCore.h.
|
inline |
Set uniform variable.
Definition at line 191 of file ShaderCore.h.
|
inline |
Set uniform variable.
Definition at line 201 of file ShaderCore.h.
|
inline |
Set uniform variable.
Definition at line 211 of file ShaderCore.h.
|
protected |
Definition at line 242 of file ShaderCore.h.
|
protected |
Definition at line 244 of file ShaderCore.h.
|
protected |
Definition at line 243 of file ShaderCore.h.
|
mutableprotected |
Definition at line 245 of file ShaderCore.h.