Tulip  4.6.0
Better Visualization Through Research
library/tulip-ogl/include/tulip/GlShaderProgram.h
00001 /*
00002  *
00003  * This file is part of Tulip (www.tulip-software.org)
00004  *
00005  * Authors: David Auber and the Tulip development Team
00006  * from LaBRI, University of Bordeaux
00007  *
00008  * Tulip is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU Lesser General Public License
00010  * as published by the Free Software Foundation, either version 3
00011  * of the License, or (at your option) any later version.
00012  *
00013  * Tulip is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  * See the GNU General Public License for more details.
00017  *
00018  */
00019 ///@cond DOXYGEN_HIDDEN
00020 
00021 
00022 #ifndef GL_SHADER_PROGRAM
00023 #define GL_SHADER_PROGRAM
00024 
00025 #if defined(_MSC_VER)
00026 #include <Windows.h>
00027 #endif
00028 
00029 #if defined(__APPLE__)
00030 #include <OpenGL/gl.h>
00031 #else
00032 #include <GL/gl.h>
00033 #endif
00034 
00035 #include <string>
00036 #include <vector>
00037 
00038 #include <tulip/tulipconf.h>
00039 #include <tulip/Matrix.h>
00040 #include <tulip/Color.h>
00041 
00042 namespace tlp {
00043 
00044 enum ShaderType {Vertex, Fragment, Geometry};
00045 
00046 /**
00047  * \brief A class to manage shader objects, components of a shader program
00048  *
00049  * This class allow to create and compile OpenGL shader object. Shaders are used to program the graphics processing unit (GPU) rendering pipeline.
00050  * The three existing types of shaders are managed :
00051  *
00052  *  -> Vertex shader : run once for each vertex given to the graphics processor. The purpose is to transform each vertex's 3D position in virtual space
00053  *     to the 2D coordinate at which it appears on the screen (as well as a depth value for the Z-buffer).
00054  *     Vertex shaders can manipulate properties such as position, color, and texture coordinate, but cannot create new vertices.
00055  *     The output of the vertex shader goes to the next stage in the pipeline, which is either a geometry shader if present or the rasterizer otherwise.
00056  *
00057  *  -> Geometry shader : can add and remove vertices from a mesh. Geometry shaders can be used to generate geometry procedurally
00058  *     or to add volumetric detail to existing meshes that would be too costly to process on the CPU. If geometry shaders are being used,
00059  *     the output is then sent to the rasterizer.
00060  *
00061  *  -> Fragment shader (Pixel shader) : calculate the color of individual pixels. The input to this stage comes from the rasterizer,
00062  *     which fills in the polygons being sent through the graphics pipeline.
00063  *
00064  * Shaders source codes have to be written with the "OpenGL Shading Language (GLSL)"
00065  */
00066 class TLP_GL_SCOPE GlShader {
00067 
00068   friend class GlShaderProgram;
00069 
00070 public :
00071 
00072   /**
00073    * Vertex and Fragment shader constructor
00074    *
00075    * Use this constructor to create either a vertex shader or a fragment shader
00076    *
00077    * \param shaderType Type of the shader to create, Vertex or Fragment
00078    */
00079   GlShader(ShaderType shaderType);
00080 
00081   /**
00082    * Geometry shader constructor
00083    *
00084    * Use this constructor to create a geometry shader
00085    *
00086    * \param inputPrimitiveType the type of graphic primitive the geometry shader takes as input.
00087    *        (must be one from the following list : GL_POINTS, GL_LINES, GL_LINES_ADJACENCY_EXT, GL_TRIANGLES, GL_TRIANGLES_ADJACENCY_EXT)
00088    *
00089    * \param outputPrimitiveType the type of graphics primitives the geometry shader will output
00090    *        (must be one of the following list : GL_POINTS, GL_LINE_STRIP, GL_TRIANGLE_STRIP)
00091    */
00092   GlShader(GLenum inputPrimitiveType, GLenum outputPrimitiveType);
00093 
00094   /**
00095    * GlShader destructor
00096    */
00097   ~GlShader();
00098 
00099   /**
00100    * Return the GL identifier of this shader object
00101    */
00102   GLuint getShaderId() const {
00103     return shaderObjectId;
00104   }
00105 
00106   /**
00107    * Return the type of the shader (Vertex, Geometry or Fragment)
00108    */
00109   ShaderType getShaderType() const {
00110     return shaderType;
00111   }
00112 
00113 
00114   /**
00115    * Method only relevant for geometry shaders. Return the graphic primitive type this geometry shader takes as input.
00116    */
00117   GLenum getInputPrimitiveType() const {
00118     return inputPrimitiveType;
00119   }
00120 
00121   /**
00122    * Method only relevant for geometry shaders. Return the graphics primitives type this geometry shader will output.
00123    */
00124   GLenum getOutputPrimitiveType() const {
00125     return outputPrimitiveType;
00126   }
00127 
00128   /**
00129    * Method only relevant for geometry shaders. Set the graphic primitive type this geometry shader takes as input.
00130    * Note that when modifying the input primitive type, the associated shader program (whose object is from type GlShaderProgram)
00131    * has to be relinked for changes to take effect.
00132    *
00133    * \param inputPrimitiveType the type of graphic primitive the geometry shader takes as input.
00134    *        (must be one from the following list : GL_POINTS, GL_LINES, GL_LINES_ADJACENCY_EXT, GL_TRIANGLES, GL_TRIANGLES_ADJACENCY_EXT)
00135    */
00136   void setInputPrimitiveType(const GLenum inputPrimitiveType) {
00137     this->inputPrimitiveType = inputPrimitiveType;
00138   }
00139 
00140   /**
00141    * Method only relevant for geometry shaders. Set the graphics primitives type this geometry shader will output.
00142    * Note that when modifying the output primitive type, the associated shader program (whose object is from type GlShaderProgram)
00143    * has to be relinked for changes to take effect.
00144    *
00145    * \param outputPrimitiveType the type of graphics primitives the geometry shader will output
00146    *        (must be one of the following list : GL_POINTS, GL_LINE_STRIP, GL_TRIANGLE_STRIP)
00147    */
00148   void setOutputPrimitiveType(const GLenum outputPrimitiveType) {
00149     this->outputPrimitiveType = outputPrimitiveType;
00150   }
00151 
00152   /**
00153    * Set the shader source code from a C string and compile it.
00154    *
00155    *  \param shaderSrc a C string containing the shader source code
00156    */
00157   void compileFromSourceCode(const char *shaderSrc);
00158 
00159   /**
00160    * Set the shader source code from a C++ string and compile it.
00161    *
00162    *  \param shaderSrc a C++ string containing the shader source code
00163    */
00164   void compileFromSourceCode(const std::string &shaderSrc);
00165 
00166   /**
00167    * Set the shader source code from a file and compile it.
00168    *
00169    *  \param shaderSrcFilename the absolute path of the file containing the shader source code
00170    */
00171   void compileFromSourceFile(const std::string &shaderSrcFilename);
00172 
00173   /**
00174    * Return true if the shader compilation was successfull, false otherwise
00175    */
00176   bool isCompiled() const {
00177     return shaderCompiled;
00178   }
00179 
00180   /**
00181    * Return the log output by the shader compiler
00182    */
00183   std::string getCompilationLog() const {
00184     return compilationLog;
00185   }
00186 
00187 private :
00188 
00189   void setAnonymousCreation(const bool anonymousCreation) {
00190     this->anonymousCreation = anonymousCreation;
00191   }
00192   bool anonymouslyCreated() const {
00193     return anonymousCreation;
00194   }
00195 
00196   void compileShaderObject(const char *shaderSrc);
00197 
00198   ShaderType shaderType;
00199   GLuint shaderObjectId;
00200   GLenum inputPrimitiveType, outputPrimitiveType;
00201   bool shaderCompiled;
00202   std::string compilationLog;
00203   bool anonymousCreation;
00204 
00205 };
00206 
00207 /**
00208  * \brief A class to manage OpenGL shader program.
00209  *
00210  * This class allows to create and use shader programs by linking several shader objects. At least one shader object must be
00211  * provided in order to use the shader program. Multiple shader objects of the same type can be added but exactly one
00212  * of these shader objects must have a main() function. As in C, in order to use a function defined in a separate shader object
00213  * from another shader object, this function has to be declared with the same prototype in the source code of the last one.
00214  *
00215  * This class also allows to specify uniform and attribute variables values of the shader program.
00216  */
00217 class TLP_GL_SCOPE GlShaderProgram {
00218 
00219 public :
00220 
00221   /**
00222    * GlShaderProgram constructor
00223    *
00224    * \param name An optionnal name can be provided to identify the shader program
00225    */
00226   GlShaderProgram(const std::string &name = "");
00227 
00228   /**
00229    * GlShaderProgram destructor
00230    */
00231   ~GlShaderProgram();
00232 
00233   /**
00234    * A static function which returns true if vertex and fragment shaders are supported by the host graphic card
00235    */
00236   static bool shaderProgramsSupported();
00237 
00238   /**
00239    * A static function which returns true if geometry shaders are supported by the host graphic card
00240    */
00241   static bool geometryShaderSupported();
00242 
00243   /**
00244    * A static function which returns the current active shader if any
00245    */
00246   static GlShaderProgram *getCurrentActiveShader();
00247 
00248   /**
00249    * Return the string identifier of this shader program
00250    */
00251   std::string getName() const {
00252     return programName;
00253   }
00254 
00255   /**
00256    * Return the OpenGL identifier of this shader program
00257    */
00258   GLuint getShaderProgramId() const {
00259     return programObjectId;
00260   }
00261 
00262   /**
00263    * Add a shader object to this shader program
00264    *
00265    * \param shader the shader object to add to this shader program
00266    */
00267   void addShader(GlShader *shader);
00268 
00269   /**
00270    * Remove a shader object from this shader program
00271    * Note that the shader object will not be  destroyed
00272    *
00273    * \param shader the shader object to remove from this shader program
00274    */
00275   void removeShader(GlShader *shader);
00276 
00277   /**
00278    * remove all shaders from this shader program
00279    */
00280   void removeAllShaders();
00281 
00282   /**
00283    * Convenient method to add a shader object (from type Vertex or Fragment) from a source code stored in a C string
00284    * The created shader object will be automatically destroyed when removing all attached shader objects
00285    * or destroying the shader program
00286    *
00287    * \param shaderType the type of the shader object to add (must be Vertex or Fragment)
00288    * \param shaderSrc the C string containing the shader object source code
00289    */
00290   void addShaderFromSourceCode(const ShaderType shaderType, const char *shaderSrc);
00291 
00292   /**
00293    * Convenient method to add a shader object (from type Vertex or Fragment) from a source code stored in a C++ string
00294    * The created shader object will be automatically destroyed when removing all attached shader objects
00295    * or destroying the shader program
00296    *
00297    * \param shaderType the type of the shader object to add (must be Vertex or Fragment)
00298    * \param shaderSrc the C++ string containing the shader object source code
00299    */
00300   void addShaderFromSourceCode(const ShaderType shaderType, const std::string &shaderSrc);
00301 
00302   /**
00303    * Convenient method to add a shader object (from type Vertex or Fragment) from a source code stored in a file
00304    * The created shader object will be automatically destroyed when removing all attached shader objects
00305    * or destroying the shader program
00306    *
00307    * \param shaderType the type of the shader object to add (must be Vertex or Fragment)
00308    * \param shaderSrcFilename the aboslute path to the file containing the shader object source code
00309    */
00310   void addShaderFromSourceFile(const ShaderType shaderType, const std::string &shaderSrcFilename);
00311 
00312   /**
00313    * Convenient method to add a geometry shader object from a source code stored in a C string
00314    * The created shader object will be automatically destroyed when removing all attached shader objects
00315    * or destroying the shader program
00316    *
00317    * \param geometryShaderSrc the C string containing the geometry shader object source code
00318    * \param inputPrimitiveType the type of graphic primitive the geometry shader takes as input.
00319    *        (must be one from the following list : GL_POINTS, GL_LINES, GL_LINES_ADJACENCY_EXT, GL_TRIANGLES, GL_TRIANGLES_ADJACENCY_EXT)
00320    *
00321    * \param outputPrimitiveType the type of graphics primitives the geometry shader will output
00322    *        (must be one of the following list : GL_POINTS, GL_LINE_STRIP, GL_TRIANGLE_STRIP)
00323    */
00324   void addGeometryShaderFromSourceCode(const char *geometryShaderSrc, GLenum inputPrimitiveType, GLenum outputPrimitiveType);
00325 
00326   /**
00327    * Convenient method to add a geometry shader object from a source code stored in a C++ string
00328    * The created shader object will be automatically destroyed when removing all attached shader objects
00329    * or destroying the shader program
00330    *
00331    * \param geometryShaderSrc the C++ string containing the geometry shader object source code
00332    * \param inputPrimitiveType the type of graphic primitive the geometry shader takes as input.
00333    *        (must be one from the following list : GL_POINTS, GL_LINES, GL_LINES_ADJACENCY_EXT, GL_TRIANGLES, GL_TRIANGLES_ADJACENCY_EXT)
00334    *
00335    * \param outputPrimitiveType the type of graphics primitives the geometry shader will output
00336    *        (must be one of the following list : GL_POINTS, GL_LINE_STRIP, GL_TRIANGLE_STRIP)
00337    */
00338   void addGeometryShaderFromSourceCode(const std::string &geometryShaderSrc, GLenum inputPrimitiveType, GLenum outputPrimitiveType);
00339 
00340   /**
00341    * Convenient method to add a geometry shader object from a source code stored in a file
00342    * The created shader object will be automatically destroyed when removing all attached shader objects
00343    * or destroying the shader program
00344    *
00345    * \param geometryShaderSrcFilename the absolute path to the file containing the geometry shader object source code
00346    * \param inputPrimitiveType the type of graphic primitive the geometry shader takes as input.
00347    *        (must be one from the following list : GL_POINTS, GL_LINES, GL_LINES_ADJACENCY_EXT, GL_TRIANGLES, GL_TRIANGLES_ADJACENCY_EXT)
00348    *
00349    * \param outputPrimitiveType the type of graphics primitives the geometry shader will output
00350    *        (must be one of the following list : GL_POINTS, GL_LINE_STRIP, GL_TRIANGLE_STRIP)
00351    */
00352   void addGeometryShaderFromSourceFile(const std::string &geometryShaderSrcFilename, GLenum inputPrimitiveType, GLenum outputPrimitiveType);
00353 
00354   /**
00355    * Link the shader program.
00356    */
00357   void link();
00358 
00359   /**
00360    * return true if the shader program has been successfully linked, false otherwise
00361    */
00362   bool isLinked() const {
00363     return programLinked;
00364   }
00365 
00366   /**
00367    * Print the info log containing errors and warnings related to shader objects compilation and shader program linkage
00368    */
00369   void printInfoLog();
00370 
00371   /**
00372    * Activate the shader program. If the shader program has not been linked, the link method will be called.
00373    */
00374   void activate();
00375 
00376   /**
00377    * Deactivate the shader program.
00378    */
00379   void desactivate();
00380 
00381   void setUniformFloat(const std::string &variateName, const float f);
00382   void setUniformVec2Float(const std::string &variableName, const Vector<float, 2> &vec2f);
00383   void setUniformVec2Float(const std::string &variableName, const float f1, const float f2);
00384   void setUniformVec3Float(const std::string &variableName, const Vector<float, 3> &vec3f);
00385   void setUniformVec3Float(const std::string &variableName, const float f1, const float f2, const float f3);
00386   void setUniformVec4Float(const std::string &variableName, const Vector<float, 4> &vec4f);
00387   void setUniformVec4Float(const std::string &variableName, const float f1, const float f2, const float f3, const float f4);
00388   void setUniformMat2Float(const std::string &variableName, const Matrix<float, 2> &mat2f, const bool transpose = false);
00389   void setUniformMat2Float(const std::string &variableName, const float *f, const bool transpose = false);
00390   void setUniformMat3Float(const std::string &variableName, const Matrix<float, 3> &mat3f, const bool transpose = false);
00391   void setUniformMat3Float(const std::string &variableName, const float *f, const bool transpose = false);
00392   void setUniformMat4Float(const std::string &variableName, const Matrix<float, 4> &mat4f, const bool transpose = false);
00393   void setUniformMat4Float(const std::string &variableName, const float *f, const bool transpose = false);
00394 
00395   void setUniformInt(const std::string &variableName, const int f);
00396   void setUniformVec2Int(const std::string &variableName, const Vector<int, 2> &vec2i);
00397   void setUniformVec2Int(const std::string &variableName, const int i1, const int i2);
00398   void setUniformVec3Int(const std::string &variableName, const Vector<int, 3> &vec3i);
00399   void setUniformVec3Int(const std::string &variableName, const int i1, const int i2, const int i3);
00400   void setUniformVec4Int(const std::string &variableName, const Vector<int, 4> &vec4i);
00401   void setUniformVec4Int(const std::string &variableName, const int i1, const int i2, const int i3, const int i4);
00402 
00403   void setUniformBool(const std::string &variableName, const bool b);
00404   void setUniformVec2Bool(const std::string &variableName, const Array<bool, 2> &vec2b);
00405   void setUniformVec2Bool(const std::string &variableName, const bool b1, const bool b2);
00406   void setUniformVec3Bool(const std::string &variableName, const Array<bool, 3> &vec3b);
00407   void setUniformVec3Bool(const std::string &variableName, const bool b1, const bool b2, const bool b3);
00408   void setUniformVec4Bool(const std::string &variableName, const Array<bool, 4> &vec4b);
00409   void setUniformVec4Bool(const std::string &variableName, const bool i1, const bool i2, const bool i3, const bool i4);
00410 
00411   void setAttributeFloat(const std::string &variableName, const float f);
00412   void setAttributeVec2Float(const std::string &variableName, const Vector<float, 2> &vec2f);
00413   void setAttributeVec2Float(const std::string &variableName, const float f1, const float f2);
00414   void setAttributeVec3Float(const std::string &variableName, const Vector<float, 3> &vec3f);
00415   void setAttributeVec3Float(const std::string &variableName, const float f1, const float f2, const float f3);
00416   void setAttributeVec4Float(const std::string &variableName, const Vector<float, 4> &vec4f);
00417   void setAttributeVec4Float(const std::string &variableName, const float f1, const float f2, const float f3, const float f4);
00418 
00419   void setAttributeInt(const std::string &variableName, const int f);
00420   void setAttributeVec2Int(const std::string &variableName, const Vector<int, 2> &vec2i);
00421   void setAttributeVec2Int(const std::string &variableName, const int i1, const int i2);
00422   void setAttributeVec3Int(const std::string &variableName, const Vector<int, 3> &vec3i);
00423   void setAttributeVec3Int(const std::string &variableName, const int i1, const int i2, const int i3);
00424   void setAttributeVec4Int(const std::string &variableName, const Vector<int, 4> &vec4i);
00425   void setAttributeVec4Int(const std::string &variableName, const int i1, const int i2, const int i3, const int i4);
00426 
00427   void setAttributeBool(const std::string &variableName, const bool b);
00428   void setAttributeVec2Bool(const std::string &variableName, const Array<bool, 2> &vec2b);
00429   void setAttributeVec2Bool(const std::string &variableName, const bool b1, const bool b2);
00430   void setAttributeVec3Bool(const std::string &variableName, const Array<bool, 3> &vec3b);
00431   void setAttributeVec3Bool(const std::string &variableName, const bool b1, const bool b2, const bool b3);
00432   void setAttributeVec4Bool(const std::string &variableName, const Array<bool, 4> &vec4b);
00433   void setAttributeVec4Bool(const std::string &variableName, const bool b1, const bool b2, const bool b3, const bool b4);
00434 
00435   void setUniformTextureSampler(const std::string &samplerVariateName, const int samplerId);
00436   void setUniformColor(const std::string &variableName, const Color &color);
00437   void setAttributeColor(const std::string &variableName, const Color &color);
00438 
00439   template <unsigned int SIZE>
00440   void setUniformFloatArray(const std::string &variableName, const Vector<float, SIZE> &vecf);
00441   void setUniformFloatArray(const std::string &variableName, const unsigned int fCount, const float *f);
00442 
00443   template <unsigned int SIZE>
00444   void setUniformVec2FloatArray(const std::string &variableName, const Array<Vector<float, 2>, SIZE> &vecvec2f);
00445   void setUniformVec2FloatArray(const std::string &variableName, const unsigned int vec2fCount, const float *f);
00446 
00447   template <unsigned int SIZE>
00448   void setUniformVec3FloatArray(const std::string &variableName, const Array<Vector<float, 3>, SIZE> &vecvec3f);
00449   void setUniformVec3FloatArray(const std::string &variableName, const unsigned int vec3fCount, const float *f);
00450 
00451   template <unsigned int SIZE>
00452   void setUniformVec4FloatArray(const std::string &variableName, const Array<Vector<float, 4>, SIZE> &vecvec4f);
00453   void setUniformVec4FloatArray(const std::string &variableName, const unsigned int vec4fCount, const float *f);
00454 
00455   template <unsigned int SIZE>
00456   void setUniformMat2FloatArray(const std::string &variableName, const Vector<Matrix<float, 2>, SIZE> &vecmat2f, const bool transpose = false);
00457   void setUniformMat2FloatArray(const std::string &variableName, const unsigned int mat2fCount, const float *f, const bool transpose = false);
00458 
00459   template <unsigned int SIZE>
00460   void setUniformMat3FloatArray(const std::string &variableName, const Vector<Matrix<float, 3>, SIZE> &vecmat3f, const bool transpose = false);
00461   void setUniformMat3FloatArray(const std::string &variableName, const unsigned int mat3fCount, const float *f, const bool transpose = false);
00462 
00463   template <unsigned int SIZE>
00464   void setUniformMat4FloatArray(const std::string &variableName, const Vector<Matrix<float, 4>, SIZE> &vecmat4f, const bool transpose = false);
00465   void setUniformMat4FloatArray(const std::string &variableName, const unsigned int mat4fCount, const float *f, const bool transpose = false);
00466 
00467   template <unsigned int SIZE>
00468   void setUniformIntArray(const std::string &variableName, const Vector<int, SIZE> &veci);
00469   void setUniformIntArray(const std::string &variableName, const unsigned int iCount, const int *i);
00470 
00471   template <unsigned int SIZE>
00472   void setUniformVec2IntArray(const std::string &variableName, const Array<Vector<int, 2>, SIZE> &vecvec2i);
00473   void setUniformVec2IntArray(const std::string &variableName, const unsigned int vec2iCount, const int *i);
00474 
00475   template <unsigned int SIZE>
00476   void setUniformVec3IntArray(const std::string &variableName, const Array<Vector<int, 3>, SIZE> &vecvec3i);
00477   void setUniformVec3IntArray(const std::string &variableName, const unsigned int vec3iCount, const int *i);
00478 
00479   template <unsigned int SIZE>
00480   void setUniformVec4IntArray(const std::string &variableName, const Array<Vector<int, 4>, SIZE> &vecvec4i);
00481   void setUniformVec4IntArray(const std::string &variableName, const unsigned int vec4iCount, const int *i);
00482 
00483   template <unsigned int SIZE>
00484   void setUniformBoolArray(const std::string &variableName, const Array<bool, SIZE> &vecb);
00485   void setUniformBoolArray(const std::string &variableName, const unsigned int bCount, const bool *b);
00486 
00487   template <unsigned int SIZE>
00488   void setUniformVec2BoolArray(const std::string &variableName, const Array<Array<bool, 2>, SIZE> &vecvec2b);
00489   void setUniformVec2BoolArray(const std::string &variableName, const unsigned int vec2bCount, const bool *b);
00490 
00491   template <unsigned int SIZE>
00492   void setUniformVec3BoolArray(const std::string &variableName, const Array<Array<bool, 3>, SIZE> &vecvec3b);
00493   void setUniformVec3BoolArray(const std::string &variableName, const unsigned int vec3bCount, const bool *b);
00494 
00495   template <unsigned int SIZE>
00496   void setUniformVec4BoolArray(const std::string &variableName, const Array<Array<bool, 4>, SIZE> &vecvec4b);
00497   void setUniformVec4BoolArray(const std::string &variableName, const unsigned int vec4bCount, const bool *b);
00498 
00499   void getUniformFloatVariableValue(const std::string &variableName, float *value);
00500   void getUniformIntVariableValue(const std::string &variableName, int *value);
00501   void getUniformBoolVariableValue(const std::string &variableName, bool *value);
00502   void getUniformVec2BoolVariableValue(const std::string &variableName, bool *value);
00503   void getUniformVec3BoolVariableValue(const std::string &variableName, bool *value);
00504   void getUniformVec4BoolVariableValue(const std::string &variableName, bool *value);
00505 
00506   // This method must be called before calling the link method to
00507   // set the max number of vertices a geometry shader can output
00508   // If not called, the maximum value is set when linking the shader program (not recommended for performance).
00509   void setMaxGeometryShaderOutputVertices(const int maxOutputVertices);
00510 
00511 private :
00512 
00513   GLint getUniformVariableLocation(const std::string &variableName);
00514   GLint getAttributeVariableLocation(const std::string &variableName);
00515 
00516   std::string programName;
00517   GLuint programObjectId;
00518 
00519   std::string programLinkLog;
00520   bool programLinked;
00521 
00522   std::vector<GlShader *> attachedShaders;
00523   int maxGeometryShaderOutputVertices;
00524 
00525   static GlShaderProgram *currentActiveShaderProgram;
00526 
00527 
00528 
00529 };
00530 
00531 }
00532 
00533 #endif // GL_SHADER_PROGRAM
00534 ///@endcond
 All Classes Files Functions Variables Enumerations Enumerator Properties