Jump to content
  • Advertisement

Archived

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

jemts

16 bit color problem

This topic is 5556 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
Share on other sites
Thanks alot I guess I wasnt thinking


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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!