Transparency with DirectDraw9 ?

DD_Learner

New member
Joined
Feb 4, 2004
Messages
3
Alpha Blending with DirectDraw9 ?

hi everyone,

anyone here knows how to do alpha blending with directdraw 9? Ive spent enornous amount of time trying to find out how to do it but i have found no solutions....

i need help!!! thx!!
 
Last edited by a moderator:
Well, you cant do alpha-blending w/ DirectDraw. Its a fact, and its unfortunately true.

However, there are some alternatives using other technologies.

Heres a really really really slow method, but itll work if you just need to alpha-blend something that you can cache and use the result over and over again: http://www.computerhelp.forum/showthread.php?s=&threadid=80726

Ive also heard that D3D7 surfaces are fundamentally the same as DirectDraw 7 surfaces, which supposedly means that you can use D3D7 to apply alpha-blending to your DD surface. (BTW -- Youre using DirectDraw 7, not DirectDraw 9 -- they havent updated DD since version 7.) I havent personally verified this yet, but my development partner is right now looking into this for our own use. Ill post if/when its possible, but itll probably be a couple of weeks at least before I know.

What most people say to do is to just learn to use Direct3D, even if youre using a 2D app. From my understanding, your performance will be better and youll have more tricks (like alpha blending) at your disposal. There are ways to use D3D so its not too awkward doing 2D, especially if you write your own custom wrappers that only do what you want.

I kind of wish Id gone that route, but alas Ive got a pretty big codebase now all relying on DD. So, Im hoping that D3D7 surface thing works out -- otherwise, well, I might just have to rewrite my entire graphics engine in D3D9. =P

-Hiro_Antagonist
 
well thank you, this was a very helpful response.

i would like to do d3d, but i dont understand anything about it and i feel like its going to take me ages to figure out how to use it properly :-( I have been using bitblt and other gdi functions alot so directdraw was easy to learn... but d3d... arghhh this will take much longer :-(
 
Heh, yeah, thats the exact same response I had.

However, Ive talked through the problem with some really good developers at a fairly big 2D development house, and they currently use Direct3D (7) for all their 2D games.

If youre willing to invest a while in creating your own wrapper functions, you can basically write your own blit function that will break up the rectangle you want to blit into 2 triangles, and then apply them individually. But once you write a robust enough set of wrapper functions, you shouldnt have to worry about that logic again. You can then still fall back on thinking about things in rectangular blits.

Another option I havent investigated much is the use of the Sprite object. I dont know much about it, but its a commonly used object in D3D thats used to let you wield 2D images. In fact, the Sprite object might serve as the wrapper class I mentioned above.

Anyway, the only reason Im being so verbose about this is that I really wish I would have started my project in Direct3D, even though it would have set me back a couple of weeks. Now, Im deeply reliant on DirectDraw and itll be even more expensive for me to do whatever I have to do to make alpha-blending work.

-Hiro_Antagonist
 
Back
Top