Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: glReadPixel

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2002


    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!

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Aug 2000
    Cardiff University

    Re: glReadPixel

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts