glReadPixel

I would like to use glReadPixel to scan an image and keep only a certain amount of colors in order to redraw the image by mapping them to this reduced set of colors.
my questions are

  1. what variable or where does glReadPixel store the scanned RGB pixel values into?
  2. how do you assign a pixel to a color? is there a function where i pass in the pixel coordinates and color?

i’m just starting to play around with color maps , so am not familiar with what can or cannot do.

help appreciated!

have you read the opengl docs!? It tells you the parameters for readpixel. you need to allocate enough memory to store your image i.e. (sizeof(RGBAStruct) * width * height) sort of thing. You can then access these pixels as you wish. To change a pixel colour in the buffer you have to use writepixels.