Jump to content
  • Advertisement

Archived

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

Tony Chamblee

Alpha-Transparency/Alpha-Blending in DirectX && DirectDraw

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

Advertisement
Okay, well I''ve done quite a bit with alphablending using inline assembly. Yes, it can be done with directdraw by locking the surface

The basic idea is to take a certain percentage of the source color, the opposite percentage which will add to 100% of the destination color, and add them together.

You have to do this for your red, green, AND blue values separately. Otherwise some WEIRD things will happen hehe

If you would like to see my implementation in assembly, it''s available from my website at http://blackhole.thenexus.bc.ca/ under the downloads section as ''vbDABL''. It''s opensource of course

Otherwise, gamedev.net has a couple nice articles about it... I would advise reading those.

David

Share this post


Link to post
Share on other sites

OK...now I know what Alpha-Blending is...what it''s for.

Now here''s my next puzzle.

I''m still relatively inexperienced to the _standard_ world of game design. I''m used to using the blitter to copy sprites to a backbuffer, then flipping the backbuffer and the primary surface, hence making animation via pageflipping. My question is, where does Alpha-Blending come in this loop? (I obviously have very little understanding of Alpha-Blending.)

*Tony Chamblee*

Nucleus Software

Share this post


Link to post
Share on other sites
Alpha-blending allows you to blit an image with partial transparency. If you just want a particular color masked out, ddraw can do that for u already. If you want a blending effect (say blue energy from a space ship), you have to blend the two colors. Blending comes when you blit the sprite to the surface. Instead of a usual ddraw blit, you pocy the pixel to the screen one at a time using your blitting routine.

Share this post


Link to post
Share on other sites
Okay, well are you using vbdabl or your own alphablending method? (just checking hehe)

Essentially, yes, you should use two separate surfacedesc''s because then you can get the pitch of either one of the surfaces from this.

David

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!