Visualization Library v1.0.3

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Attributes | Friends

vl::GLSLProgram Class Reference

Wraps a GLSL program to which you can bind vertex, fragment and geometry shaders. More...

#include <GLSL.hpp>

Inheritance diagram for vl::GLSLProgram:
vl::RenderStateNonIndexed vl::RenderState vl::Object

List of all members.

Public Member Functions

 GLSLProgram ()
 Constructor.
 ~GLSLProgram ()
 Destructor. Calls deleteProgram().
virtual ERenderState type () const
virtual ref< RenderStateclone () const
GLSLProgramoperator= (const GLSLProgram &other)
void createProgram ()
 Calls glCreateProgram() in order to acquire a GLSL program handle, see also http://www.opengl.org/sdk/docs/man/xhtml/glCreateProgram.xml for more information.
void deleteProgram ()
 Deletes the GLSL program calling glDeleteProgram(handle()), see also http://www.opengl.org/sdk/docs/man/xhtml/glDeleteProgram.xml for more information.
unsigned int handle () const
 The handle of the GLSL program as returned by glCreateProgram()
bool useProgram () const
 Equivalent to glUseProgram(handle()), see also http://www.opengl.org/sdk/docs/man/xhtml/glUseProgram.xml for more information.
void apply (int index, const Camera *, OpenGLContext *ctx) const
 Calls useProgram()
bool linkProgram (bool force_relink=false)
 Links the GLSLProgram calling glLinkProgram(handle()) only if the program needs to be linked.
bool linkStatus () const
bool linked () const
 Returns true if the program has been succesfully linked.
void scheduleRelinking ()
 Schedules a relink of the GLSL program.
bool attachShader (GLSLShader *shader)
 Attaches the GLSLShader to this GLSLProgram.
bool detachShader (GLSLShader *shader)
 Detaches a GLSLShader from the GLSLShader (note: it does NOT schedule a relink of the program), see also http://www.opengl.org/sdk/docs/man/xhtml/glDetachShader.xml for more information.
void discardAllShaders ()
 Detaches all the shaders and deletes them (note that the GLSL Program remains still valid).
String infoLog () const
 Returns the info log of this GLSL program using the OpenGL function glGetProgramInfoLog(), see also http://www.opengl.org/sdk/docs/man/xhtml/glGetProgramInfoLog.xml for more information.
bool validateProgram () const
 Returns true if the validation of this GLSL program is succesful, see also http://www.opengl.org/sdk/docs/man/xhtml/glValidateProgram.xml for more information.
void bindAttribLocation (unsigned int index, const char *name)
 Equivalent to glBindAttribLocation(handle(), index, name.c_str()) with the difference that this function will automatically create a GLSL program if none is present and it will schedule a re-link since the new specified bindings take effect after linking the GLSL program.
void addAutoAttribLocation (int attr_index, const char *attr_name)
 Adds an attribute name / index pair to the automatic attribute location binding list.
void removeAutoAttribLocation (const char *attr_name)
 Removes an attribute from the automatic attribute location binding list.
void setAutoAttribLocations (const std::map< std::string, int > &attrib_bindings)
 Defines which attribute should be automatically bound to which attribute index at GLSL program linking time.
const std::map< std::string,
int > & 
autoAttribLocations () const
 Returns which attribute name should be automatically bound to which attribute index at GLSL program linking time.
void clearAutoAttribLocations ()
 Clears the automatic attribute location binding list.
int getAttribLocation (const char *name) const
 Eqivalento to glGetAttribLocation(handle(), name).
int shaderCount () const
 Returns the number of GLSLShader objects bound to this GLSLProgram.
const GLSLShadershader (int i) const
 Returns the i-th GLSLShader objects bound to this GLSLProgram.
GLSLShadershader (int i)
 Returns the i-th GLSLShader objects bound to this GLSLProgram.
void detachAllShaders ()
 Removes all the previously linked shaders and schedules a relinking.
void bindFragDataLocation (int color_number, const char *name)
void unbindFragDataLocation (const char *name)
int fragDataLocation (const char *name) const
const std::map< std::string,
int > & 
fragDataLocations () const
void setGeometryVerticesOut (int vertex_count)
 See GL_ARB_geometry_shader4's GL_GEOMETRY_VERTICES_OUT_EXT.
int geometryVerticesOut () const
 See GL_ARB_geometry_shader4's GL_GEOMETRY_VERTICES_OUT_EXT.
void setGeometryInputType (EGeometryInputType type)
 See GL_ARB_geometry_shader4's GL_GEOMETRY_INPUT_TYPE_EXT.
EGeometryInputType geometryInputType () const
 See GL_ARB_geometry_shader4's GL_GEOMETRY_INPUT_TYPE_EXT.
void setGeometryOutputType (EGeometryOutputType type)
 See GL_ARB_geometry_shader4's GL_GEOMETRY_OUTPUT_TYPE_EXT.
EGeometryOutputType geometryOutputType () const
 See GL_ARB_geometry_shader4's GL_GEOMETRY_OUTPUT_TYPE_EXT.
