Drawing your weapons

It's time for us to learn how to draw things in OpenGL. Whether you are drawing your weapons, an alien spacecraft, or a blade of grass, it all starts by with very simple shapes that are combined to make more complex shapes.

Getting primitive

The most basic shapes that can be drawn in OpenGL are known as primitives. The primitives that can be drawn by OpenGL include:

  • Points: As the name suggests, a point renders a single point and is defined by a single vertex.
  • Lines: A line is rendered as a line drawn between two vertices.
  • Triangles: A triangle is defined by three vertices and the three lines that pass from one vertex to the other.
  • Quads: A quad is defined by four vertices and the four lines that pass from one vertex to the other. ...

Get OpenGL Game Development By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.