32 #ifndef GLSL_INCLUDE_ONCE 33 #define GLSL_INCLUDE_ONCE 69 void setSource(
const String& source_or_path );
72 const std::string&
source()
const {
return mSource; }
84 std::string getShaderSource()
const;
92 bool compileStatus()
const;
104 unsigned int handle()
const {
return mHandle; }
127 if (mObjectName.empty())
128 mObjectName = className();
145 if (mObjectName.empty())
146 mObjectName = className();
163 if (mObjectName.empty())
164 mObjectName = className();
181 if (mObjectName.empty())
182 mObjectName = className();
199 if (mObjectName.empty())
200 mObjectName = className();
262 void createProgram();
266 void deleteProgram();
273 unsigned int handle()
const {
return mHandle; }
283 bool linkProgram(
bool force_relink =
false);
285 bool linkStatus()
const;
288 bool linked()
const {
return mHandle && !mScheduleLink; }
306 void discardAllShaders();
312 bool validateProgram()
const;
316 void bindAttribLocation(
unsigned int index,
const char* name);
328 int location = glGetAttribLocation( handle(), name );
343 void detachAllShaders();
347 void bindFragDataLocation(
int color_number,
const char* name);
349 void unbindFragDataLocation(
const char* name);
351 int fragDataLocation(
const char* name)
const;
373 if (mProgramSeparable != separable)
376 mProgramSeparable = separable;
384 bool getProgramBinary(GLenum& binary_format, std::vector<unsigned char>& binary)
const;
387 bool programBinary(GLenum binary_format,
const std::vector<unsigned char>& binary) {
return programBinary(binary_format, &binary[0], (
int)binary.size()); }
390 bool programBinary(GLenum binary_format,
const void* binary,
int length);
413 int location = glGetUniformLocation( handle(), name );
431 glGetUniformfv(handle(), location, params);
VL_CHECK_OGL()
443 glGetUniformiv(handle(), location, params);
VL_CHECK_OGL()
478 Uniform*
getUniform(
const char* name) {
if (!getUniformSet())
return NULL;
return getUniformSet()->getUniform(name); }
482 void eraseUniform(
const char* name) {
if(getUniformSet()) getUniformSet()->eraseUniform(name); }
532 void resetBindingLocations();
int vl_VertexSecondaryColor() const
int vl_VertexTexCoord0() const
GLSLShader * shader(int i)
Returns the i-th GLSLShader objects bound to this GLSLProgram.
void eraseUniform(const Uniform *uniform)
Utility function using getUniformSet(). Erases the specified uniform.
GLSLTessControlShader(const String &source=String())
A shader that is intended to run on the programmable geometry processor.
A shader that is intended to run on the programmable vertex processor.
A shader that is intended to run on the programmable fragment processor.
void getUniform(int location, fmat4 &mat) const
int getUniformLocation(const char *name) const
Returns the binding index of the given uniform.
bool mProgramBinaryRetrievableHint
void getUniform(int location, ivec3 &vec) const
The Renderer class executes the actual rendering on the given RenderQueue.
void setType(EShaderType type)
GLSLVertexShader(const String &source=String())
Constructor.
void getUniform(int location, fvec4 &vec) const
int vl_VertexColor() const
unsigned int handle() const
The handle of this OpenGL shader object as returned by glCreateShader()
The String class implements an advanced UTF16 (Unicode BMP) string manipulation engine.
Wraps a GLSL geometry shader to be bound to a GLSLProgram: the shader this shader will run on the pro...
void getUniform(const char *name, fmat4 &mat) const
Wraps a GLSL vertex shader to be bound to a GLSLProgram: the shader this shader will run on the progr...
virtual ref< RenderState > clone() const
bool linked() const
Returns true if the program has been succesfully linked.
Uniform * gocUniform(const char *name)
Utility function using getUniformSet(). Gets or creates the specified Uniform.
void getUniform(int location, ivec2 &vec) const
GLSLGeometryShader(const String &source=String())
int vl_VertexTexCoord9() const
Represents an OpenGL context, possibly a widget or a pbuffer, which can also respond to keyboard...
The Matrix2 class is a template class that implements a generic 2x2 matrix, see also vl::dmat2...
std::vector< ref< GLSLShader > > mShaders
void getUniform(const char *name, fmat3 &mat) const
void setProgramSeparable(bool separable)
Indicates whether program can be bound to individual pipeline stages via glUseProgramStages, see also http://www.opengl.org/sdk/docs/man4/xhtml/glProgramParameter.xml.
int m_vl_VertexSecondaryColor
int vl_ProjectionMatrix() const
Returns the binding location of the vl_ProjectionMatrix uniform variable or -1 if no such variable is...
void setUniformSet(UniformSet *uniforms)
Sets a GLSLProgram's static UniformSet.
Wraps a GLSL tessellation evaluation shader to be bound to a GLSLProgram: this shader will run on the...
Wraps a GLSL program to which you can bind vertex, fragment and geometry shaders. ...
void getUniformfv(const char *name, float *params) const
Equivalent to getUniformfv(getUniformLocation(name), params)
int vl_VertexNormal() const
const std::string & source() const
Returns the sources for this shader.
void getUniformiv(int location, int *params) const
Equivalent to glGetUniformiv(handle(), location, params)
void getUniform(const char *name, ivec4 &vec) const
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
void setProgramBinaryRetrievableHint(bool hint)
Indicate to the implementation the intention of the application to retrieve the program's binary repr...
void getUniform(const char *name, fvec2 &vec) const
void getUniform(int location, ivec4 &vec) const
int vl_VertexTexCoord7() const
Visualization Library main namespace.
Wraps a GLSL tessellation control shader to be bound to a GLSLProgram: the shader this shader will ru...
Wraps a GLSL fragment shader to be bound to a GLSLProgram: the shader this shader will run on the pro...
int vl_VertexTexCoord3() const
void scheduleRelinking()
Schedules a relink of the GLSL program.
int vl_WorldMatrix() const
Returns the binding location of the vl_WorldMatrix uniform variable or -1 if no such variable is used...
int vl_ModelViewMatrix() const
Returns the binding location of the vl_ModelViewMatrix uniform variable or -1 if no such variable is ...
The Matrix3 class is a template class that implements a generic 3x3 matrix, see also vl::dmat3...
void setPath(const String &path)
The path from which the shader was loaded.
int vl_VertexTexCoord2() const
A shader that is intended to run on the programmable tessellation processor in the evaluation stage...
void getUniform(const char *name, fvec3 &vec) const
void eraseUniform(const char *name)
Utility function using getUniformSet(). Erases the specified uniform.
void getUniform(int location, fvec2 &vec) const
GLSLTessEvaluationShader(const String &source=String())
const std::map< std::string, int > & fragDataLocations() const
int vl_VertexTexCoord10() const
void getUniform(int location, fvec3 &vec) const
UniformSet * getUniformSet()
Returns a GLSLProgram's static UniformSet. Static uniforms are those uniforms whose value is constant...
GLSLFragmentShader(const String &source=String())
The base class for all the reference counted objects.
Base class for those render states which have only one binding point (the vast majority).
int vl_VertexTexCoord4() const
Implements the OpenGL Shading Language convenience functions for scalar and vector operations...
bool programBinaryRetrievableHint() const
Indicate to the implementation the intention of the application to retrieve the program's binary repr...
bool programSeparable() const
Indicates whether program can be bound to individual pipeline stages via glUseProgramStages, see also http://www.opengl.org/sdk/docs/man4/xhtml/glProgramParameter.xml.
void setUniform(Uniform *uniform)
Utility function using getUniformSet(). Adds a Uniform to this program's static uniform set...
void getUniform(const char *name, fmat2 &mat) const
int getAttribLocation(const char *name) const
Eqivalento to glGetAttribLocation(handle(), name).
bool programBinary(GLenum binary_format, const std::vector< unsigned char > &binary)
glProgramBinary wrapper: loads a program object with a program binary, see also http://www.opengl.org/sdk/docs/man4/xhtml/glProgramBinary.xml
int vl_NormalMatrix() const
Returns the binding location of the vl_NormalMatrix uniform variable or -1 if no such variable is use...
int vl_VertexTexCoord1() const
int m_vl_ProjectionMatrix
A shader that is intended to run on the programmable tessellation processor in the control stage...
int m_vl_VertexTexCoord10
void getUniformiv(const char *name, int *params) const
Equivalent to getUniformiv(getUniformLocation(name)
#define VLGRAPHICS_EXPORT
int m_vl_ModelViewProjectionMatrix
std::map< std::string, int > mFragDataLocation
void getUniform(const char *name, ivec2 &vec) const
const String & path() const
The path from which the shader was loaded.
const UniformSet * getUniformSet() const
Returns a GLSLProgram's static UniformSet. Static uniforms are those uniforms whose value is constant...
int vl_VertexTexCoord6() const
void getUniform(const char *name, fvec4 &vec) const
The ref<> class is used to reference-count an Object.
ref< UniformSet > mUniformSet
void getUniform(const char *name, ivec3 &vec) const
void getUniform(int location, fmat2 &mat) const
Represents a virtual camera defining, among other things, the point of view from which scenes can be ...
unsigned int handle() const
The handle of the GLSL program as returned by glCreateProgram()
Uniform * getUniform(const char *name)
Utility function using getUniformSet(). Returns the specified Uniform. Returns NULL if there isn't su...
void getUniform(int location, fmat3 &mat) const
int shaderCount() const
Returns the number of GLSLShader objects bound to this GLSLProgram.
void getUniformfv(int location, float *params) const
Equivalent to glGetUniformfv(handle(), location, params)
void eraseAllUniforms()
Utility function using getUniformSet(). Erases all the uniforms.
const GLSLShader * shader(int i) const
Returns the i-th GLSLShader objects bound to this GLSLProgram.
int vl_VertexTexCoord5() const
int vl_ModelViewProjectionMatrix() const
Returns the binding location of the vl_ModelViewProjectionMatrix uniform variable or -1 if no such va...
int vl_VertexFogCoord() const
int vl_VertexPosition() const
int vl_VertexTexCoord8() const