void setProgramBinaryRetrievableHint (bool hint)
 Indicate to the implementation the intention of the application to retrieve the program's binary representation with glGetProgramBinary.
bool programBinaryRetrievableHint () const
 Indicate to the implementation the intention of the application to retrieve the program's binary representation with glGetProgramBinary.
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.
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.
bool getProgramBinary (GLenum &binary_format, std::vector< unsigned char > &binary) const
 glGetProgramBinary wrapper: returns a binary representation of a program object's compiled and linked executable source, see also http://www.opengl.org/sdk/docs/man4/xhtml/glGetProgramBinary.xml
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
bool programBinary (GLenum binary_format, const void *binary, int length)
 glProgramBinary wrapper: loads a program object with a program binary, see also http://www.opengl.org/sdk/docs/man4/xhtml/glProgramBinary.xml
bool applyUniformSet (const UniformSet *uniforms) const
 Applies a set of uniforms to the currently bound GLSL program.
int getUniformLocation (const char *name) const
 Returns the binding index of the given uniform.
void getUniformfv (int location, float *params) const
 Equivalent to glGetUniformfv(handle(), location, params)
void getUniformfv (const char *name, float *params) const
 Equivalent to getUniformfv(getUniformLocation(name), params)
void getUniformiv (int location, int *params) const
 Equivalent to glGetUniformiv(handle(), location, params)
