Discrete colour Interpolation on a Triangle

How to perform a discrete colour levels Interpolation on a triangle in a simple & efficient way? Can I do this with old-style OpenGL or would I need Modern OpenGL?

Hey, I was wondering what you meant by “discrete color level interpolation on a triangle”. Do you just mean a triangle where each vertex is a different color and between the points are an interpolated color? In that case, are you just talking about the “Hello World Triangle”?

Thanks for your reply. I posted this topic already in 2018… in a long version. Now a short version. I already wrote a few OpenGL programs, and I could find a solution to this problem, e.g. either split the triangle into subregions with uniform colour each or create an image with colour levels, and show/map on the triangle the part that is needed. Not the Hello World triangle, because that has smooth colour gradients. The difference: if hot is red, intermediate is green, and cold is blue. Then, if one corner of the triangle is hot=red, and one is cold=blue, Then there should be a part of pure green in the middle between the two corners. I would much appreciate an answer, which looks good and which is fast on many triangles. I am used to use old OpenGL. Anyone a good idea for this? Or, maybe it is time for modern OpenGL. Any kind of answer for this? The answer should refer to a principle and some keywords, which just points me to a direction. Explain like a pro to a pro, who is just not sure about the “best” solution. Maybe the answer is just: Write a Shader ;o)

The simplest way to do this is with a texture. Either a 1-D texture or an Nx1 texture. Disable lighting, either set the vertex colour to white or set GL_TEXTURE_ENV_MODE to GL_REPLACE. Either set the texture filters to GL_NEAREST or make the texture large enough that linear filtering provides some anti-aliasing without making the result look blurred.

That’s another option.