Loading *.rgb file and Reading the Pixel values

Dear All,

How to load an rgb file and store pixel values from the file.
glReadPixels reads the pixels from an image only.
Once I read the image, I want to store in an array,

Please tell me .

I am new to OPENGL.


nehe.gamedev.net - lesson 6 I think is the one where he loads a bitmap. You just have to know the BITMAPHEADER structure, that’s read from the file first, the rest is RGB data.

That’s actually commonplace in OpenGL is that the image data is read into in array or pointer and then passed to, for example, glTexture2D.

If you want more informations about bmp format there are good web site that explain you how it’s made, so you can easierly use them. The Nehe Tut are very good to learn such a thing.

Ah, so rgb files are actually, windows bmp files…
Well, I learnt something.

Well in fact I’m not sure…
Well let me see a seconde plize…
Oh Yeah! Exact. It seems that is not the same thing. Well I look in Paint Shop Pro (to make it quick) and RGB file or not at the same range than the BMP so I guess the are construct differently.But I don’t how.
So sorry for my answer, and sorry I’m not an expert about it, I will look at it.
Thanks Obli.

RGB file contain just that. simple red green and blue data for each pixel location.

very simple to open and read. as suggested check out the NehE tuts.


So it’s a easy to use raw data file format…

ushort width
ushort height
ubyte channels
uchar bytesPerChannel
[array of of (width)x(height)x(channels) entries (bytesPerChannel) bytes wide]

Is it?
If it is so simple I will add it to my todo list… having more and more formats avaiable to choose is simply good.

www.wotsit.org. The place to go for file format specifications