Advertisement

colors...weird way of naming them

Started by August 05, 1999 08:53 PM
3 comments, last by GameDev.net 25 years, 4 months ago
well I haven't played with D3D before so this is just a guess...

0xFFFFFFFF

fist off this is a Hex number... if you don't know what it is I'd recomend you look up Hex numbers on the net because your going to see them a LOT more of them.

next I'm going to guess at the structure of the number.

Guess 1

Hex Ident. R G B A
0x FF FF FF FF

0x tells the compiler that its a hex number.
R=Red
G=Green
B=Blue
A=Alpha

Guess 2

Hex Ident. A R G B
0x FF FF FF FF

0x tells the compiler that its a hex number.
R=Red
G=Green
B=Blue
A=Alpha

Guess 3

Hex Ident. R G B Place Holder
0x FF FF FF FF

0x tells the compiler that its a hex number.
R=Red
G=Green
B=Blue

Guess 4

Hex Ident. PH R G B
0x FF FF FF FF

0x tells the compiler that its a hex number.
R=Red
G=Green
B=Blue

guess 1 is probably the closest

ok now lets create colors

bright red
R=FF
G=00
B=00
A=FF if it is alpha

bright Green
R=00
G=FF
B=00
A=FF if it is alpha

bright blue
R=00
G=00
B=FF
A=FF if it is alpha

Purple
R=FF
G=00
B=FF
A=FF if it is alpha

Gray
R=AA
G=AA
B=AA
A=FF if it is alpha

you get the idea play with it a bit...

------------------
Great Milenko

Words Of Wisdom:
"Never Stick A Pretzel In Your Butt It Might Break Off In There."


http://www.crosswinds.net/~milenko
http://www.crosswinds.net/~pirotech

Alright, then can anyone give me some help with writing a function that will let me input an r g b and a value (0 - 255) that will return a color in this format? Something weird is happening also. I have fog, and i have a background color. If I set them to the same 0x00AA55FF (or whatever) value, they are not the same color! wtf! I checked, they're both DWORD's. AAHHH! Anyway, help with that function would be greatly appreciated.
Advertisement
hi,
a function like this is very simple. You have to use the binary shift-left operator. In C this would be "<<". I'll just write you a simple C function. It's not tested and there might be a bug (or two) in it. I'll use ARGB-format, since I'm used to it:

DWORD argb(USHORT alpha, USHORT red, USHORT green, USHORT blue)
{
return ((alpha << 24) + (red << 16) + green << 8) + blue);
};

I hope you got the idea. If not, just ask...

ciao...
...jens

I want to make Everquest in VB. hehehe, just kidding. Now, I am working on a cool project, what i will not say. It uses Direct3D, however. I've looked through numerous samples, and see them declare colors like this: 0xFFFFFFFF for white. What is that? Can someone disect that and tell me what each part means? And then can you tell me how to make the color I want by creating one of those 0x******** things? like a Red or a light green for example? Through some quick investigetion, I know that those things are DWORDS. Thanks in advance!
I do this:

#define COLOR_BLACK RGB(0, 0, 0)
#define COLOR_BLUE RGB(0, 0,255)
#define COLOR_BLUE_SKY RGB(0, 10,255)
#define COLOR_CYAN RGB(0, 255, 255)
#define COLOR_GREEN RGB(0, 255, 0)
#define COLOR_MAGENTA RGB(255, 0, 255)
#define COLOR_RED RGB(255, 0, 0)
#define COLOR_WHITE RGB(255, 255, 255)
#define COLOR_YELLOW RGB(255, 255, 0)


Its a pre-defined macro..I think u need to add windows.h...

[This message has been edited by Un0 (edited August 05, 1999).]

This topic is closed to new replies.

Advertisement