Archived

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

Dryslime

DDBLT_ROP and related Blt options

Recommended Posts

I have been workin with a 2d Direct X game and found that DDBLTFX ddbltfx; ddbltfx.dwROP=SRCPAINT; Blt(.....|| DDBLT_ROP, &ddbltfx); does not work. I investigated alphablending but found numerous articles that say you cant use alpha blending with 2d DirectX. I want to do a psuedo-alpha blend with red using SRCPAINT. But when i do this it does not appear. I have tried SRCINVERT and it came up with the same results. SRCCOPY is the only one that works and that is coded into the Blt function already. Anyone got any ideas on how to blend a rect with red??? source would help. Thank you for your time.

Share this post


Link to post
Share on other sites
Come on you guys someone has to know how to work that freakin
DDBLTFX dwROP crap...
i been stuck on this shiznat for over a month. Im just about to drop 2d cuz of this bunk.

Edited by - Dryslime on October 30, 2001 3:19:52 PM

Share this post


Link to post
Share on other sites
1. Check the CAPS bits for your graphics card. [IDirectDraw*::GetCaps()]

You may find that your hardware (or the driver for that hardware) doesn''t support some or all ROP blits in DirectDraw. Same with alpha blits - the API allows it, hardware tends not to support it.


2. Are you checking the return code from Blt() ? - what is it returning ? The answer is usually quite helpful, my guess is it''ll either be DDERR_INVALIDCALL or DDERR_UNSUPPORTED/NOHWSUPPORT.


3. Posting the complete _actual_ setup of the DDBLTFX and the Blt call would make it easier to see potential problems. [setting other parts of the DDBLTFX to bad things, or forgetting to set up important things etc].


4. If what you posted is how you''re doing things, there is at least one mistake you''ve made: "|| DDBLT_ROP" if thats how you''re combining flags for Blt, it''s wrong - || is logical OR, you want a single | for bitwise OR.


5. Any blit fx call should usually start like:
ZeroMemory( &ddbltfx, sizeof(ddbltfx) );
ddbltfx.dwSize = sizeof(ddbltfx);

If you aren''t doing that, then you haven''t read the SDK docs properly or looked at the sample code.

--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
Thank you. I found out that the comp (at school) i was workin on had a graphics card that was, to say the least, a bit archaic. My geforce was a bit more responsive however. I have only been programmin DirectX for about a 3 months (kinda exaggerated the time spent on this problem so im sorry if i sounded newbish. I didnt know the return code on the blt could be so useful. I guess i''ve got a lot to learn.

DDBLTFX ddbltfx;
ZeroMemory(&ddbltfx,sizeof(ddbltfx)); //compliments of S1CA
ddbltfx.dwSize=sizeof(ddbltfx); //compliments of S1CA
ddbltfx.dwROP=SRCPAINT;
SetRect(&rcSrc,BackgroundArrayPx,BackgroundArrayPy,BackgroundArrayPx+600,BackgroundArrayPy+400);
CopyRect(&rcDst,&rcSrc);
OffsetRect(&rcDst,offsetx-BackgroundArrayPx,offsety-BackgroundArrayPy);
lpddsFullBackground->Blt(&rcDst,lpddsRedColorFill,&rcSrc,DDBLT_WAIT | DDBLT_KEYSRC | DDBLT_ROP, &ddbltfx);

that is the full segment of the code.
Back to the SDK documentation.

Share this post


Link to post
Share on other sites