Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Support for geometry shaders in vgl::linkShader.

  • Loading branch information...
commit 4608e69533c0acd5e442c323ae94bc5ea139df93 1 parent fbb6adf
Vilya Harvey authored
Showing with 15 additions and 2 deletions.
  1. +9 −1 src/vgl_utils.cpp
  2. +6 −1 src/vgl_utils.h
10 src/vgl_utils.cpp
@@ -125,11 +125,18 @@ GLuint loadShader(GLenum shaderType, const char* path)
-GLuint linkShader(GLuint vertexShaderID, GLuint fragmentShaderID)
+GLuint linkShader(GLuint vertexShaderID, GLuint fragmentShaderID,
+ GLuint geometryShaderID, GLenum inGeomType, GLenum outGeomType, GLuint maxOutVerts)
GLuint programID = glCreateProgram();
glAttachShader(programID, vertexShaderID);
glAttachShader(programID, fragmentShaderID);
+ if (geometryShaderID) {
+ glAttachShader(programID, geometryShaderID);
+ glProgramParameteriEXT(programID, GL_GEOMETRY_INPUT_TYPE_EXT, inGeomType);
+ glProgramParameteriEXT(programID, GL_GEOMETRY_OUTPUT_TYPE_EXT, outGeomType);
+ glProgramParameteriEXT(programID, GL_GEOMETRY_VERTICES_OUT_EXT, maxOutVerts);
+ }
GLint status;
@@ -159,6 +166,7 @@ void printShaderInfoLog(GLuint obj)
void printProgramInfoLog(GLuint obj)
int infologLength = 0;
7 src/vgl_utils.h
@@ -86,7 +86,12 @@ void drawBitmapString(float x, float y, void* font, char* str,
GLuint loadShader(GLenum shaderType, const char* path);
// Link a vertex shader and fragment shader together into a shader program.
-GLuint linkShader(GLuint vertexShaderID, GLuint fragmentShaderID);
+GLuint linkShader(GLuint vertexShaderID, GLuint fragmentShaderID,
+ GLuint geometryShaderID=0, GLenum inGeomType=0, GLenum outGeomType=0, GLuint maxOutVerts=0);
+// Link multiple shaders of arbitrary types together into a shader program.
+// The last shader ID in the arg list must be 0.
+GLuint linkShaders(GLuint firstShader...);
// Print out the contents of the shader info log. Useful for debugging when
// your shader won't compile. The obj param is the ID of the shader whose log
Please sign in to comment.
Something went wrong with that request. Please try again.