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

ConnectDotsModern shows how to take mouse clicks, and track the mouse position. It draws straightline segments joining points set with the mouse. It consists of a C++ source files, ConnectDotsModern.cpp and a shader program file ConnectDotsModern.glsl. It also uses the GlShaderMgr routines to read, compile and link shader programs. To download this program:

Things to try out:

  1. Compile and run the program.
  2. Left-click to add a point.
  3. Type 'F' or 'L' to remove the first or last point.
  4. Press the right mouse button and drag to select and move vertices.
  5. Check out the new features of the ConnectDotsModern program:
    • Reserving space in a VBO buffer. Using the glBufferSubData command to change the contents of a portion of a VBO buffer.
    • Accepting mouse input. Left-clicks add vertices.
    • Tracking the mouse position. Right click, hold and drag to move vertices.
    • Depth testing with GL_LEQUAL. Used to draw vertex dots on top of lines.
  6. Implement Catmull-Rom splines or Overhauser splines. (These are a common Math 155B programming assignment.)
  7. See the more detailed description of the software and its functionality.

Version 2.1 of ConnectDotsModern, September 12, 2020.