Chapter 2. OpenGL Primitives and 2D Data Visualization
In this chapter, we will cover the following topics:
- OpenGL primitives
- Creating a 2D plot using primitives
- Real-time visualization of time series
- 2D visualization of 3D/4D datasets
Introduction
In the previous chapter, we provided a sample code to render a triangle on the screen using OpenGL and the GLFW library. In this chapter, we will focus on the use of OpenGL primitives, such as points, lines, and triangles, to enable the basic 2D visualization of data, including time series such as an electrocardiogram (ECG). We will begin with an introduction to each primitive, along with sample code to allow readers to experiment with the OpenGL primitives with a minimal learning curve.
One can think of primitives as the fundamental building blocks to create graphics using OpenGL. These building blocks can be easily reused in many applications and are highly portable among different platforms. Frequently, programmers struggle with displaying...