Hello all,
I was trying to deal with those "lost surfaces" that I get after
switching to another application. Here is what I would like to
know:
- what surfaces can be lost?
- where must I check that?
- how should I resore them? Just reload?
My OS: WinXP Pro
My compiler: MS VS 2003--
Thanks for attention,
Flashback
My understanding is that hardware surfaces get lost under windows when
you switch applications (from a full screen SDL hardware surface
enabled app)…
I’m afraid I never quite resolved how to reload surfaces correctly
myself. I believe the SDL core guys (Sam, etc) may well add a single
event we can check under Windows in the future, although I’m not sure
at all …On Fri, 17 Dec 2004 17:18:03 +0200, Flashback wrote:
Hello all,
I was trying to deal with those "lost surfaces" that I get after
switching to another application. Here is what I would like to
know:
- what surfaces can be lost?
- where must I check that?
- how should I resore them? Just reload?
My OS: WinXP Pro
My compiler: MS VS 2003
–
Thanks for attention,
Flashback
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
–
Rob Sadedin
No Substance Software (www.nosubstancesoftware.com)
Flashback wrote:
Hello all,
I was trying to deal with those "lost surfaces" that I get after
switching to another application. Here is what I would like to
know:
- what surfaces can be lost?
Surfaces that are in video memory, this only happens under windows.
- where must I check that?
You must check the return value of SDL_BlitSurface. If it returns -2,
the surface is lost.
- how should I resore them? Just reload?
Yes.
My OS: WinXP Pro
My compiler: MS VS 2003
For more information, see the SDL_BlitSurface man page :
http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fBlitSurface
Stephane
Flashback wrote:
Hello All,
- where must I check that?
You must check the return value of SDL_BlitSurface. If it returns -2,
the surface is lost.
So, I must check that only for surfaces that were created using
SDL_CreateRGBSurface(SDL_HWSURFACE, …)? What about those which
passed through SDL_DisplayFormat[Alpha] ?
Keep in mind that SDL_CreateRGBSurface(SDL_HWSURFACE…) doesn’t always
give a hw surface.
You can’t tell what SDL_DisplayFormat returns either.
Just testing the return value from SDL_BlitSurface after each call is ok.
For more information, see the SDL_BlitSurface man page :
http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fBlitSurface
I think this is described in Doc project too, I use it offline.
Though that description confused me a bit. They say there that I
must lock surface, then write stuff to image->pixels… The result
is equal to reloading, I suppose. (?)
Well, you have to fill in the ->pixels member of the surface.
Or delete/recreate the surface
Stephane
Hello Stephane Marchesin,
Keep in mind that SDL_CreateRGBSurface(SDL_HWSURFACE…) doesn’t always
give a hw surface.
You can’t tell what SDL_DisplayFormat returns either.
Just testing the return value from SDL_BlitSurface after each call is ok.
Sure, thanks. Testing the return value is a lot of code,
though. Especially in rather big projects as mine.
Well, you have to fill in the ->pixels member of the surface.
Or delete/recreate the surface
OK, thanks. You have cleared several things to me.–
Best regards,
Flashback