Creating a 2D plot using primitives

Creating a 2D plot is a common way of visualizing trends in datasets in many applications. With OpenGL, we can render such plots in a much more dynamic way compared to conventional approaches (such as basic MATLAB plots) as we can gain full control over the graphics shader for color manipulation and we can also provide real-time feedback to the system. These unique features allow users to create highly interactive systems, so that, for example, time series such as an electrocardiogram can be visualized with minimal effort.

Here, we first demonstrate the visualization of a simple 2D dataset, namely a sinusoidal function in discrete time.

Getting ready

This demo requires a number of functions (including the drawPoint ...

Get OpenGL Data Visualization Cookbook 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.