Skip to content
v3-rc1: Heatmap and surface plot of f(x,y) via texture

Computes the plot of a function $z=f(x,y)$ of two parameters,
generating float pixmap, which is then used as a texture to pass
those values to the shader, which then draws the result.

This is done both for heatmap (line in 'v2-heatmap-rescaledValue'),
and for the surface plot, the latter of which is shown as the
cloud of points (drawn using glDrawArrays()).

The compute kernel (be it on CPU or GPU) rescales $z$ values to
be in the [0.0, 1.0] range (assuming given range; some of values
fall outside it, to show how colormap handles such values).

The function to draw is hardcoded in plot2d_common.hpp as `func(x,y)`,
and cannot be changed at runtime.  The min-max rescaling is implemented
by `rescaledValue()`.  The colormap code is embedded in the fragment
shader, as `colormap()` function in the 'glsl/texture.frag' and in the
'glsl/plot2d.vert' shaders (duplicated code).

Simple grayscale colormap (`vec4(x, x, x, 1.0)`) is used, with overflow
marking (blue, or vec4(0,0,1,1), for values smaller than expected
minimum value, and red, or vec4(1,0,0,1) for values above expected
maximum).