image rgb values into an array

Anyone got any ideas how to read the rgb values of an image into an array.
Ive done plenty of file input and ouput programs before, but I dont know how to access the rgb values of each pixel.


Hi !

Are you talking about reading from the framebuffer ?, in that case you use glReadPixels(), if you are talking about image files like bmp, png or what ever, then OpenGL does not support this, but there are lots of libraries out there that can help you (google)


Thanks for reply
im looking to read from an image NOT the framebuffer

It depends entirely on the image format. has the file spec for many, many different file formats. Generally, in an uncompressed image format, somewhere in there is an array of RGB values.

There are also libraries like SDL_image that you can use for reading in various image formats.