SetVideoMode with openGL

let me ask it this way – what happens if i don’t call SDL_SetVideoMode after i get a resize? i’m only concerned with openGL – i’m not using sdl drawing routines or anything. it seems to work on my windows machine (aside from the mouse coordinates being bound to the initial window size). is it just dumb luck that it doesn’t bomb out?

if it’s fine to not call it if i’m only using openGL, would it make sense to have a catch in there to skip the actual device reseting and just modify the mouse bounds? like, if the window properties are the same as the previous one (bpp, # buffers, etc) just modify the mouse bounds to the new window size – for openGL only, of course. or is this dangerous?

let me ask it this way – what happens if i don’t call
SDL_SetVideoMode after i get a resize? i’m only concerned with openGL
– i’m not using sdl drawing routines or anything. it seems to work
on my windows machine (aside from the mouse coordinates being bound to
the initial window size). is it just dumb luck that it doesn’t bomb
out?

The effect of not calling SDL_SetVideoMode() after a resize is OS
specific. It may be device/driver specific. Try looking at it this way:
You have several levels of software that you are dealing with, SDL, the
windowing system, the OS, the device drivers, and OpenGL. Each of those
levels of software can have their own state and they depend on that
state being correct to “do the right thing”. The call to
SDL_SetVideoMode() synchronizes the state of all those different layers
of software. Without they each have their own view of reality and some
have the correct view and some have an incorrect view.

You might get lucky some of the time and have things work just fine.
OTOH, you will get unlucky some of the time and have things fail.

	Bob PendletonOn Thu, 2004-04-22 at 04:14, Miles Vignol wrote:

if it’s fine to not call it if i’m only using openGL, would it make
sense to have a catch in there to skip the actual device reseting and
just modify the mouse bounds? like, if the window properties are the
same as the previous one (bpp, # buffers, etc) just modify the mouse
bounds to the new window size – for openGL only, of course. or is
this dangerous?

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

let me ask it this way – what happens if i don’t call
SDL_SetVideoMode after i get a resize? i’m only concerned with openGL
– i’m not using sdl drawing routines or anything. it seems to work
on my windows machine (aside from the mouse coordinates being bound to
the initial window size). is it just dumb luck that it doesn’t bomb
out?

The effect of not calling SDL_SetVideoMode() after a resize is OS
specific. It may be device/driver specific. Try looking at it this way:
You have several levels of software that you are dealing with, SDL, the
windowing system, the OS, the device drivers, and OpenGL. Each of those
levels of software can have their own state and they depend on that
state being correct to “do the right thing”. The call to
SDL_SetVideoMode() synchronizes the state of all those different layers
of software. Without they each have their own view of reality and some
have the correct view and some have an incorrect view.

You might get lucky some of the time and have things work just fine.
OTOH, you will get unlucky some of the time and have things fail.

Bob Pendleton

yeah, i figured as much. but i am curious if some steps could be skipped
for the simple “resize” vs actual changes (like bpp or other video
attributes) – even if it’s OS specific. basically, i’m really not thrilled
about having to re-initialize opengl every time the user decides to resize
the window… and this problem is also OS specific, isn’t it? i mean, the
"restarting" of openGL. i understand linux users don’t need to worry about
it…

maybe i’ll just continue as i am till i’m closer to having to worry about
different OS’s. atm i’m only working on my machine with my OS and my
graphics card. so if it works for me, that’s the only concern. when i get
around to other versions (and finishing this one!) then i can be more
careful about this stuff…From: bob@pendleton.com (Bob Pendleton)

On Thu, 2004-04-22 at 04:14, Miles Vignol wrote:

let me ask it this way – what happens if i don’t call
SDL_SetVideoMode after i get a resize? i’m only concerned with openGL
– i’m not using sdl drawing routines or anything. it seems to work
on my windows machine (aside from the mouse coordinates being bound to
the initial window size). is it just dumb luck that it doesn’t bomb
out?

The effect of not calling SDL_SetVideoMode() after a resize is OS
specific. It may be device/driver specific. Try looking at it this way:
You have several levels of software that you are dealing with, SDL, the
windowing system, the OS, the device drivers, and OpenGL. Each of those
levels of software can have their own state and they depend on that
state being correct to “do the right thing”. The call to
SDL_SetVideoMode() synchronizes the state of all those different layers
of software. Without they each have their own view of reality and some
have the correct view and some have an incorrect view.

You might get lucky some of the time and have things work just fine.
OTOH, you will get unlucky some of the time and have things fail.

Bob Pendleton

yeah, i figured as much. but i am curious if some steps could be skipped
for the simple “resize” vs actual changes (like bpp or other video
attributes) – even if it’s OS specific. basically, i’m really not thrilled
about having to re-initialize opengl every time the user decides to resize
the window… and this problem is also OS specific, isn’t it? i mean, the
"restarting" of openGL. i understand linux users don’t need to worry about
it…

Yep, Microsoft chose to implement it that way. AFAIK no one else does or
ever has.

maybe i’ll just continue as i am till i’m closer to having to worry about
different OS’s. atm i’m only working on my machine with my OS and my
graphics card. so if it works for me, that’s the only concern. when i get
around to other versions (and finishing this one!) then i can be more
careful about this stuff…

I wish it worked that way. But, it doesn’t. The need to reinitialize
OpenGL forces you to structure your code in a way that is different from
what you would write if you didn’t need to reinitialize OpenGL. The
changes needed to retrofit that ability can be pretty dramatic.

If you don’t want to deal with the problem just don’t allow people to
resize the window.

	Bob PendletonOn Thu, 2004-04-22 at 12:52, Miles Vignol wrote:

From: “Bob Pendleton” <@Bob_Pendleton>

On Thu, 2004-04-22 at 04:14, Miles Vignol wrote:


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

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