• Advertisement

Archived

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

Alpha Transparency

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

hello everyone, I am planning on putting alpha blending into a 2d game i am making. I know that DDraw doesn''t support it so I did it in software. Except how am I supposed to make alpha values for my surfaces? Are there any image editors where you can edit the alpha values? should i have seperate buffers with my alpha values in them? Another thing that I noticed as I browsed the DirectX SDK help was that the overlay surface has a bunch of alpha flags and stuff.. do overlays support alpha transparency? if so, do most video cards support overlay surfaces capable of this? Any help would be appreciated, Matt Teiken bbxx@hotmail.com

Share this post


Link to post
Share on other sites
Advertisement
You have to use Direct3D to do alpha blending. Unless, like you said, you create your own routine.

Share this post


Link to post
Share on other sites
The way I did it, was something like this: I started working in 32 bit format, filled the first 8 bits for alpha,and used my routine to do the blending, then I switched to 16 bit (for speed) and had to use a buffer alpha
To get the alpha, though, I use my own 32 bit image format, wich i build from 2 24 bit bitmaps, where one bitmap has the image info, and the blue component of the second gets to be the alpha. When using 16 bits, i just convert the file values to 16 bit and channel the alpha info into the buffer.

Share this post


Link to post
Share on other sites
The "MMX enhanced alpha blending"-article helped me much when I was going to code my alpha-stuff. Check it out at GDnet/Reference/Programming

Cya

Share this post


Link to post
Share on other sites
thanks alexmoura. could you also use green and red for the alpha? is blue better for a reason? also, what''s a good way to identify the alpha buffer with the image?

Share this post


Link to post
Share on other sites
You can use wichever color you well please (i don''t even remember why I picked blue, actually I just needed 8 bits for alpha) but if you use just one of the colors you can even paint your "alpha mask" in grey without much fuss.
As for identifing the the budffer with the image, I have a class for storing the dd surfaces, so I just added the buffer to the class, and instead of manipulating dd surfaces I just move the class around. A struct with a LPDDSURFACE and a BYTE * or whatever will do fine.

Share this post


Link to post
Share on other sites

  • Advertisement