Jump to content
  • Advertisement

Archived

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

CMN

Lookup-tables for colors?

This topic is 6645 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

The current method i use for creating a color dword for direct draw is something like this: ((red/dwShadesOfRed) << dwRedBitShift) | ((green/dwShadesOfGreen) << dwGreenBitShift) | ((blue/dwShadesOfBlue) << dwBlueBitShift)) Would it be a good idea to have three pregenerated tables like Color_R[255], Color_G[255], Color_B[255], each containing the bit representation of a color component of that value. And then create colors with: (Color_R[red] | Color_G[green] | Color_B[blue]) Wich would be faster? /CMN Edited by - cmn on 9/2/00 4:16:11 AM Edited by - CMN on 9/2/00 4:17:39 AM

Share this post


Link to post
Share on other sites
Advertisement
The lookup table would be faster since divisions are slow.

However, if dwShadesOfRed, dwShadesOfGreen, dwShadesOfBlue are powers of 2 (2,4,8,...) you can do the division using a shift and it might be faster than a lookup table.

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!