Point sprites with the geometry shader
Point sprites are simple quads (usually texture mapped) that are aligned such that they are always facing the camera. They are very useful for particle systems in 3D (see Chapter 9) or 2D games. The point sprites are specified by the OpenGL application as single point primitives, via the GL_POINTS
rendering mode. This simplifies the process, because the quad itself and the texture coordinates for the quad are determined automatically. The OpenGL side of the application can effectively treat them as point primitives, avoiding the need to compute the positions of the quad vertices.
The following screenshot shows a group of point sprites. Each sprite is rendered as a point primitive. The quad and texture coordinates are generated automatically (within the geometry shader) and aligned to face the camera.
OpenGL already has built-in support for point sprites in the GL_POINTS
rendering mode. When rendering point primitives using this mode, the points are rendered...