Jump to content
  • Advertisement

Archived

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

Nali

Why lock surfaces before writing on them?

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

I have a little question about DirectDraw Surfaces! Is it necessary to lock surfaces before writing on them? I have never locked a surface and I have almost written a whole game now, just some Level Loading and Sound engine left. Someone? Codezzz

Share this post


Link to post
Share on other sites
Advertisement
You have to lock the surface before writing to it directly.
If you use DirectX''s operations (i.e. blits, DrawPrimitive etc.) then the lock/Unlock will be done by DirectX internally.

Share this post


Link to post
Share on other sites
While I don''t know if you MUST lock surfaces, I can tell you that you SHOULD always lock them. When you lock the surface, you tell the video card and DX not to do anything with them. They will leave them alone untill you unlock them making sure that you have constant access while the surface is locked. If you don''t lock them, the hardware/DX is free to move/change the area where your writing to. If your in the middle of drawing some data, and then the hardware changes the location, you''ll get some really nasty and hard to find bugs. It''s just better/safer to lock/unlock surfaces. Hope this helps!

"I kinda think, therefore, I kinda... am?"

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!