Jump to content
  • Advertisement
Sign in to follow this  

DirectDraw Blt weirdness!

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

In short: I sometimes seem unable to blit the contents of a DirectDraw 7 surface on another ditto. No error is returned (I.E. DD_OK is returned), but the target surface in effect only gets zeroed out... or filled with black if you so will. I use the standard Blt method, and it doesn't matter how large a destination RECT I pick - the entire surface always gets blanked out. In detail: I have a surface containing whatever, that I know work fine. I can show it on the screen fine in a windowed or fullscreen, double buffered mode. No problem so far. Now I create a new surface and set its colour space with the following code (colourKey being a value other than black, 0):
memset( &surfdesc,0,sizeof(surfdesc) );

surfdesc.dwSize = sizeof(surfdesc);
surfdesc.dwFlags = (DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT);
surfdesc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
surfdesc.dwWidth = width;
surfdesc.dwHeight = height;

m_dd->CreateSurface( &surfdesc, &surface, NULL );

key.dwColorSpaceLowValue = colourKey;
key.dwColorSpaceHighValue = colourKey;
surface->SetColorKey( DDCKEY_SRCBLT, &key );
Error checking removed for terseness. This is the same code I use when I create a second buffer for a windowed environment. After this I fill the surface with the colourKey value and then draw the source surface content on it, like so:
DDBLTFX effects;
memset( &effects,0,sizeof(effects) );
effects.dwSize = sizeof(effects);
effects.dwFillColor = colorKey;

surface->Blt( NULL,NULL,NULL, (DDBLT_COLORFILL | DDBLT_WAIT), &effects );

RECT whole = {0,0, width,height};

surface->Blt( &whole, sourceSurface,&whole, (DDBLT_WAIT | DDBLT_KEYSRC),NULL );
Again, error checking is here removed for brevity and clarity. None of the above calls return any errors. And yet the content of surface after all this is nothing. I've been writing DirectDraw applications for a few years now and have never encountered this issue before. Do anyone have a clue as to what might be the problem here?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!