PDA

View Full Version : Loading *.rgb file and Reading the Pixel values



iris_raj
07-14-2003, 11:43 PM
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.


Regrds

DalTXColtsFan
07-16-2003, 12:53 PM
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.

El_Segador
07-16-2003, 04:17 PM
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.

Obli
07-17-2003, 06:31 AM
Ah, so rgb files are actually, windows bmp files...
Well, I learnt something.

El_Segador
07-17-2003, 05:57 PM
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.

07-17-2003, 11:01 PM
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.

JA

Obli
07-18-2003, 12:24 AM
So it's a easy to use raw data file format...
Layout?

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.

Deiussum
07-18-2003, 04:38 AM
www.wotsit.org. (http://www.wotsit.org.) The place to go for file format specifications