Representing colors in DirectX

Started by
5 comments, last by Ricardo Portugal 23 years, 5 months ago
Hi there ppl! I''m wondering about how to represent colors in DirectX... In the Dolphin Sample the Water Color is 0x00006688 (water blue...) . yeah it''s really hard for me. Can anyone explain me please??? Thanks! (oh yeah I''m a newbie...)
Coding... Compiling... Building...What??? No... Not again...
Advertisement
-- In Portuguese --
Como é? Tá-se?
Mais um português!! É sempre a somar!!

-- In English --

There has been quite a while since i fiddle around with DirectX, but i think it's something like this. Anybody, correct me if i'm wrong!

0x00006688 cut this number like this 0x 00 00 66 88

1 - 0x
2 - 00
3 - 00
4 - 66
5 - 88


Just don't worry about 1. Put it there but don't think about it.

2 is the Red component of the color. it goes from 00 to FF. Please remember that you are dealing with hexadecimal numbers.

3 is the Green component of the color. it goes from 00 to FF. Please remember that you are dealing with hexadecimal numbers.

4 is the Blue component of the color. it goes from 00 to FF. Please remember that you are dealing with hexadecimal numbers.

5 is the Alpha ( or Transparency ) component of the color. it goes from 00 to FF. Please remember that you are dealing with hexadecimal numbers.

Examples:
---------

0x FF 00 00 00- Bright Solid Red
0x FF FF 00 00- Bright Solid Yellow
0x FF 00 FF 00- Bright Solid Pink
0x 00 FF 00 AA- Bright Semi-Transparent Green
0x FF FF FF FF- Fully Transparent White

Hope that's helpful

-- In Portuguese --

És de onde?
Estudas ou Trabalhas ?
Já trabalhas há muito tempo em DirectX?

Viva o Zé Maria!!!!




Krestar

Edited by - Krestar on October 31, 2000 10:46:51 AM

Edited by - Krestar on October 31, 2000 10:50:28 AM
yo!
tens razão isto cada vez há + portugueses...
ZÉ MARIA!!! ))))
tenho 14 anos e estudo no 9º. sou de viseu
o meu nick no irc é HiTech
ainda sou newbie! (já tive pior...)
Thanks for the help!
Coding... Compiling... Building...What??? No... Not again...
hello again!
ehhh... that thing about the colors isn''t represented by RGBA, but ARGB so 0xFF000000 isn''t Bright Solid Red. Bright Solid Red is 0x00FF0000 ...
thanks again!

krestar depois diz ai o teu nick ok?
xau!
Coding... Compiling... Building...What??? No... Not again...
I case you were wondering, the "0x" means that the following number is in hexdecimal.

So your "0x00006688" is the same as "26248".

The number is shown in hexdecimal so that it will be more clear that the color has 0x66 green and 0x88 blue. (This would be equal to 102 green and 136 blue. Just what you would expect for a nice, aqua-blue color.

This is only true with 24-bit color or 32-bit color. If it is 32-bit color then it would have to be the type of 32-bit color where colors are actually 24-bit, and the extra byte is alpha or unused. Here are some basic formats for RGB color:

Bit #..|.16-bit..|.24-bit..|.32-bit
_______|_________|_________|_______
1......|...R.....|...R.....|...R...
2......|...R.....|...R.....|...R...
3......|...R.....|...R.....|...R...
4......|...R.....|...R.....|...R...
5......|...R.....|...R.....|...R...
6......|...G.....|...R.....|...R...
7......|...G.....|...R.....|...R...
8......|...G.....|...R.....|...R...
------------------------------------End of byte 1
9......|...G.....|...G.....|...R...
10.....|...G.....|...G.....|...R...
11.....|...B.....|...G.....|...G...
12.....|...B.....|...G.....|...G...
13.....|...B.....|...G.....|...G...
14.....|...B.....|...G.....|...G...
15.....|...B.....|...G.....|...G...
16.....|(Unused).|...G.....|...G...
------------------------------------End of byte 2
17.....|.........|...B.....|...G...
18.....|.........|...B.....|...G...
19.....|.........|...B.....|...G...
20.....|.........|...B.....|...G...
21.....|.........|...B.....|...B...
22.....|.........|...B.....|...B...
23.....|.........|...B.....|...B...
24.....|.........|...B.....|...B...
------------------------------------End of byte 3
25.....|.........|.........|...B...
26.....|.........|.........|...B...
27.....|.........|.........|...B...
28.....|.........|.........|...B...
29.....|.........|.........|...B...
30.....|.........|.........|...B...
31.....|.........|.........|(Unused)
32.....|.........|.........|(Unused)
------------------------------------End of byte 4

I hope this helps.


Edited by - ByteBlaster256 on November 1, 2000 12:31:23 PM
-----------------------------C++ is great, but when is B-coming out?
As i said, i haven''t look to DirectX for a long time!
So it''s ARGB!
He,He messed up big time!

Krestar

-- In Portuguese --

Nao tenho nick!! nao costumo estar em nenhum canal!
Seja como for, aqui vai a minha ficha!

Nome: José C. P. Rodrigues
Morada: Lisboa
Idade: 23 anos
Ocupação: 5º Ano Eng. Informática no IST (a.k.a Tecnico)
Projectos: Motor 3D para jogo a ser lancado daqui a 2 anos e colaboração no desenvolvimento do jogo
Hobbies: BTT, Jogos, etc...

em principio vou lancar um artigo aqui no gamedev sobre como fazer um jogo a partir do nada. da'' um pulo ate'' aos article requests e vê lá o "Article Request-Comeplete Game" do
Psyklone.

Krestar
That one listed as 16-bit, that is only 16-bit 555. 565 is like this:
R
R
R
R
R
G
G
G
------------ end of byte 1
G
G
G
B
B
B
B
B
------------ end of byte 2


555 can also be BGR, rather than RGB, which basically means substitute all the Rs by Bs and vice versa.


Please state the nature of the debugging emergency.


sharewaregames.20m.com

This topic is closed to new replies.

Advertisement