SDL Surface not Refreshed after Changing Screen Resolution

I’m using a SDL surface (window) in conjunction with
standard window in my program. Everything is working
fine until I change the screen resolution in runtime.
The SDL surface becomes blank.

What can I do to make the surface running in the new
resolution without re-generating all the graphics in
the surface?

thanks
Phuoc Can HUA=====
/_/_/_/_/_/_
www.huaonline.com
My Homepage is my Castle

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com

I’m using a SDL surface (window) in conjunction with
standard window in my program. Everything is working
fine until I change the screen resolution in runtime.
The SDL surface becomes blank.

What can I do to make the surface running in the new
resolution without re-generating all the graphics in
the surface?

Nothing will do that. You have to redraw the contents of the surface.
There is no magic here. Nothing happens unless you make it happen. BTW,
did you SDL_SetVideoMode() on the surface to correct it’s size?

	Bob PendletonOn Tue, 2004-11-02 at 05:58, Phuoc Can Hua wrote:

thanks
Phuoc Can HUA

=====
/_/_/_/_/_/_
www.huaonline.com
My Homepage is my Castle

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

±-------------------------------------+

— Bob Pendleton wrote:

Nothing will do that. You have to redraw the
contents of the surface.
When I move the window across the screen the redraw
routine is working. Only after changing resolution,
the window is redrawn with strange contents. When I
pop it on top of a standard window with bitmap,
firstly, I couldn’t see the SDL window at all, because
it has exact the same bitmap contents on top of the
other window. When I drag it it really moves that
piece of bitmap across.

There is no magic here. Nothing happens unless you
make it happen. BTW,
did you SDL_SetVideoMode() on the surface to correct
it’s size?

No, I didn’t call SDL_SetVideoMode() again. It’s okay
if the surface appears larger in lower resolution.

Before I call SDL_SetVideoMode() for the second time,
do I have to clean the existing SDL_surface, simply
use ‘delete’ on the surface to release memory?

thanks
Phuoc Can HUA> On Tue, 2004-11-02 at 05:58, Phuoc Can Hua wrote:

=====
/_/_/_/_/_/_
www.huaonline.com
My Homepage is my Castle

Find local movie times and trailers on Yahoo! Movies.

— Bob Pendleton <@Bob_Pendleton> wrote:

Nothing will do that. You have to redraw the
contents of the surface.
When I move the window across the screen the redraw
routine is working. Only after changing resolution,
the window is redrawn with strange contents. When I
pop it on top of a standard window with bitmap,
firstly, I couldn’t see the SDL window at all, because
it has exact the same bitmap contents on top of the
other window. When I drag it it really moves that
piece of bitmap across.

There is no magic here. Nothing happens unless you
make it happen. BTW,
did you SDL_SetVideoMode() on the surface to correct
it’s size?

No, I didn’t call SDL_SetVideoMode() again. It’s okay
if the surface appears larger in lower resolution.

Before I call SDL_SetVideoMode() for the second time,
do I have to clean the existing SDL_surface, simply
use ‘delete’ on the surface to release memory?

No, not at all. The video surface is cleaned up for you when you call
SDL_SetVideoMode() again. In fact, there are a lot of resources that may
be allocated to a window and you can’t see most of them so you can’t
clean them up. :slight_smile: Not to mention that if you do release the video
surface you may cause a crash when you call SDL_SetVideoMode(). Whenever
the resolution changes you have to call SDL_SetVideoMode() to tell SDL
that it changed.

	Bob PendletonOn Tue, 2004-11-02 at 16:29, Phuoc Can Hua wrote:

On Tue, 2004-11-02 at 05:58, Phuoc Can Hua wrote:

thanks
Phuoc Can HUA

=====
/_/_/_/_/_/_
www.huaonline.com
My Homepage is my Castle

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

±-------------------------------------+