• Advertisement

Archived

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

DirectDrawSurface Overhead?

This topic is 5743 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''m toying with different ideas on the game that I''m currectly writing. My question is this: How much overhead comes with using multiple DirectDrawSurfaces? In other words, is using a surface for each frame of animation or a surface for anything any everything that was to be drawn a bad idea? Does this eat memory? if so, how much? Am I better off having multiple images on one big surface? Any ideas? Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
multiple images on a single surface is a good idea (though making surfaces to large is and as well, especially since some cards dont support offscreen surfaces larger then the primary surface). have a seperate surafce for each frame of animation means more objects that directdraw need to keep track of, this will use more memory (especially since surfcaes are padded so they are DWORD aligned).

instead try to group similar things onto a larger surface. for instance each sprite gets their own surface which contains all their animations. if that creats surafaces that are too big, then split it up a bit more.

like everything, you rarly should go to the extremes.

Share this post


Link to post
Share on other sites
Thanks for the reply. That''s kinda what I thought, It''s just nice to have feedback at times. Thanks again, man.

Share this post


Link to post
Share on other sites
quote:
Original post by a person
(especially since surfcaes are padded so they are DWORD aligned).



That can''t take up more than 3 bytes can it?

Share this post


Link to post
Share on other sites
I think what he means by padding is that sometimes when you create a surface, it''s actually wider than the width that you specify. I noticed this when I made a surface that was 20 pixels wide. It was actually 32 pixels wide, and I had to use lPitch to render properly. I think DirectDraw does this for speed. For example, to go to line 3, it doesn''t have to use multiplication, like nLineNumber * nWidth ... instead, with a 32 pixel wide surface, directdraw could use bit shifters, which is a lot faster than multiplication.


That''s what I ''think'' he meant, anyway... Thanks for the input, though.

Share this post


Link to post
Share on other sites

  • Advertisement