🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Direct Draw 16bpp

Started by
4 comments, last by Mr_Black 24 years, 5 months ago
I''m sorry if this has already been discussed already. I have seen tutorials for setting ddraw to 16bpp but they are all conserned with pixel plotting. Is it not posible to use the Blit commands under 16bpp, or am I barking up the wrong tree here? Also do I need to add extra code to loading e.g. a bitmap under 16bpp?
Advertisement
Yes in most cases you can utilise the built in blt and bltfast routines. Although in some circumstances you may want to code a custom blt function using pixel plotting. ie. Alpha blending and dynamic lighting
All DirectDraw Blt functions will work, and so will the bitmap loader in ddutil.cpp. The problem with 16 bit display modes are that some cards code 555 (five bits for each color, total 15, with the first bit set to 0) or 565 (6 bits for green, ie. max 63). This is a problem when plotting pixels by hand, like when you are doing alpha blending or loading bitmaps (with your own routines). This is however easy to solve. 1) You need to check which coding the graphic card uses (GetPixelFormat or likewise). 2) Make a inline function/macro to merge the color values, eg:

#define RGB16(r,g,b) ( (r << 5 + GBits) / (g << 5) / b )

Where GBits is the number of bits used for the green color.
The /''s in the macro are bitwise OR operators...its seems like it changed them, hmm? Well, that''s all
Thats the only problem with standards no one can agree on which one to use. Thanks for your help.
No problem.
Maybe they should standardize the standards?

This topic is closed to new replies.

Advertisement