13 #ifndef SO_GLSHADER_PROGRAM_H
14 #define SO_GLSHADER_PROGRAM_H
19 #include "SoShaderSystem.h"
22 #include <Inventor/SbString.h>
65 if (_geometryInputType != type) { _geometryInputType = type; scheduleLinking(); }
68 if (_geometryOutputType != type) { _geometryOutputType = type; scheduleLinking(); }
71 if (_geometryVerticesOut != number) { _geometryVerticesOut = number; scheduleLinking(); }
91 void set1f(
const SbString &name,
const float value)
override;
92 void set2f(
const SbString &name,
const float *value)
override;
93 void set3f(
const SbString &name,
const float *value)
override;
94 void set4f(
const SbString &name,
const float *value)
override;
95 void set2f(
const SbString &name,
const float value0,
const float value1)
override;
96 void set3f(
const SbString &name,
const float value0,
const float value1,
const float value2)
override;
97 void set4f(
const SbString &name,
const float value0,
const float value1,
const float value2,
const float value3)
override;
99 void set1fv(
const SbString &name,
const int num,
const float *value)
override;
100 void set2fv(
const SbString &name,
const int num,
const float *value)
override;
101 void set3fv(
const SbString &name,
const int num,
const float *value)
override;
102 void set4fv(
const SbString &name,
const int num,
const float *value)
override;
104 void set1i(
const SbString &name,
const int32_t value)
override;
105 void set2i(
const SbString &name,
const int32_t *value)
override;
106 void set2i(
const SbString &name,
const SbVec2s &value)
override;
107 void set3i(
const SbString &name,
const int32_t *value)
override;
108 void set3i(
const SbString &name,
const SbVec3s &value)
override;
109 void set4i(
const SbString &name,
const int32_t *value)
override;
111 void setMatrix3fv(
const SbString & ,
int ,
const float * , SbBool = FALSE)
override;
112 void setMatrix4fv(
const SbString & ,
int ,
const float * , SbBool = FALSE)
override;
114 void setName(
const SbString& name) { _name = name; }
116 const SbString&
getName()
const {
return _name; }
134 return _programRes.getHandle();
141 return _isExecutable;
174 UniformInfo(GLint _location, GLenum _type, GLint _size) : location(_location), type(_type), size(_size) {}
178 GLint
getUniform(
const SbString &name, GLenum type,
int *num =
nullptr);
Vertex or fragment shader object class.
Class managing an OpenGL shader program.
void setMatrix3fv(const SbString &, int, const float *, SbBool=FALSE) override
void removeShaderObject(SoGLShaderObject *shaderObject)
SbBool isExecutable() const
bool alwaysReadErrorLog()
ml::GLSLProgram & getProgramResource()
void set2i(const SbString &name, const SbVec2s &value) override
void set4fv(const SbString &name, const int num, const float *value) override
int shaderVersion(SoShader::ShaderType type) const
Get the used GLSL version for the given shader type.
void set1fv(const SbString &name, const int num, const float *value) override
void setGeometryInputType(GLint type)
int _assignedTextureUnits
int getNumAssignedTextureUnits()
virtual void clearAssignedTextureUnits()
Clears the assigned texture units to 0.
bool isValid()
returns if the shader is valid or needs re-creation
void reset() override
Free all resources (OpenGL too) and reset instance to initial state.
void set4i(const SbString &name, const int32_t *value) override
int addTextureSampler(const SbString &name) override
Adds a new texture sampler with given name and returns the assigned texture unit.
void setGeometryOutputType(GLint type)
const SbString & getErrorLog()
void set4f(const SbString &name, const float *value) override
virtual SbBool isActiveUniform(const SbString &name)
void setMatrix4fv(const SbString &, int, const float *, SbBool=FALSE) override
void set2i(const SbString &name, const int32_t *value) override
void set3f(const SbString &name, const float *value) override
GLuint getProgramHandle() const
virtual void postLinkSetup()
void set3i(const SbString &name, const SbVec3s &value) override
void set3fv(const SbString &name, const int num, const float *value) override
void set4f(const SbString &name, const float value0, const float value1, const float value2, const float value3) override
void removeAllShaderObjects()
GLint _geometryVerticesOut
void set1f(const SbString &name, const float value) override
virtual void updateUniformsFromState(SoState *)
Update the shader uniforms according to the current Inventor state.
void set2f(const SbString &name, const float value0, const float value1) override
ml::GLSLProgram _programRes
void setNumAssignedTextureUnits(int num)
const SbString & getName() const
GLint getUniform(const SbString &name, GLenum type, int *num=nullptr)
SbBool shouldLink() const
void setAlwaysReadErrorLog(bool flag)
void set2fv(const SbString &name, const int num, const float *value) override
std::list< SoGLShaderObject * > _shaderObjects
void setName(const SbString &name)
~SoGLShaderProgram() override
Destructor.
void set1i(const SbString &name, const int32_t value) override
std::map< std::string, UniformInfo > _uniformInfo
void set2f(const SbString &name, const float *value) override
GLint _geometryOutputType
void addShaderObject(SoGLShaderObject *shaderObject)
void set3i(const SbString &name, const int32_t *value) override
void updateUniformInfo(GLint programHandle)
SoGLShaderProgram()
Constructor.
virtual void preLinkSetup()
void setGeometryVerticesOut(GLint number)
void set3f(const SbString &name, const float value0, const float value1, const float value2) override
Abstract base class for shader objects.