O'Reilly logo

Mastering openFrameworks: Creative Coding Demystified by Denis Perevalov

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

Using a geometry shader

In the rendering pipeline, a geometry shader works between the vertex shader and the fragment shader. It processes the groups of vertices that are organized in primitives. The possible primitives are point (one vertex), line (two vertices), and triangle (three vertices). Also, there are two new primitives, line with adjacent and triangle with adjacent, which represent the line and the triangle with some additional vertices providing adjacency information needed for computing the normals.

The geometry shader gets access to the input positions of the primitive's vertices using a built-in array gl_PositionIn, which holds values of type vec4. These positions are equal to the output values gl_Position generated by the vertex ...

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