BasicDrawModes is sample C++ code illustrating the use of Modern OpenGL. It is part of a set of programs introducing the use of Modern OpenGL, which are intended to accompany a possible second edition of the book 3D Computer Graphics: A mathematical approach with OpenGL, Cambridge University Press, 2003.

BasicDrawModes shows some of the basic drawing methods used in OpenGL by illustrating different ways to draw triangle strips. The core source file is BasicDrawModes.cpp; the shader program code is in BDMshaders.glsl plus two source files for reading shaders from files and five source files that provide functions to handle 3-dimensional vectors and 4-dimensional vectors. There are a couple options available for downloading this program:

Things to try out:

  1. Compile and run the program. You should see four images of a 3x3 three grid of squares; each is formed using three triangle strips.
  2. Examine the source to see the new features of the BasicDrawModes program (which not already present in SimpleDrawModern or SimpleAnimModern):
    • Rendering three triangle strips with three calls to glDrawArrays
    • Rendering three triangle strips with three calls to glDrawElements.
    • Rendering three triangle strips with one call to glMultiDrawElements.
    • Rendering three triangle strips with one call to glDrawElements using Primitive Restart..
  3. See the more detailed description of the software and its functionality.

Version 2.1 of BasicDrawModes, September 12, 2020.