Jump to content
  • Advertisement
Sign in to follow this  
Kryzon

DirectDraw, Surface and Buffer [help needed]

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

Firstly, hello all! The following question is about DirectDraw, it's surfaces and manually created memory buffers. yes, I know DirectDraw was deprecated for D3DX and other functionalities inside D3D9, what happens is that I'm using this old DirectX 7 engine (Blitz3D), and it happens to use still DirectDraw; no matter, it is a nice API anyway. I was wondering if any of you would know how could I pass a DirectDraw's Surface pixel data memory to whatever manually created buffer I choose. So far I was insterested in the Blit command, but it only transports memory from a surface, to a surface. Are there any ways I can accomplish this? Be in mind that my goal is to transmit that memory data to a buffer, manipulate the buffer memory to whatever I might want, and the write the results back to the source surface. And trying to accomplish this in a real-time application (~60 FPS). So, whatever way you might enlighten me, I'd really appreciate it. Thanks for your time, Rafael -Kryzon-

Share this post


Link to post
Share on other sites
Advertisement
1. To get at the raw pixel data: IDirectDrawSurface*::Lock()

2. To make it fast, the surface you lock is better off in system memory. If you need to modify pixels of a surface in video memory, it can be faster to Blt() from the video memory surface to a 'workspace' system memory surface, lock the system memory surface, modify the pixels, unlock the system memory surface, then Blt() the system memory surface back to the video memory surface.

3. Reading from a locked video memory surface is usually sloooow and best avoided (much of the reason for the workspace surface mentioned above). If you're writing to a video memory surface, to take best advantage of write combining, it's faster to write to DWORD aligned addresses, write a DWORD (or more) at a time, and write sequentially.

Share this post


Link to post
Share on other sites
Thanks for that post :D

Now, there really isn't a way to "blit" a memory section to a memory buffer (not being a surface), is there?

And how fast would be that Blit VideoSurface -> System Surface, Process System Surface, Blit SystemSurface -> VideoSurface method S1CA described? enough for real-time per-pixel manipulation purposes?

Thanks for your time,
Rafael -Kryzon-

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!