[SDL] Persistent surfaces

Ryan C. Gordon icculus at icculus.org
Tue Nov 22 02:09:49 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.

--ryan.





More information about the SDL mailing list