Chapter1Figs 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.

Chapter1Figs renders many of the figures in Chapter 1 of the this book. It was used to test the correctness of the code fragments given in Chapter 1. It also is available so that you can see how those code fragments fit into a fully functioning OpenGL program. It consists of one core source file, Chapter1Figs.cpp and one file of GLSL shader programs, Chapter1Figs.glsl. It also uses GlShaderMgr.cpp and GlShaderMgr.h; these are part of the GlShaderMgr software package, and are available the web pages for GlShaderMgr. There a couple of options available for downloading the core Chapter1Figs files:

What is in the Chapter1Figs program:

  1. There are 10 images. Press the space bar to cycle through the images. (The 5th and 6th are identical in appearance.)
  2. The first image illustrates drawing points (GL_POINTS).
  3. The next three images illustrate different line drawing modes, using GL_LINES, GL_LINE_STRIP and GL_LINE_LOOP.
  4. The next image has two triangles rendered with glDrawArrays and GL_TRIANGLES.
  5. The next three images show triangles rendered with glDrawElements, using the three triangle modes GL_TRIANGLES, GL_TRIANGLE_FAN, and GL_TRIANGLE_STRIP.
  6. The final two images show a triangle shaded with the three primary colors, which are assigned to its vertices. The first uses the default GLSL shading mode. The second modifies the fragment shader to map colors to full brightness.

Version 1.1 of Chaper1Figs, March 11, 2019.