# Efficient Discrete Colour Interpolation

Let us assume a set of triangles. The corner points hold values between e.g. 0 and 50. There are e.g. five colours. Which principle is most (very) efficient to do a discrete colour interpolation within the triangle? One example to show some possible options:
Point 1 has value 8, Point 2 has value 12 and Point 3 has value 2. This means Points 1 and 3 are colour 1 and Point 2 is colour 2. Okay?
Then the discrete colour interpolation has a colour switch at center between Points 1 and 2, and a colour switch at 4/5 between Points 3 and 2. A straight line between these two switch points represents the colour switch line which separates the triangle in two parts. One part including Points 1 and 3 in colour 1 and one part including point 2 in colour 2. This should be clear by now - one part is a quadrangle (or two triangles) and one part is a triangle. I hope you enjoy this question. (The three point values could also be e.g. 2, 28 and 43, like any value between 0 and 50, but … too long to explain in detail). Good - you have it - I guess. My options to solve this:
(a) Calculate all the switch points, switch lines and areas of equal colours. And draw all such sub-triangles with each sub-triangle in one colour only.
(b) Create an image with 5 equal sized colour bars and transform this image somehow and map it onto the triangle
to get the same result as with (a).
© Let OpenGL do the job of discrete colour interpolation - is this possible? Clearly, OpenGL can do a smooth colour interpolation between the three colours of the corner points. I think, there should be the (theoretical) chance to tell OpenGL: interpolate, but use only discrete colours.
(well, it would be an Interpolation between 8, 12 and 2 first, rather than between colours 1, 2 and 1 - not quite clear how this magic could work …).
(d) … a further option which you might know …