Jump to content
  • Advertisement

Archived

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

Cthulhu

Pixelformat conversions

This topic is 6871 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 think the best way to approach this would be to use function pointers.

Setup a system that swaps in the correct functions for the bitdepth you are working in so you don't have to have switch() statements in your code..

You'll want to change all your data from 32 bits to 24, 16 or 8 at load time. Doing it realtime will be too slow, and you'll be moving twice as much data as needed for 16 bit users.

32 to 24 is easy - just drop the least significant data by shifting. 32 to 16 is the same, but be sure you check which mode the card requires, 555 or 565 - shift appropriately. 8 bit will be a disaster, and if you really want to use it you'll either have to dither your images, or keep a seperate set of 8 bit bitmaps. Most people don't bother with 8 bit anymore. (except us slow pokes with P166's.)

Share this post


Link to post
Share on other sites
Advertisement
I'm currently making a graphics engine and I'd like to support various bit depths, but that makes things like alpha blending little difficult. I thought about doing everything in 32 bits per pixel and finally convert the picture before displaying it.

And it seems DirectDraw doesn't do conversions so I'll have to do it myself. Are there any good algorithms for converting 32 bit pixels to 24 and 16 bits (both 1555 and 565), splitting color values is very slow to do for 640x480=307200 pixels.

I'm using Visual c++ 6.0, assembly tips are also welcome.

------------------
"Tank, I need an exit. Fast!"

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!