Skip to content
v2: Heatmap of f(x,y) with colormap in fragment shader

Computes the heatmap 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 fragment shader, which then draws the result.
The compute kernel (be it on CPU or GPU) just rescales values to
the [0.0, 1.0] range.

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' file.

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