• Advertisement

Archived

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

Shadows in Direct Draw

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

Does anyone know a fast way to make an area of a direct draw (DX7) surface darker to make shadows, I''m sure there must be a quicker way than alpha blending. Thanks for any help

Share this post


Link to post
Share on other sites
Advertisement
i think not, but if there is, make sure you let me know
also, try implenting alpha blending using Direct3D or OpenGL to make use of the 3D accelerator (if there is one, otherwise HEL is used), this is FAST.

Share this post


Link to post
Share on other sites
You can shift the pixel to the right one bit to darken it, and bitwise AND it with a pre-prepared value (it needs to contain the MSB for the red green and blue components). If you are in 16-bit mode you can make a 128k lookup table, which is an alternative way of doing it. Another shortcut in 16-bit mode with the original method is operating on 2 pixels at a time (just remember to make your AND value work with this by shifting it left 16 bits and bitwise ORing it with the original value). I''ve assumed that you don''t need to have different levels of shadow, but if you do, then alpha blending isn''t going to be much slower than a specific function optimised for darkening.

Regards

Starfall

Share this post


Link to post
Share on other sites

  • Advertisement