Transparency with DirectDraw9 ?

DD_Learner

Newcomer
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:
Well, you can't do alpha-blending w/ DirectDraw. It's a fact, and it's unfortunately true.

However, there are some alternatives using other technologies.

Here's a really really really slow method, but it'll work if you just need to alpha-blend something that you can cache and use the result over and over again: http://www.xtremedotnettalk.com/showthread.php?s=&threadid=80726

I've 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 -- You're using DirectDraw 7, not DirectDraw 9 -- they haven't updated DD since version 7.) I haven't personally verified this yet, but my development partner is right now looking into this for our own use. I'll post if/when it's possible, but it'll 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 you're using a 2D app. From my understanding, your performance will be better and you'll have more 'tricks' (like alpha blending) at your disposal. There are ways to use D3D so it's not too awkward doing 2D, especially if you write your own custom wrappers that only do what you want.

I kind of wish I'd gone that route, but alas I've got a pretty big codebase now all relying on DD. So, I'm 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 don't understand anything about it and i feel like it's 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, that's the exact same response I had.

However, I've 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 you're 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 haven't investigated much is the use of the Sprite object. I don't know much about it, but it's a commonly used object in D3D that's 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 I'm 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, I'm deeply reliant on DirectDraw and it'll be even more expensive for me to do whatever I have to do to make alpha-blending work.

-Hiro_Antagonist
 
Back
Top