DirectX Surface Management

Started by
2 comments, last by Isolier 23 years, 11 months ago
Ok, I have two questions related to DX surface''s: First, in an RTS there are, of course, many little guys running around all over the place. My question is, should each of these guys have there own surface? Because if this is the case, it seems like this is a huge waste of memory. This is, however, is the way Andre Lamothe teaches in his books. Wouldn''t it be better to load each sprite into a surface, then each little guy who uses this sprite can just use that surface, rather than have its own? This leads me to my next question. To really save on memory, would it be better to load your sprite set from a bitmap and rather than splicing each sprite into its own surface, just put everthing into one surface and simply blit from that one surface? What do you guys do? Would doing it this way effect speed in any way? Thanks in advance.
Advertisement
I am curious about this too.
You are correct on both questions..

For your second question, speed wise, it is probably better to load each sprite to its own surface. But putting everything on one surface isn''t really much slower. But it does save memory when it comes to storing the sprite..
Put each sprite on its own surface.
That way a whole sprite can be in the video memory at a time and unused sprites can fall out of video memory at will.

I created a 2d engine in which every frame of every sprite was a separate surface. Blting was exceptionally fast. I don''t know about memory though. I designed it that way and it worked well. It may have been a little wasteful but oh well.

MCSE, MCSD, Sun Certified Java Programmer
Pimp Daddy ;)
MCSE, MCSD, Sun Certified Java ProgrammerPimp Daddy ;)

This topic is closed to new replies.

Advertisement