How can I create and use a color table with OpenTk?
Color tables imply 8bit indexed modes. Is this what you want?
In theory, you can request a 8bit GraphicsMode in the GameWindow or GLControl constructors. This has never been tested in practice and will likely throw you back to software rendering, since modern hardware doesn't accelerate 8bit modes anymore.
There are ways to emulate color tables on new hardware. What kind of effect are you trying to achieve?
Edit: to create the color table itself, use GL.ColorTable. Check the inline documentation for this function, it is pretty complete. The last parameter is an array of color values in the format specified by interlformat.
Thank you for your answer.
The effect I am trying to achieve is to discrete render a surface. For example, when you draw a triangle with different colors on its vertices, openGL renders surface of it with a continuous combination if its vertices colors. Now, I want to specify different colors to vertices of that triangle and force openGL to render it with just, for examples, 4 colors between them.
I don't think this is possible out of the box.
The first idea that comes to mind is to use a textures instead of vertex colors. Create a texture with the colors you wish to use and apply it to the polygon with mag and min filters set to "Nearest".
If your target hardware supports OpenGL 2.1, then you can use shaders to implement this effect using a 1D "heatmap" texture. Each vertex would have a "weight" attribute that would be used to pick the correct color from the texture. The larger the texture, the smoother the output and vice versa.
Do these colors have a physical meaning, e.g. temperature or height? This might help think of a more specific approach.
Actually this is not important what is the type of the field, but consider it as temperature.
As I am new with OpenGL I did not understand your answer about using OpenGL 2.1.
Site design by Stefanos A. Icons courtesy of gnome-colors.