O'Reilly logo

OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 4.3, Eighth Edition by Bill M. Licea-Kane, John M. Kessenich, Graham Sellers, Dave Shreiner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a Geometry Shader

Geometry shaders are created in exactly the same manner as any other type of shader—by using the glCreateShader() function. To create a geometry shader, pass GL_GEOMETRY_SHADER as the shader type parameter to glCreateShader(). The shader source is passed as normal using the glShaderSource() function and then the shader is compiled using glCompileShader(). Multiple geometry shaders may be attached to a single program object and when that program is linked, the attached geometry shaders will be linked into an executable that can run on the GPU. When a program object containing a geometry shader is active the geometry shader will run on each primitive produced by OpenGL. These primitives may be points, lines, triangles ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required