MeVisLab Resolution Independence API
|
Class managing an OpenGL shader program. More...
#include <SoGLShaderProgram.h>
Classes | |
struct | UniformInfo |
Information structure for SoGLShaderObject containing location, type, and size. More... | |
Public Types | |
enum | LinkageResult { LR_FAILURE = 0 , LR_SUCCESS = 1 , LR_SKIPPED = 2 } |
Public Types inherited from SoUniformParameterBase | |
enum | SamplerType { SAMPLER_1D , SAMPLER_2D , SAMPLER_3D , SAMPLER_CUBEMAP } |
Public Member Functions | |
SoGLShaderProgram () | |
Constructor. | |
~SoGLShaderProgram () override | |
Destructor. | |
void | reset () override |
Free all resources (OpenGL too) and reset instance to initial state. | |
void | addShaderObject (SoGLShaderObject *shaderObject) |
void | removeShaderObject (SoGLShaderObject *shaderObject) |
void | removeAllShaderObjects () |
void | enable () |
void | disable () |
void | scheduleLinking () |
void | setGeometryInputType (GLint type) |
void | setGeometryOutputType (GLint type) |
void | setGeometryVerticesOut (GLint number) |
virtual void | updateUniformsFromState (SoState *) |
Update the shader uniforms according to the current Inventor state. | |
virtual void | preLinkSetup () |
virtual void | postLinkSetup () |
virtual SbBool | isActiveUniform (const SbString &name) |
virtual void | clearAssignedTextureUnits () |
Clears the assigned texture units to 0. | |
int | getNumAssignedTextureUnits () |
void | setNumAssignedTextureUnits (int num) |
int | addTextureSampler (const SbString &name) override |
Adds a new texture sampler with given name and returns the assigned texture unit. | |
void | set1f (const SbString &name, const float value) override |
void | set2f (const SbString &name, const float *value) override |
void | set3f (const SbString &name, const float *value) override |
void | set4f (const SbString &name, const float *value) override |
void | set2f (const SbString &name, const float value0, const float value1) override |
void | set3f (const SbString &name, const float value0, const float value1, const float value2) override |
void | set4f (const SbString &name, const float value0, const float value1, const float value2, const float value3) override |
void | set1fv (const SbString &name, const int num, const float *value) override |
void | set2fv (const SbString &name, const int num, const float *value) override |
void | set3fv (const SbString &name, const int num, const float *value) override |
void | set4fv (const SbString &name, const int num, const float *value) override |
void | set1i (const SbString &name, const int32_t value) override |
void | set2i (const SbString &name, const int32_t *value) override |
void | set2i (const SbString &name, const SbVec2s &value) override |
void | set3i (const SbString &name, const int32_t *value) override |
void | set3i (const SbString &name, const SbVec3s &value) override |
void | set4i (const SbString &name, const int32_t *value) override |
void | setMatrix3fv (const SbString &, int, const float *, SbBool=FALSE) override |
void | setMatrix4fv (const SbString &, int, const float *, SbBool=FALSE) override |
void | setName (const SbString &name) |
const SbString & | getName () const |
int | shaderVersion (SoShader::ShaderType type) const |
Get the used GLSL version for the given shader type. | |
ml::GLSLProgram & | getProgramResource () |
GLuint | getProgramHandle () const |
bool | isValid () |
returns if the shader is valid or needs re-creation | |
SbBool | isExecutable () const |
SbBool | shouldLink () const |
LinkageResult | link () |
void | updateUniformInfo (GLint programHandle) |
void | setAlwaysReadErrorLog (bool flag) |
bool | alwaysReadErrorLog () |
bool | hadLinkError () |
const SbString & | getErrorLog () |
Public Member Functions inherited from SoUniformParameterBase | |
virtual void | setMatrix3f (const SbString &name, const float *values, SbBool transpose=FALSE) |
virtual void | setMatrix4f (const SbString &name, const float *values, SbBool transpose=FALSE) |
virtual void | setSamplerInfo (const SbString &, SamplerType, uint32_t) |
Protected Member Functions | |
GLint | getUniform (const SbString &name, GLenum type, int *num=nullptr) |
Protected Member Functions inherited from SoGLShader | |
SoGLShader () | |
Constructor. | |
virtual | ~SoGLShader () |
Destructor. | |
void | errClear (const char *string=nullptr) const |
Clear OpenGL error state and print any previously not displayed error message. | |
void | errCheck (const char *string=nullptr) const |
Check for OpenGL errors and print error message if one is found. | |
SbBool | error (const char *string=nullptr) const |
Returns 'TRUE' if OpenGL error is found. | |
Protected Member Functions inherited from SoUniformParameterBase | |
SoUniformParameterBase () | |
Hidden constructor. | |
virtual | ~SoUniformParameterBase () |
Hidden destructor. | |
Protected Attributes | |
ml::GLSLProgram | _programRes |
GLint | _geometryInputType |
GLint | _geometryOutputType |
GLint | _geometryVerticesOut |
std::list< SoGLShaderObject * > | _shaderObjects |
SbBool | _shouldLink |
SbBool | _isExecutable |
SbString | _name |
int | _assignedTextureUnits |
std::map< std::string, UniformInfo > | _uniformInfo |
bool | _alwaysReadErrorLog |
bool | _hadError |
SbString | _errorLog |
Additional Inherited Members | |
Static Public Member Functions inherited from SoGLShader | |
static SbBool | isSupported () |
Returns 'TRUE' if vertex and fragment shaders are supported by OpenGL. | |
static bool | supportsGeometryShaders () |
Returns if the hardware supports geometry shaders. | |
static void | printCapabilities () |
Prints capabilities of the OpenGL implementation. | |
Class managing an OpenGL shader program.
Definition at line 32 of file SoGLShaderProgram.h.
Enumerator | |
---|---|
LR_FAILURE | |
LR_SUCCESS | |
LR_SKIPPED |
Definition at line 123 of file SoGLShaderProgram.h.
SoGLShaderProgram::SoGLShaderProgram | ( | ) |
Constructor.
|
override |
Destructor.
void SoGLShaderProgram::addShaderObject | ( | SoGLShaderObject * | shaderObject | ) |
|
overridevirtual |
Adds a new texture sampler with given name and returns the assigned texture unit.
Reimplemented from SoUniformParameterBase.
|
inline |
Definition at line 153 of file SoGLShaderProgram.h.
|
inlinevirtual |
Clears the assigned texture units to 0.
Definition at line 83 of file SoGLShaderProgram.h.
void SoGLShaderProgram::disable | ( | ) |
void SoGLShaderProgram::enable | ( | ) |
|
inline |
Definition at line 156 of file SoGLShaderProgram.h.
|
inline |
Definition at line 116 of file SoGLShaderProgram.h.
|
inline |
Definition at line 85 of file SoGLShaderProgram.h.
|
inline |
Definition at line 133 of file SoGLShaderProgram.h.
References ml::GLSLProgram::getHandle().
|
inline |
Definition at line 129 of file SoGLShaderProgram.h.
|
protected |
|
inline |
Definition at line 155 of file SoGLShaderProgram.h.
|
virtual |
|
inline |
Definition at line 140 of file SoGLShaderProgram.h.
bool SoGLShaderProgram::isValid | ( | ) |
returns if the shader is valid or needs re-creation
LinkageResult SoGLShaderProgram::link | ( | ) |
|
inlinevirtual |
Reimplemented in SoGLInventorShaderProgram.
Definition at line 78 of file SoGLShaderProgram.h.
|
inlinevirtual |
Reimplemented in SoGLInventorShaderProgram.
Definition at line 77 of file SoGLShaderProgram.h.
void SoGLShaderProgram::removeAllShaderObjects | ( | ) |
void SoGLShaderProgram::removeShaderObject | ( | SoGLShaderObject * | shaderObject | ) |
|
overridevirtual |
Free all resources (OpenGL too) and reset instance to initial state.
Reimplemented from SoGLShader.
void SoGLShaderProgram::scheduleLinking | ( | ) |
|
overridevirtual |
Reimplemented from SoUniformParameterBase.
|
overridevirtual |
Reimplemented from SoUniformParameterBase.
|
overridevirtual |
Reimplemented from SoUniformParameterBase.
|
overridevirtual |
Reimplemented from SoUniformParameterBase.
|
overridevirtual |
Reimplemented from SoUniformParameterBase.
|
overridevirtual |
Reimplemented from SoUniformParameterBase.
|
overridevirtual |
Reimplemented from SoUniformParameterBase.
|
overridevirtual |
Reimplemented from SoUniformParameterBase.
|
overridevirtual |
Reimplemented from SoUniformParameterBase.
|
overridevirtual |
Reimplemented from SoUniformParameterBase.
|
overridevirtual |
Reimplemented from SoUniformParameterBase.
|
overridevirtual |
Reimplemented from SoUniformParameterBase.
|
overridevirtual |
Reimplemented from SoUniformParameterBase.
|
overridevirtual |
Reimplemented from SoUniformParameterBase.
|
overridevirtual |
Reimplemented from SoUniformParameterBase.
|
overridevirtual |
Reimplemented from SoUniformParameterBase.
|
overridevirtual |
Reimplemented from SoUniformParameterBase.
|
inline |
Definition at line 152 of file SoGLShaderProgram.h.
|
inline |
Definition at line 64 of file SoGLShaderProgram.h.
|
inline |
Definition at line 67 of file SoGLShaderProgram.h.
|
inline |
Definition at line 70 of file SoGLShaderProgram.h.
|
overridevirtual |
Reimplemented from SoUniformParameterBase.
|
overridevirtual |
Reimplemented from SoUniformParameterBase.
|
inline |
Definition at line 114 of file SoGLShaderProgram.h.
|
inline |
Definition at line 86 of file SoGLShaderProgram.h.
int SoGLShaderProgram::shaderVersion | ( | SoShader::ShaderType | type | ) | const |
Get the used GLSL version for the given shader type.
|
inline |
Definition at line 144 of file SoGLShaderProgram.h.
void SoGLShaderProgram::updateUniformInfo | ( | GLint | programHandle | ) |
|
inlinevirtual |
Update the shader uniforms according to the current Inventor state.
To be reimplemented in derived classes.
Reimplemented in SoGLInventorShaderProgram.
Definition at line 76 of file SoGLShaderProgram.h.
|
protected |
Definition at line 180 of file SoGLShaderProgram.h.
|
protected |
Definition at line 166 of file SoGLShaderProgram.h.
|
protected |
Definition at line 182 of file SoGLShaderProgram.h.
|
protected |
Definition at line 40 of file SoGLShaderProgram.h.
|
protected |
Definition at line 41 of file SoGLShaderProgram.h.
|
protected |
Definition at line 42 of file SoGLShaderProgram.h.
|
protected |
Definition at line 181 of file SoGLShaderProgram.h.
|
protected |
Definition at line 162 of file SoGLShaderProgram.h.
|
protected |
Definition at line 164 of file SoGLShaderProgram.h.
|
protected |
Definition at line 38 of file SoGLShaderProgram.h.
|
protected |
Definition at line 160 of file SoGLShaderProgram.h.
|
protected |
Definition at line 161 of file SoGLShaderProgram.h.
|
protected |
Definition at line 176 of file SoGLShaderProgram.h.