• Advertisement

Archived

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

Direct Draw and speed...

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

Hi ! I coded a simple fire effect with direct draw and I would like to understand some details . What''s the fastest method to work directly on the pixels of a surface : 1. locking the surface then copying pixels from this surface tothe same or to another surface ? 2. processing every pixel in memory (i.e. in an array of char for 8 bit pixels) and then, copying my array into a surface ? 3. anything else ??!? I tired both methods and it seems the second''s one isfaster but I can''t see why because everyybody says working in video memory is faster than using system and video memory . So anybody knows ? Dinaïz

Share this post


Link to post
Share on other sites
Advertisement
Working with video memory is faster.. but not with pixel manipulation. Video card hardware like working with chunks of pixels at one time. The CPU basically dumps the load of data to the video card and the video card does the processing. You are doing low level stuff.. so bouncing to and from video memory for each pixel actually slows the computer down. You are right with processing your data in system memory (the CPU can access this at anytime.. which makes it faster).. also when you lock a surface.. it needs to wait for the surface to be available. Keep the locking/unlocking to a minimum.

Share this post


Link to post
Share on other sites

  • Advertisement