void getUniformiv (const char *name, int *params) const
 Equivalent to getUniformiv(getUniformLocation(name)
void getUniform (int location, fvec2 &vec) const
void getUniform (int location, fvec3 &vec) const
void getUniform (int location, fvec4 &vec) const
void getUniform (int location, fmat2 &mat) const
void getUniform (int location, fmat3 &mat) const
void getUniform (int location, fmat4 &mat) const
void getUniform (int location, ivec2 &vec) const
void getUniform (int location, ivec3 &vec) const
void getUniform (int location, ivec4 &vec) const
void getUniform (const char *name, fvec2 &vec) const
void getUniform (const char *name, fvec3 &vec) const
void getUniform (const char *name, fvec4 &vec) const
void getUniform (const char *name, fmat2 &mat) const
void getUniform (const char *name, fmat3 &mat) const
void getUniform (const char *name, fmat4 &mat) const
void getUniform (const char *name, ivec2 &vec) const
void getUniform (const char *name, ivec3 &vec) const
void getUniform (const char *name, ivec4 &vec) const
UniformSetgetUniformSet ()
 Returns a GLSLProgram's static UniformSet. Static uniforms are those uniforms whose value is constant across one rendering as opposed to Shader uniforms that change across Shaders and Actor uniforms that change across Actors.
const UniformSetgetUniformSet () const
 Returns a GLSLProgram's static UniformSet. Static uniforms are those uniforms whose value is constant across one rendering as opposed to Shader uniforms that change across Shaders and Actor uniforms that change across Actors.
void setUniformSet (UniformSet *uniforms)
 Sets a GLSLProgram's static UniformSet.
void setUniform (Uniform *uniform)
 Utility function using getUniformSet(). Adds a Uniform to this program's static uniform set.
UniformgetUniform (const char *name)
 Utility function using getUniformSet(). Returns the specified Uniform. Returns NULL if there isn't such a Uniform.
UniformgocUniform (const char *name)
 Utility function using getUniformSet(). Gets or creates the specified Uniform.
void eraseUniform (const char *name)
 Utility function using getUniformSet(). Erases the specified uniform.
void eraseUniform (const Uniform *uniform)
 Utility function using getUniformSet(). Erases the specified uniform.
void eraseAllUniforms ()
 Utility function using getUniformSet(). Erases all the uniforms.
const std::map< std::string,
ref< UniformInfo > > & 
activeUniforms () const
 Returns a map containing name, type, size and location of all the uniforms that were active last time the GLSL program was linked.
const UniformInfoactiveUniformInfo (const char *name) const
 Returns the info (name, type, size and location) regarding the specified uniform or NULL if such uniform is not currently active since last time the GLSL program was linked.
const std::map< std::string,
ref< AttribInfo > > & 
activeAttribs () const
 Returns a map containing the info of all the attributes active since last time the GLSL program was linked.
const AttribInfoactiveAttribInfo (const char *name) const
 Returns the info regarding the specified attribute or NULL if such attribute is not currently active since last time the GLSL program was linked.
int vl_ModelViewMatrix () const
 Returns the binding location of the vl_ModelViewMatrix uniform variable or -1 if no such variable is used by the GLSLProgram.
int vl_ProjectionMatrix () const
 Returns the binding location of the vl_ProjectionMatrix uniform variable or -1 if no such variable is used by the GLSLProgram.
int vl_ModelViewProjectionMatrix () const
 Returns the binding location of the vl_ModelViewProjectionMatrix uniform variable or -1 if no such variable is used by the GLSLProgram.
int vl_NormalMatrix () const
 Returns the binding location of the vl_NormalMatrix uniform variable or -1 if no such variable is used by the GLSLProgram.

Protected Attributes

std::vector< ref< GLSLShader > > mShaders
std::map< std::string, int > mFragDataLocation
std::map< std::string, ref
< UniformInfo > > 
mActiveUniforms
std::map< std::string, ref
< AttribInfo > > 
mActiveAttribs
std::map< std::string, int > mAutoAttribLocation
ref< UniformSetmUniformSet
unsigned int mHandle
bool mScheduleLink
int mGeometryVerticesOut
EGeometryInputType mGeometryInputType
EGeometryOutputType mGeometryOutputType
bool mProgramBinaryRetrievableHint
bool mProgramSeparable
int m_vl_ModelViewMatrix
int m_vl_ProjectionMatrix
int m_vl_ModelViewProjectionMatrix
int m_vl_NormalMatrix

Friends

class Renderer

Detailed Description

Wraps a GLSL program to which you can bind vertex, fragment and geometry shaders.

Uniforms
You have 5 ways to set the value of a uniform:
  1. call useProgram() to activate the GLSLProgram and directly call glUniform* (see also getUniformLocation()).
  2. add a Uniform to the GLSLProgram UniformSet, see vl::GLSLProgram::getUniformSet().
  3. add a Uniform to the Actor's UniformSet, see vl::Actor::getUniformSet().
  4. add a Uniform to the Actor's Shader UniformSet, see vl::Shader::getUniformSet().
  5. directly update the uniform value from ActorEventCallback::onActorRenderStarted() using the standard glUniform*() OpenGL functions. In this case you have to make sure that all the Actors using a given GLSLProgram/Shader write such uniform.
Remarks:
A Uniform must be setup using one and only one of the 5 previously mentioned methods.
Attribute Location Bindings
In order to explicity specify which attribute index should be bound to which attribute name you can do one of the following.
  1. call glBindAttribLocation() with the appropriate GLSLProgram::handle(). This is the most low level way of doing it.
  2. call bindAttribLocation() as you would do normally with glBindAttribLocation() but with the difference the you don't need to specify the GLSL program handle.
  3. create a list of attribute name/indices that will be automatically bound whenever the GLSLProgram is linked. In order to do so you can use the following functions setAutoAttribLocations(), autoAttribLocations(), clearAutoAttribLocations(), addAutoAttribLocation(), removeAutoAttribLocation().

Note that for option #1 and #2 you need to relink the GLSLProgram in order for the changes to take effect (linkProgram(force_relink=true)). Option #2 and #3 automatically schedule a re-link of the GLSL program. See also http://www.opengl.org/sdk/docs/man/xhtml/glBindAttribLocation.xml

See also:

Definition at line 264 of file GLSL.hpp.


Constructor & Destructor Documentation

GLSLProgram::GLSLProgram (  )
GLSLProgram::~GLSLProgram (  )

Destructor. Calls deleteProgram().

Definition at line 262 of file GLSL.cpp.

References deleteProgram(), and handle().


Member Function Documentation

virtual ERenderState vl::GLSLProgram::type (  ) const [inline, virtual]

Reimplemented from vl::RenderState.

Definition at line 278 of file GLSL.hpp.

References vl::RS_GLSLProgram.

virtual ref<RenderState> vl::GLSLProgram::clone (  ) const [inline, virtual]

Implements vl::RenderState.

Definition at line 280 of file GLSL.hpp.

GLSLProgram & GLSLProgram::operator= ( const GLSLProgram other )
void GLSLProgram::createProgram (  )

Calls glCreateProgram() in order to acquire a GLSL program handle, see also http://www.opengl.org/sdk/docs/man/xhtml/glCreateProgram.xml for more information.

Note:
The program is created only if handle() == 0

Definition at line 308 of file GLSL.cpp.

References handle(), vl::Has_GLSL, mHandle, scheduleRelinking(), VL_CHECK, and VL_CHECK_OGL.

Referenced by attachShader(), bindAttribLocation(), linkProgram(), and programBinary().

void GLSLProgram::deleteProgram (  )

Deletes the GLSL program calling glDeleteProgram(handle()), see also http://www.opengl.org/sdk/docs/man/xhtml/glDeleteProgram.xml for more information.

After this function handle() will return 0.

Definition at line 323 of file GLSL.cpp.

References handle(), vl::Has_GLSL, mHandle, scheduleRelinking(), and VL_CHECK.

Referenced by operator=(), and ~GLSLProgram().

unsigned int vl::GLSLProgram::handle (  ) const [inline]
bool GLSLProgram::useProgram (  ) const

Equivalent to glUseProgram(handle()), see also http://www.opengl.org/sdk/docs/man/xhtml/glUseProgram.xml for more information.

Definition at line 677 of file GLSL.cpp.

References vl::Log::bug(), handle(), vl::Has_GLSL, linked(), vl::Object::objectName(), VL_CHECK, VL_CHECK_OGL, and VL_TRAP.

Referenced by apply().

void GLSLProgram::apply ( int  index,
const Camera ,
OpenGLContext ctx 
) const [virtual]

Calls useProgram()

Implements vl::RenderState.

Definition at line 715 of file GLSL.cpp.

References handle(), vl::Has_GLSL, useProgram(), and VL_CHECK_OGL.

bool GLSLProgram::linkProgram ( bool  force_relink = false )
bool GLSLProgram::linkStatus (  ) const

Definition at line 612 of file GLSL.cpp.

References handle(), vl::Has_GLSL, VL_CHECK, and VL_CHECK_OGL.

Referenced by linkProgram(), and programBinary().

bool vl::GLSLProgram::linked (  ) const [inline]

Returns true if the program has been succesfully linked.

Definition at line 321 of file GLSL.hpp.

Referenced by applyUniformSet(), vl::Rendering::fillRenderQueue(), linkProgram(), programBinary(), vl::Renderer::render(), and useProgram().

void vl::GLSLProgram::scheduleRelinking (  ) [inline]

Schedules a relink of the GLSL program.

Definition at line 324 of file GLSL.hpp.

Referenced by attachShader(), bindAttribLocation(), bindFragDataLocation(), createProgram(), deleteProgram(), and unbindFragDataLocation().

bool GLSLProgram::attachShader ( GLSLShader shader )

Attaches the GLSLShader to this GLSLProgram.

Note:
Attaching a shader triggers the compilation of the shader (if not already compiled) and relinking of the program.

Definition at line 337 of file GLSL.cpp.

References vl::GLSLShader::compile(), createProgram(), detachShader(), handle(), vl::GLSLShader::handle(), vl::Has_GLSL, mShaders, scheduleRelinking(), shader(), VL_CHECK, and VL_CHECK_OGL.

Referenced by vl::VLXClassWrapper_GLSLProgram::importGLSLProgram(), and operator=().

bool GLSLProgram::detachShader ( GLSLShader shader )

Detaches a GLSLShader from the GLSLShader (note: it does NOT schedule a relink of the program), see also http://www.opengl.org/sdk/docs/man/xhtml/glDetachShader.xml for more information.

Definition at line 379 of file GLSL.cpp.

References vl::GLSLShader::handle(), handle(), vl::Has_GLSL, mShaders, VL_CHECK, and VL_CHECK_OGL.

Referenced by attachShader(), and detachAllShaders().

void GLSLProgram::discardAllShaders (  )

Detaches all the shaders and deletes them (note that the GLSL Program remains still valid).

Use this function when your GLSL program compiled well, you don't want to re-link or re-compile it and you want to save some memory by discarding unnecessary shaders objects.

Definition at line 405 of file GLSL.cpp.

References handle(), vl::Has_GLSL, mShaders, VL_CHECK, and VL_CHECK_OGL.

String GLSLProgram::infoLog (  ) const

Returns the info log of this GLSL program using the OpenGL function glGetProgramInfoLog(), see also http://www.opengl.org/sdk/docs/man/xhtml/glGetProgramInfoLog.xml for more information.

Definition at line 629 of file GLSL.cpp.

References handle(), vl::Has_GLSL, NULL, vl::Object::objectName(), VL_CHECK, and VL_CHECK_OGL.

Referenced by linkProgram(), and programBinary().

bool GLSLProgram::validateProgram (  ) const

Returns true if the validation of this GLSL program is succesful, see also http://www.opengl.org/sdk/docs/man/xhtml/glValidateProgram.xml for more information.

Definition at line 649 of file GLSL.cpp.

References handle(), vl::Has_GLSL, VL_CHECK, and VL_CHECK_OGL.

void GLSLProgram::bindAttribLocation ( unsigned int  index,
const char *  name 
)

Equivalent to glBindAttribLocation(handle(), index, name.c_str()) with the difference that this function will automatically create a GLSL program if none is present and it will schedule a re-link since the new specified bindings take effect after linking the GLSL program.

See also:
setAutoAttribLocations(), autoAttribLocations(), clearAutoAttribLocations(), removeAutoAttribLocation(), addAutoAttribLocation()

Definition at line 667 of file GLSL.cpp.

References createProgram(), handle(), vl::Has_GLSL, scheduleRelinking(), VL_CHECK, and VL_CHECK_OGL.

void vl::GLSLProgram::addAutoAttribLocation ( int  attr_index,
const char *  attr_name 
) [inline]

Adds an attribute name / index pair to the automatic attribute location binding list.

Calling this function will schedule a re-linking of the GLSL program.

See also:
setAutoAttribLocations(), autoAttribLocations(), clearAutoAttribLocations(), bindAttribLocation(), removeAutoAttribLocation()

Definition at line 356 of file GLSL.hpp.

Referenced by vl::VLXClassWrapper_GLSLProgram::importGLSLProgram().

void vl::GLSLProgram::removeAutoAttribLocation ( const char *  attr_name ) [inline]

Removes an attribute from the automatic attribute location binding list.

Calling this function will schedule a re-linking of the GLSL program.

See also:
setAutoAttribLocations(), autoAttribLocations(), clearAutoAttribLocations(), bindAttribLocation(), addAutoAttribLocation()

Definition at line 361 of file GLSL.hpp.

void vl::GLSLProgram::setAutoAttribLocations ( const std::map< std::string, int > &  attrib_bindings ) [inline]

Defines which attribute should be automatically bound to which attribute index at GLSL program linking time.

Calling this function will schedule a re-linking of the GLSL program.

See also:
autoAttribLocations(), clearAutoAttribLocations(), bindAttribLocation(), removeAutoAttribLocation(), addAutoAttribLocation()

Definition at line 366 of file GLSL.hpp.

const std::map<std::string, int>& vl::GLSLProgram::autoAttribLocations (  ) const [inline]

Returns which attribute name should be automatically bound to which attribute index at GLSL program linking time.

See also:
setAutoAttribLocations(), clearAutoAttribLocations(), bindAttribLocation(), removeAutoAttribLocation(), addAutoAttribLocation()

Definition at line 371 of file GLSL.hpp.

Referenced by vl::VLXClassWrapper_GLSLProgram::exportGLSLProgram().

void vl::GLSLProgram::clearAutoAttribLocations (  ) [inline]

Clears the automatic attribute location binding list.

See also setAutoAttribLocations() and autoAttribLocations().

See also:
setAutoAttribLocations(), autoAttribLocations(), bindAttribLocation(), removeAutoAttribLocation(), addAutoAttribLocation()

Definition at line 376 of file GLSL.hpp.

int vl::GLSLProgram::getAttribLocation ( const char *  name ) const [inline]

Eqivalento to glGetAttribLocation(handle(), name).

Note:
The program must be linked before calling this function.

Definition at line 380 of file GLSL.hpp.

References vl::Has_GLSL, and VL_CHECK.

Referenced by vl::MorphingCallback::onActorRenderStarted().

int vl::GLSLProgram::shaderCount (  ) const [inline]

Returns the number of GLSLShader objects bound to this GLSLProgram.

Definition at line 392 of file GLSL.hpp.

Referenced by vl::VLXClassWrapper_GLSLProgram::exportGLSLProgram(), and linkProgram().

const GLSLShader* vl::GLSLProgram::shader ( int  i ) const [inline]

Returns the i-th GLSLShader objects bound to this GLSLProgram.

Definition at line 395 of file GLSL.hpp.

Referenced by attachShader(), and vl::VLXClassWrapper_GLSLProgram::exportGLSLProgram().

GLSLShader* vl::GLSLProgram::shader ( int  i ) [inline]

Returns the i-th GLSLShader objects bound to this GLSLProgram.

Definition at line 398 of file GLSL.hpp.

void GLSLProgram::detachAllShaders (  )

Removes all the previously linked shaders and schedules a relinking.

Definition at line 371 of file GLSL.cpp.

References detachShader(), mShaders, and VL_CHECK_OGL.

void GLSLProgram::bindFragDataLocation ( int  color_number,
const char *  name 
)

Definition at line 849 of file GLSL.cpp.

References mFragDataLocation, and scheduleRelinking().

Referenced by vl::VLXClassWrapper_GLSLProgram::importGLSLProgram().

void GLSLProgram::unbindFragDataLocation ( const char *  name )

Definition at line 855 of file GLSL.cpp.

References mFragDataLocation, and scheduleRelinking().

int GLSLProgram::fragDataLocation ( const char *  name ) const

Definition at line 861 of file GLSL.cpp.

References mFragDataLocation.

const std::map<std::string, int>& vl::GLSLProgram::fragDataLocations (  ) const [inline]

Definition at line 411 of file GLSL.hpp.

Referenced by vl::VLXClassWrapper_GLSLProgram::exportGLSLProgram().

void vl::GLSLProgram::setGeometryVerticesOut ( int  vertex_count ) [inline]

See GL_ARB_geometry_shader4's GL_GEOMETRY_VERTICES_OUT_EXT.

Definition at line 416 of file GLSL.hpp.

int vl::GLSLProgram::geometryVerticesOut (  ) const [inline]

See GL_ARB_geometry_shader4's GL_GEOMETRY_VERTICES_OUT_EXT.

Definition at line 426 of file GLSL.hpp.

void vl::GLSLProgram::setGeometryInputType ( EGeometryInputType  type ) [inline]

See GL_ARB_geometry_shader4's GL_GEOMETRY_INPUT_TYPE_EXT.

Definition at line 429 of file GLSL.hpp.

EGeometryInputType vl::GLSLProgram::geometryInputType (  ) const [inline]

See GL_ARB_geometry_shader4's GL_GEOMETRY_INPUT_TYPE_EXT.

Definition at line 438 of file GLSL.hpp.

void vl::GLSLProgram::setGeometryOutputType ( EGeometryOutputType  type ) [inline]

See GL_ARB_geometry_shader4's GL_GEOMETRY_OUTPUT_TYPE_EXT.

Definition at line 441 of file GLSL.hpp.

EGeometryOutputType vl::GLSLProgram::geometryOutputType (  ) const [inline]

See GL_ARB_geometry_shader4's GL_GEOMETRY_OUTPUT_TYPE_EXT.

Definition at line 451 of file GLSL.hpp.

void vl::GLSLProgram::setProgramBinaryRetrievableHint ( bool  hint ) [inline]

Indicate to the implementation the intention of the application to retrieve the program's binary representation with glGetProgramBinary.

The implementation may use this information to store information that may be useful for a future query of the program's binary. See http://www.opengl.org/sdk/docs/man4/xhtml/glProgramParameter.xml

Definition at line 458 of file GLSL.hpp.

bool vl::GLSLProgram::programBinaryRetrievableHint (  ) const [inline]

Indicate to the implementation the intention of the application to retrieve the program's binary representation with glGetProgramBinary.

The implementation may use this information to store information that may be useful for a future query of the program's binary. See http://www.opengl.org/sdk/docs/man4/xhtml/glProgramParameter.xml

Definition at line 463 of file GLSL.hpp.

void vl::GLSLProgram::setProgramSeparable ( bool  separable ) [inline]

Indicates whether program can be bound to individual pipeline stages via glUseProgramStages, see also http://www.opengl.org/sdk/docs/man4/xhtml/glProgramParameter.xml.

Note:
Changing the program-separable attribute will schedule a relink of the GLSL program.

Definition at line 467 of file GLSL.hpp.

bool vl::GLSLProgram::programSeparable (  ) const [inline]

Indicates whether program can be bound to individual pipeline stages via glUseProgramStages, see also http://www.opengl.org/sdk/docs/man4/xhtml/glProgramParameter.xml.

Definition at line 477 of file GLSL.hpp.

bool GLSLProgram::getProgramBinary ( GLenum &  binary_format,
std::vector< unsigned char > &  binary 
) const

glGetProgramBinary wrapper: returns a binary representation of a program object's compiled and linked executable source, see also http://www.opengl.org/sdk/docs/man4/xhtml/glGetProgramBinary.xml

Definition at line 870 of file GLSL.cpp.

References handle(), NULL, VL_CHECK, VL_CHECK_OGL, and VL_TRAP.

bool vl::GLSLProgram::programBinary ( GLenum  binary_format,
const std::vector< unsigned char > &  binary 
) [inline]

glProgramBinary wrapper: loads a program object with a program binary, see also http://www.opengl.org/sdk/docs/man4/xhtml/glProgramBinary.xml

Definition at line 483 of file GLSL.hpp.

References programBinary().

Referenced by programBinary().

bool GLSLProgram::programBinary ( GLenum  binary_format,
const void *  binary,
int  length 
)
bool GLSLProgram::applyUniformSet ( const UniformSet uniforms ) const
int vl::GLSLProgram::getUniformLocation ( const char *  name ) const [inline]

Returns the binding index of the given uniform.

Definition at line 499 of file GLSL.hpp.

References vl::Has_GLSL, and VL_CHECK.

Referenced by vl::MorphingCallback::onActorRenderStarted(), vl::SlicedVolume::updateUniforms(), and vl::RaycastVolume::updateUniforms().

void vl::GLSLProgram::getUniformfv ( int  location,
float *  params 
) const [inline]

Equivalent to glGetUniformfv(handle(), location, params)

Definition at line 516 of file GLSL.hpp.

References vl::Has_GLSL, VL_CHECK, and VL_CHECK_OGL.

void vl::GLSLProgram::getUniformfv ( const char *  name,
float *  params 
) const [inline]

Equivalent to getUniformfv(getUniformLocation(name), params)

Definition at line 526 of file GLSL.hpp.

References getUniformfv().

Referenced by getUniformfv().

void vl::GLSLProgram::getUniformiv ( int  location,
int *  params 
) const [inline]

Equivalent to glGetUniformiv(handle(), location, params)

Definition at line 528 of file GLSL.hpp.

References vl::Has_GLSL, VL_CHECK, and VL_CHECK_OGL.

void vl::GLSLProgram::getUniformiv ( const char *  name,
int *  params 
) const [inline]

Equivalent to getUniformiv(getUniformLocation(name)

Definition at line 538 of file GLSL.hpp.

References getUniformiv().

Referenced by getUniformiv().

void vl::GLSLProgram::getUniform ( int  location,
fvec2 vec 
) const [inline]

Definition at line 542 of file GLSL.hpp.

References vl::Vector2< T_Scalar >::ptr().

void vl::GLSLProgram::getUniform ( int  location,
fvec3 vec 
) const [inline]

Definition at line 543 of file GLSL.hpp.

References vl::Vector3< T_Scalar >::ptr().

void vl::GLSLProgram::getUniform ( int  location,
fvec4 vec 
) const [inline]

Definition at line 544 of file GLSL.hpp.

References vl::Vector4< T_Scalar >::ptr().

void vl::GLSLProgram::getUniform ( int  location,
fmat2 mat 
) const [inline]

Definition at line 545 of file GLSL.hpp.

References vl::Matrix2< T_Scalar >::ptr().

void vl::GLSLProgram::getUniform ( int  location,
fmat3 mat 
) const [inline]

Definition at line 546 of file GLSL.hpp.

References vl::Matrix3< T_Scalar >::ptr().

void vl::GLSLProgram::getUniform ( int  location,
fmat4 mat 
) const [inline]

Definition at line 547 of file GLSL.hpp.

References vl::Matrix4< T_Scalar >::ptr().

void vl::GLSLProgram::getUniform ( int  location,
ivec2 vec 
) const [inline]

Definition at line 548 of file GLSL.hpp.

References vl::Vector2< T_Scalar >::ptr().

void vl::GLSLProgram::getUniform ( int  location,
ivec3 vec 
) const [inline]

Definition at line 549 of file GLSL.hpp.

References vl::Vector3< T_Scalar >::ptr().

void vl::GLSLProgram::getUniform ( int  location,
ivec4 vec 
) const [inline]

Definition at line 550 of file GLSL.hpp.

References vl::Vector4< T_Scalar >::ptr().

void vl::GLSLProgram::getUniform ( const char *  name,
fvec2 vec 
) const [inline]

Definition at line 551 of file GLSL.hpp.

References getUniform().

Referenced by getUniform().

void vl::GLSLProgram::getUniform ( const char *  name,
fvec3 vec 
) const [inline]

Definition at line 552 of file GLSL.hpp.

References getUniform().

Referenced by getUniform().

void vl::GLSLProgram::getUniform ( const char *  name,
fvec4 vec 
) const [inline]

Definition at line 553 of file GLSL.hpp.

References getUniform().

Referenced by getUniform().

void vl::GLSLProgram::getUniform ( const char *  name,
fmat2 mat 
) const [inline]

Definition at line 554 of file GLSL.hpp.

References getUniform().

Referenced by getUniform().

void vl::GLSLProgram::getUniform ( const char *  name,
fmat3 mat 
) const [inline]

Definition at line 555 of file GLSL.hpp.

References getUniform().

Referenced by getUniform().

void vl::GLSLProgram::getUniform ( const char *  name,
fmat4 mat 
) const [inline]

Definition at line 556 of file GLSL.hpp.

References getUniform().

Referenced by getUniform().

void vl::GLSLProgram::getUniform ( const char *  name,
ivec2 vec 
) const [inline]

Definition at line 557 of file GLSL.hpp.

References getUniform().

Referenced by getUniform().

void vl::GLSLProgram::getUniform ( const char *  name,
ivec3 vec 
) const [inline]

Definition at line 558 of file GLSL.hpp.

References getUniform().

Referenced by getUniform().

void vl::GLSLProgram::getUniform ( const char *  name,
ivec4 vec 
) const [inline]

Definition at line 559 of file GLSL.hpp.

References getUniform().

Referenced by getUniform().

UniformSet* vl::GLSLProgram::getUniformSet (  ) [inline]

Returns a GLSLProgram's static UniformSet. Static uniforms are those uniforms whose value is constant across one rendering as opposed to Shader uniforms that change across Shaders and Actor uniforms that change across Actors.

Definition at line 562 of file GLSL.hpp.

Referenced by vl::VLXClassWrapper_GLSLProgram::exportGLSLProgram(), and vl::Renderer::render().

const UniformSet* vl::GLSLProgram::getUniformSet (  ) const [inline]

Returns a GLSLProgram's static UniformSet. Static uniforms are those uniforms whose value is constant across one rendering as opposed to Shader uniforms that change across Shaders and Actor uniforms that change across Actors.

Definition at line 564 of file GLSL.hpp.

void vl::GLSLProgram::setUniformSet ( UniformSet uniforms ) [inline]

Sets a GLSLProgram's static UniformSet.

Definition at line 566 of file GLSL.hpp.

void vl::GLSLProgram::setUniform ( Uniform uniform ) [inline]

Utility function using getUniformSet(). Adds a Uniform to this program's static uniform set.

Definition at line 568 of file GLSL.hpp.

Referenced by vl::VLXClassWrapper_GLSLProgram::importGLSLProgram().

Uniform* vl::GLSLProgram::getUniform ( const char *  name ) [inline]

Utility function using getUniformSet(). Returns the specified Uniform. Returns NULL if there isn't such a Uniform.

Definition at line 570 of file GLSL.hpp.

References NULL.

Uniform* vl::GLSLProgram::gocUniform ( const char *  name ) [inline]

Utility function using getUniformSet(). Gets or creates the specified Uniform.

Definition at line 572 of file GLSL.hpp.

void vl::GLSLProgram::eraseUniform ( const char *  name ) [inline]

Utility function using getUniformSet(). Erases the specified uniform.

Definition at line 574 of file GLSL.hpp.

void vl::GLSLProgram::eraseUniform ( const Uniform uniform ) [inline]

Utility function using getUniformSet(). Erases the specified uniform.

Definition at line 576 of file GLSL.hpp.

void vl::GLSLProgram::eraseAllUniforms (  ) [inline]

Utility function using getUniformSet(). Erases all the uniforms.

Definition at line 578 of file GLSL.hpp.

const std::map<std::string, ref<UniformInfo> >& vl::GLSLProgram::activeUniforms (  ) const [inline]

Returns a map containing name, type, size and location of all the uniforms that were active last time the GLSL program was linked.

Definition at line 582 of file GLSL.hpp.

Referenced by applyUniformSet().

const UniformInfo* vl::GLSLProgram::activeUniformInfo ( const char *  name ) const [inline]

Returns the info (name, type, size and location) regarding the specified uniform or NULL if such uniform is not currently active since last time the GLSL program was linked.

Definition at line 586 of file GLSL.hpp.

References NULL.

Referenced by applyUniformSet().

const std::map<std::string, ref<AttribInfo> >& vl::GLSLProgram::activeAttribs (  ) const [inline]

Returns a map containing the info of all the attributes active since last time the GLSL program was linked.

Definition at line 597 of file GLSL.hpp.

const AttribInfo* vl::GLSLProgram::activeAttribInfo ( const char *  name ) const [inline]

Returns the info regarding the specified attribute or NULL if such attribute is not currently active since last time the GLSL program was linked.

Definition at line 601 of file GLSL.hpp.

References NULL.

int vl::GLSLProgram::vl_ModelViewMatrix (  ) const [inline]

Returns the binding location of the vl_ModelViewMatrix uniform variable or -1 if no such variable is used by the GLSLProgram.

Definition at line 611 of file GLSL.hpp.

Referenced by vl::ProjViewTransfCallback::updateMatrices().

int vl::GLSLProgram::vl_ProjectionMatrix (  ) const [inline]

Returns the binding location of the vl_ProjectionMatrix uniform variable or -1 if no such variable is used by the GLSLProgram.

Definition at line 614 of file GLSL.hpp.

Referenced by vl::ProjViewTransfCallback::updateMatrices().

int vl::GLSLProgram::vl_ModelViewProjectionMatrix (  ) const [inline]

Returns the binding location of the vl_ModelViewProjectionMatrix uniform variable or -1 if no such variable is used by the GLSLProgram.

Definition at line 617 of file GLSL.hpp.

Referenced by vl::ProjViewTransfCallback::updateMatrices().

int vl::GLSLProgram::vl_NormalMatrix (  ) const [inline]

Returns the binding location of the vl_NormalMatrix uniform variable or -1 if no such variable is used by the GLSLProgram.

Definition at line 620 of file GLSL.hpp.

Referenced by vl::ProjViewTransfCallback::updateMatrices().


Friends And Related Function Documentation

friend class Renderer [friend]

Definition at line 269 of file GLSL.hpp.


Member Data Documentation

std::vector< ref<GLSLShader> > vl::GLSLProgram::mShaders [protected]

Definition at line 627 of file GLSL.hpp.

Referenced by attachShader(), detachAllShaders(), detachShader(), discardAllShaders(), and operator=().

std::map<std::string, int> vl::GLSLProgram::mFragDataLocation [protected]
std::map<std::string, ref<UniformInfo> > vl::GLSLProgram::mActiveUniforms [protected]

Definition at line 629 of file GLSL.hpp.

Referenced by operator=().

std::map<std::string, ref<AttribInfo> > vl::GLSLProgram::mActiveAttribs [protected]

Definition at line 630 of file GLSL.hpp.

Referenced by operator=().

std::map<std::string, int> vl::GLSLProgram::mAutoAttribLocation [protected]

Definition at line 631 of file GLSL.hpp.

Referenced by operator=().

Definition at line 632 of file GLSL.hpp.

Referenced by operator=().

unsigned int vl::GLSLProgram::mHandle [protected]

Definition at line 633 of file GLSL.hpp.

Referenced by createProgram(), deleteProgram(), and GLSLProgram().

Definition at line 634 of file GLSL.hpp.

Referenced by GLSLProgram(), linkProgram(), and programBinary().

Definition at line 637 of file GLSL.hpp.

Referenced by GLSLProgram(), and operator=().

Definition at line 638 of file GLSL.hpp.

Referenced by GLSLProgram(), and operator=().

Definition at line 639 of file GLSL.hpp.

Referenced by GLSLProgram(), and operator=().

Definition at line 640 of file GLSL.hpp.

Referenced by GLSLProgram(), and operator=().

Definition at line 641 of file GLSL.hpp.

Referenced by GLSLProgram(), and operator=().

Definition at line 643 of file GLSL.hpp.

Referenced by GLSLProgram(), and operator=().

Definition at line 644 of file GLSL.hpp.

Referenced by GLSLProgram(), and operator=().

Definition at line 645 of file GLSL.hpp.

Referenced by GLSLProgram(), and operator=().

Definition at line 646 of file GLSL.hpp.

Referenced by GLSLProgram(), and operator=().


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

Visualization Library v1.0.3 Reference Documentation
Copyright Michele Bosi. All rights reserved.
Updated on Tue Feb 7 2017 00:55:10.
Permission is granted to use this page to write and publish articles regarding Visualization Library.