[SDL] Persistent surfaces

Jeremy Kronuz kronuz at hotmail.com
Tue Nov 22 08:39:05 PST 2005


>>I have tried doing it and it seems the things I "painted" are still there 
>>the next time, but I want to know if this behavior is expected and 
>>guaranteed, or if it's just a coincidence. And if it's expected on some 
>>but not on other systems I'm using (opengl, ddraw, etc.) please let me 
>>know on which ones that behavior is guaranteed.
>
>Hardware surfaces, generally speaking, can be lost at any time...especially 
>on Windows. However, assuming that you don't lose the surfaces through a 
>system event (such as switching out of fullscreen mode, etc), their 
>contents shouldn't change.
>
>Also, they are very slow if you are modifying them a lot...if you need 
>direct pixel access every frame, use a software surface...they don't need 
>locking, they never lose their data, and if you need to modify them 
>frequently, will actually be faster.
>
>Generally hardware surface locking is intended for surfaces that need to be 
>locked once for initialization, or only need occasional changes. You need 
>to be prepared to reload their contents, though, since they can be lost 
>through various system events that are beyond your control at any time.

Those are great news, I thought it was just a mere coincidence that the 
content remained after subsequent calls. So then it looks like all I need to 
check for is the lose of the surface to assure it's content remains intact. 
However, I was thinking, shortly after my first message, what about double 
or triple buffered? will I still get the same content (if no surface is 
lost) even when the memory has switched from the back buffer to the display? 
or how does it work, I'm not sure how all this works, and it's vital for my 
project to be 100% sure the content in the surface won't be lost (or when 
exactly is going to be lost)

I'd appreciate if you could share your views on this subject.

Greetings,
Kronuz.

"Fools rush in where fools have been before" - Unknown






More information about the SDL mailing list