Archived

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

Leaguefun

Alpha blending in directx....

Recommended Posts

Daivuk    413
Not in DirectDraw. To render Alpha blending, you have to use Direct3d.
It''s the only way.
But I got a better Idea for you for 3d or simulate 2d...

--> OpenGL

Share this post


Link to post
Share on other sites
d000hg    1199
Are you sure? DDraw5 had stuff about alpha blending in it! And using D3D for pure 2D stuff is overkill unless you''re going to need lots of transformations, probably.



Read about my game, project #1
NEW (18th December)2 new screenshots, one from the engine and one from the level editor



John 3:16

Share this post


Link to post
Share on other sites
RhoneRanger    100
quote:
Original post by Daivuk
Not in DirectDraw. To render Alpha blending, you have to use Direct3d.
It''s the only way.
But I got a better Idea for you for 3d or simulate 2d...

--> OpenGL



For as long as I have used directx (DX5) there has ALWAYS been a way to set a transparent color.

1. Set the color key (this color is usually the transparent color throughout the game)

2. load your textures with the key color applied

3. set the BltFast parameter to DDBLT_SRCCOLORKEY

As far as semi transparancey, that really goes with how you set your SRCCOLOR high and low values. As far as blending from an ACTUAL alpha channel, I am not sure if you can do that or not. You can do a lot of tricks within your art to simulate this however.

Share this post


Link to post
Share on other sites
frenchfry164    122
you CAN use alpha blending in DDraw. I''ve done it back when I used Allegro. It is really slow though, I would recommend using D3D. It''s not overkill; you can use graphics hardware better.

Share this post


Link to post
Share on other sites
evillive2    779
quote:

you CAN use alpha blending in DDraw. I've done it back when I used Allegro. It is really slow though, I would recommend using D3D. It's not overkill; you can use graphics hardware better.



DirectDraw doesn't support hardware alpha blending like d3d but it is possible to write your own software alpha blending routines. Being software vs hardware it will be much slower. There is a tutorial or article somewhere on GameDev that shows you how to do it in 16bit color for DirectDraw, probably in the articles and resources section

To be fair, there is no such thing as "overkill" when it comes to eeking as much speed and performance as you can out of what is available. With that said, I myself have not yet delved into the d3d realm of directx mainly because I don't feel I have even come close to learning what I should from DirectDraw and the new vocabulary of d3d seems a bit daunting to me as well


edit: here is the link to that article


[edited by - evillive2 on March 7, 2003 11:26:29 PM]

Share this post


Link to post
Share on other sites
tok_junior    229
Reality is harsh, toss DirectDraw in the trashcan.
There was a reason for Microsoft dropping it, and that reason is that noone implements DDraw acceleration in hardware anymore, while everyone implements 3D acceleration.
Take the time to learn the basics of D3D (which atleast up to the next release of OpenGL will be superior), and rewrite your code using it. You don''t need to learn a whole lot, and once you''ve got a few basic functions down you can stick them into your code instead of the ddraw-functions, and everything will be looking the same (or better), with a pretty nice improvement in speed.

--
MFC is sorta like the swedish police... It''''s full of crap, and nothing can communicate with anything else.

Share this post


Link to post
Share on other sites
Leaguefun    122
I''d not experienced with this situation before. If I''d got a .png with alpha channel, can I show it within directdraw surface just like what it shown within photoshop by using only directdraw stuffs ?

Share this post


Link to post
Share on other sites