• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# 16 bit color problem

## Recommended Posts

jemts    140
I am working on my first game using windows and direct x. I decided to use 16 bit color mode. As I began working on the game I noticed a problem in the colors. I use this macro to build my 16 bit colors(Thank you andre lamothe )
#define _RGB16BIT565(r,g,b) ((b & 31) + ((g & 63) << 5) + ((r & 31) << 11))

I am trying to get firrent shades of white but it is not working correctly. When I use _RGB16BIT565(255,255,255) it is perfectly white but when I use _RGB16BIT565(240,240,240) it becomes a shade of green, when it shouldn''t. I thought the problem might be solved by using this macro:
#define _RGB16BIT555(r,g,b) ((b & 31) + ((g & 31) << 5) + ((r & 31) << 10))

But that didn''t help. Any ideas? ---- Jemts "A Hooloovoo is a super-intelligent shade of the color blue."- Douglas Adams

##### Share on other sites
CodeMunkie    805
It''s 16 bit with 5 bits for red, 6 bits for green and 5 bits for blue. That means you can only have values of 0 - 31 for red and blue and 0 - 63 for green.

##### Share on other sites
jemts    140
Thanks alot I guess I wasnt thinking

----
Jemts
"A Hooloovoo is a super-intelligent shade of the color blue."- Douglas Adams