March 2013
Intermediate to advanced
984 pages
26h 18m
English
To use a geometry shader in your program:
• Create a geometry shader with glCreateShader(GL_GEOMETRY_SHADER).
• Set the shader source with glShaderSource and compile it with glCompileShader.
• Attach it to a program object with glAttachShader, and link the program with glLinkProgram.
Inside your geometry shader do the following:
• Specify input and output primitive types with the layout (<primitive_type>) in
; or layout (<primitive_type>) out
; layout qualifiers.
• Specify the maximum number of vertices the shader might produce with the layout (max_vertices = <vertex_count>) in
; layout qualifier.
• Declare all inputs to the geometry shader as arrays (using the in keyword). You can use the .length() method on the input arrays ...