MeVisLab Toolbox Reference
SoGLCompleteShader Class Reference

Shader class which directly takes src for vertex, geometry and/or fragment shader, compiles and links it. More...

#include <SoGLCompleteShader.h>

Inheritance diagram for SoGLCompleteShader:
SoGLShaderProgram SoGLShader SoUniformParameterBase

Public Member Functions

 SoGLCompleteShader ()
 
 ~SoGLCompleteShader () override
 
bool create (const char *srcVert, const char *srcGeom, const char *srcFrag)
 Creates the shaders and links them. If one does not need a specific shader, just pass NULL.
 
bool update (const char *srcVert, const char *srcGeom, const char *srcFrag)
 Updates the shaders source. Pass NULL for shaders that you don't want to update.
 
void bindTexture (const char *name, SoGLTexture *texture, int unit=-1)
 binds the given texture, if unit == -1 a unit is automatically assigned by the shader
 
void enable ()
 enables the shader, resets the assigned texture units
 
- Public Member Functions inherited from SoGLShaderProgram
 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 SbStringgetName () 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 SbStringgetErrorLog ()
 
- 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)
 

Public Attributes

SoGLShaderObjectm_pVertSh
 The GLSL shader objects for vertex, geometry and fragment programs.
 
SoGLShaderObjectm_pGeomSh
 
SoGLShaderObjectm_pFragSh
 

Additional Inherited Members

- Public Types inherited from SoGLShaderProgram
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 }
 
- 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.
 
- Protected Member Functions inherited from SoGLShaderProgram
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 inherited from SoGLShaderProgram
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
 

Detailed Description

Shader class which directly takes src for vertex, geometry and/or fragment shader, compiles and links it.

Definition at line 29 of file SoGLCompleteShader.h.

Constructor & Destructor Documentation

◆ SoGLCompleteShader()

SoGLCompleteShader::SoGLCompleteShader ( )
inline

Definition at line 38 of file SoGLCompleteShader.h.

◆ ~SoGLCompleteShader()

SoGLCompleteShader::~SoGLCompleteShader ( )
override

Member Function Documentation

◆ bindTexture()

void SoGLCompleteShader::bindTexture ( const char * name,
SoGLTexture * texture,
int unit = -1 )

binds the given texture, if unit == -1 a unit is automatically assigned by the shader

◆ create()

bool SoGLCompleteShader::create ( const char * srcVert,
const char * srcGeom,
const char * srcFrag )

Creates the shaders and links them. If one does not need a specific shader, just pass NULL.

◆ enable()

void SoGLCompleteShader::enable ( )

enables the shader, resets the assigned texture units

◆ update()

bool SoGLCompleteShader::update ( const char * srcVert,
const char * srcGeom,
const char * srcFrag )

Updates the shaders source. Pass NULL for shaders that you don't want to update.

Member Data Documentation

◆ m_pFragSh

SoGLShaderObject * SoGLCompleteShader::m_pFragSh

Definition at line 35 of file SoGLCompleteShader.h.

◆ m_pGeomSh

SoGLShaderObject * SoGLCompleteShader::m_pGeomSh

Definition at line 34 of file SoGLCompleteShader.h.

◆ m_pVertSh

SoGLShaderObject* SoGLCompleteShader::m_pVertSh

The GLSL shader objects for vertex, geometry and fragment programs.

Definition at line 33 of file SoGLCompleteShader.h.


The documentation for this class was generated from the following file: