3D scenes are composed of objects called meshes. Mesh is a collection of vertices that form the external surface of an object. This surface is usually represented by triangles. When we render an object, we provide vertices and specify what type of primitives (points, lines, triangles) they build. After the vertices are processed by the vertex and optional tessellation stages, they are assembled into specified types of primitives. We can enable, also optional, the geometry stage and write geometry shaders that control or change the process of forming primitives from vertices. In geometry shaders, we can even create new primitives or destroy the existing ones.
Writing geometry shaders
How to do it...
- Create a text file. Select a name for the file and use a geom extension...