Changing resolution in-game

Another day, another question =)

Let’s say i have a game that have a menu screen in fullscreen 640x480
resolution, while the actual game runs in fullscreen 800x600 (i
don’t, but i ask anyway). What would be the correct way of changing
the resolution ? Will a call to SDL_SetVideoMode destroy the current
screen structure and create a new based on the new data, or is it
necessarry to quit and reinit the video subsystem ?–
Trick


Linux User #229006 * http://counter.li.org

Let’s say i have a game that have a menu screen in fullscreen 640x480
resolution, while the actual game runs in fullscreen 800x600 (i
don’t, but i ask anyway). What would be the correct way of changing
the resolution ? Will a call to SDL_SetVideoMode destroy the current
screen structure and create a new based on the new data, or is it
necessarry to quit and reinit the video subsystem ?

SDL_SetVideoMode() will (should) do.

–ryan.

Another day, another question =)

Let’s say i have a game that have a menu screen in fullscreen 640x480
resolution, while the actual game runs in fullscreen 800x600 (i
don’t, but i ask anyway). What would be the correct way of changing
the resolution ?

IMHO, the only correct way is not to do it at all. Some monitors take
incredibly long to detect the new resolution after a change (several
seconds before you get a solid image is “normal”), so games that change
resolution all the time can be very frustrating.

Besides, that’s two resolutions that have to be configured and ensured
working - another reason to avoid such solutions.

BTW, another thing I don’t like is games that switch between SDL 2D and
OpenGL rendering. Reinitializing with/without OpenGL also results in all
sorts of artifacts on some targets, and the results graphics tend to look
very different between the modes, especially if different resoutions are
used.

Sure, software rendering for the 2D stuff is a nice way to make sure that
people can access the configuration (rather than deleting the config file
if they happen to set an unsupported resolution…), but I think the
whole game should use the same rendering method once it’s known that
things are actually working. (One could check for “frenetic hammering on
ESC”, and switch to the emergency 2D mode if that’s detected. In fact, I
think I’ll implement that in Kobo Deluxe, or perhaps even build it into
the “Spitfire Engine”. :slight_smile:

Will a call to SDL_SetVideoMode destroy the current
screen structure and create a new based on the new data, or is it
necessarry to quit and reinit the video subsystem ?

SDL_SetVideoMode() should work for changing resolution. (That’s how you
do resizable windows with SDL.)

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Wednesday 10 October 2001 23:24, Trick wrote:

BTW, another thing I don’t like is games that switch between SDL 2D and
OpenGL rendering. Reinitializing with/without OpenGL also results in all
sorts of artifacts on some targets, and the results graphics tend to look
very different between the modes, especially if different resoutions are
used.

Descent3 did this; The movies and “please insert disc 2” screens were 2D
surfaces, while everything else was OpenGL, so it had to switch
resolutions, and modes a lot.

The reality is that it broke a LOT of drivers. I can’t think of a single
GL driver that could handle it without some patching during the Descent3
beta.

And “broken” meant system lockups or crashed X servers…there wasn’t an
option to check for repeated ESC key hits.

The good news is, thanks to Descent3, your system is more stable (heh),
but you’re better off not taking the risk, IMHO.

–ryan.

[…]

The good news is, thanks to Descent3, your system is more stable (heh),
but you’re better off not taking the risk, IMHO.

heh Maybe that’s the way to really get people working; release some
great games that abuse the system! :wink:

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Thursday 11 October 2001 01:07, Ryan C. Gordon wrote: