Color palette


I’m currently trying to do a simple “Paint” program using OpenGL with Microsoft Visual C++.
My questions are:

  1. How do I make a color palette with 256 colors?

  2. How can I change the current color by clicking on a point in the palette?

Thankful for answer.


I believe you need to use something called ‘color index mode’. It’s documented in the red book.

Thank you.

But how can I change the color by clicking on a pixel with the mouse? Any ideas would be helpful.