The rummy and abysmal problem ! Great Master give some direct please!

I am do with some game maps,this file has a format of so-called “pixel-16”.
I know that our windows has a display mode of 16-bit color.
If the R,G,B all have 3 byte,they are 24-bit.each 1 byte,8-bit.rage from 0 to 255.
but when they are 16-bit,2 byte…well,I am lost…How can they describe the 256 kinds of Rs,Gs,Bs?
I study on the pixel-16 game maps,and get some data, such as:
a pixel R=32,G=56,B=0,it store in hex of E0 10.
a pixel R=16,G=48,B=0,it store in hex of C0 08.
a pixel R=48,G=80,B=0,it store in hex of 40 19.
a pixel R=31,G=48,B=0,it store in hex of C0 0C.

Yeah~,I can not work out the rule of them.
RGB will be Converted to BGR,and the G maybe store in 6-bit,the R in 5-bit,B in 5-bit, am I Right?

But how they store in hex?
How can i read the map in my opengl application? fopen() can not read by bits.
Must i use the << or >> or & or | on a byte?

In the evil DirectX,maybe I can use the creating and get a Surface and lock and copy and …to use this map DIRECTLY.[The files from Micr$oft are named “Direct”,En…maybe it is reasonable.8) ]

What to do in OpenGL?

Depends on the pixel format, since you can have 555, or 565 for example. Those are bits… (that is a 16-bit display). So 5 bits for RGB, or 5 for R&B, and 6 for G.

Does that help?
(I am a little confused what you want, since I don’t know anything that reads bits in file I/O except a nibbler drive imager. You just read in the bytes, and then you can do whatever you want with the data) How is the data stored? If it is a .bmp, that check out image readers that handle that, same goes for .tga, .jpg and whatever else.

Ok,thank you for your help.I should describe my matter in detail.

Q1: 16-bit pixel as 5-5-5-1,how they store?
following is two bytes in memory( though it looks ugly ):

[12345678][abcdefgh]

Is it as 1-5 store the 5-bit R , 678 and ab store the G,cdefg store B,and h for the 1-bit reserved bit?

or get some change in order?As hgfed for R,cba87 for G so-so…

or the [12345678] follow the [abcdefgh]
as: [abcdefgh12345678] and so-so…

any idea?

Q2:Can i use OpenGL on this 5-5-5-1-pixel format?What should i setting?

Q3:How can this 5-bits describe a 256 color?maybe it never desribe 256 color per R\G\B,but as i know,5-bit only can enum 0-32,ok,there must be some thing like a projecting map…or how can 5-bit get the color with a R-value of 124 ?
so, wanna operate a byte with bit is easy,but after i get a mass of numbers between 0 and 32,they can not use as RGB value,En~~~I have no idea to deal with those bit-rascals.

Q4:where can i find some doc about the so-called “VBE”?

=======================================
sorry for my poor english,I try my best to learn it.but it seem like …Oh~Great Genghis Khan,in my poor english vocabulary I even can not find a exact english word to observe on it.

I look up my redbook again and find the GL_RGB5 En…I think this is only the way to solve this problem,but when i get though more deeply,I find i am wrong.
the GL_RGB5 only define the internal format,it do nothing with the source image.
so if you want load a image,ou must get byte or bytes.

any idea?

is there any func in opengl can copy data from my mainboard memory into my card memory?

If you are using OpenGL1.2, you can set the type(not format) to GL_UNSIGNED_SHORT_5_5_5_1 or GL_UNSIGNED_SHORT_1_5_5_5_REV or sth. like that to read your data. with OpenGL1.1 or earlier, you would have to studied the bit assign of you data and expand it to a RGB or RGBA(24bit or 32 bit), then use OpenGL to read it.

[This message has been edited by Nil_z (edited 01-29-2001).]

Yeah~~thank you for your help.

Just think about that many users don’t have the opengl 1.2,my application may can not work.

as i know, opengl 1.2 is not shipped with win98/winMe.

since matter like this,I have to use the Dx and draw it and copy screen and save as bmp and…

sigh~~