Advertisement

wasting time by using the lock function?

Started by July 28, 2002 07:03 AM
3 comments, last by Bill Cosby 22 years, 3 months ago
hi everybody, well, I have a question, it''s about the "Lock" function of Direct3DSurface and the time it takes. I wrote a font engine which locks and unlocks a surface each time a character is about to be printed, but I read that locking surfaces too many times costs a lot of time, so I guess it''s the wrong way, am I right? is it that much important? thanks in advance for(;P("\n"),R--;P("|"))for(e=C;e--;P("_")+(*u++/8)%2))P("| "+(*u/4)%2);
for(;P("n"),R--;P("|"))for(e=C;e--;P("_")+(*u++/8)%2))P("| "+(*u/4)%2);
I''ve tried a starfield with lock/unlock and locked it for every single star. Result: 20FPS on a Athlon XP 1700+, 512 MB DDR, ATI Radeon 8500. NIce, isn''t it??



Those who do not love don''t live.



[MSDN|Google|Bloodshed|My lousy page|email.me]
[My Lousy Page | Kings Of Chaos | Vampires | [email=lordlethis@hotmail.com]email.me[/email]]
Advertisement
Isn''t it better to lock the surface, draw all characters, then unlock it at once, than to lock the surface for every character? Lock is an expensive operation (although I''ve only programmed in old DD I assume the same principles apply to DXG8).
My quests for the search for an API that doesn't require locking still hasn't completed
I wonder why it's so difficult to draw a pixel, even my HP48GX calculator can do it better.

[edited by - Lode on July 28, 2002 9:05:18 AM]
You can get a handle to the device context and use SetPixel(hDC,x,y,color) and release the dc again... But its slower than lock-draw-unlock.



Those who do not love don''t live.



[MSDN|Google|Bloodshed|My lousy page|email.me]
[My Lousy Page | Kings Of Chaos | Vampires | [email=lordlethis@hotmail.com]email.me[/email]]

This topic is closed to new replies.

Advertisement