Skip to main content
GameDev.net gamedev.net
🔒 Locked

Blitting

Started by DirectAndy8 May 24, 2002 at 5:58 AM 0 replies 150+ views
Original Post
DirectAndy8
DirectAndy8
Some of you must think I''m thick, I''m posting questions here so often, but here''s another one... I''ve set up a primary surface, attached a back buffer, created an offscreen surface, loaded a bitmap, and copied the bitmap to the offscreen surface. Now, I want to blit the offscreen surface (all of it, I''m only exploring after all) to the back buffer. I call lpddsBack->Blt(...) and it returns DDERR_SURFACELOST. I figure the surface memory might be considered lost if I''m supposed to lock before blitting (the books I have don''t mention it but it seems reasonable!) so I lock one or both surfaces (the back buffer and/or offscreen buffer) and it returns DDERR_SURFACEBUSY, so clearly I''m not supposed to lock the surfaces! So, why is the surface memory lost when I try to blit? The MSDN says you can use Restore() to restore the memory but I''d really like to find out why it happened in the first place as I would imagine that calling Restore every time you want to blit is not ideal... Anybody got any ideas?
Jason Zelos
Jason Zelos
Don''t lock the surfaces, its already been taken care of by the blt call.
You can lose surfaces when Alt-Tab''ing etc, when that happens you have to reload them into memory. Personally I''ve never had this problem except when Alt-Tab''ing, so check that you don''t release the surface in your code early and that your bitmap is actualy loaded onto a surface (use the DD_BLAH error codes).

Have a play with the SDK examples or some other reliable code to get a feel for what could be wrong.

,Jay

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.