Direct Draw and speed...

Started by
3 comments, last by Dinaiz 22 years, 1 month ago
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
Dinaïz
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.

The nightmare travels across the cosmos with his burning mane. The trail of ash that is produced.

?Have a nice day!?

Well, thanks man !

Dinaïz
Dinaïz
Well, thanks man !

Dinaïz
Dinaïz
Well, thanks man !

Dinaïz
Dinaïz

This topic is closed to new replies.

Advertisement