My two cents on all of this is that there should be a function like
SDL_SetVideoMode (called SDL_DestroysOpenGLContext?) that accepts the
same paramaters, but returns a true/false value stating if setting a new
video mode like this would destroy the opengl context. It would make
things much easier for us, and it would be backwards compatible with
code: older apps would just always reinit, newer apps could check if
they need to.
Also, this solves your problem of when to do it, as SDL can just figure
it out for you, and allow you to code around the fact that sometimes you
need to, sometimes you dont.
I want a function like this, so apps that have GUIs can ask the user if
they want to continue, the media would have to reload (or whatnot.)On 03-Jun-2004, Miles Vignol wrote:
From: “Glenn Maynard” <g_sdl at zewt.org>
It can’t. You can resize a window without recreating the context, but
some operations (switching to and from fullscreen when the framebuffer
bit depth is different, if I remember correctly) require it. Having
SDL_SetVideoMode reset the context in some cases and not others on the
same architecture with no way of finding out if it happened or not would
be much worse. (In practice, there should be a way to find out in
advance whether a given call would reset the context.)
yes, there are some instances where it would fail (like bit depth changes
and perhaps fullscreen toggling), but simple resizing where you’re only
changing the size of the window would work fine.
certainly it would present a mixed bag, but it’s already a mixed bag: on
some OS’s it’s not an issue, but on windows it is. i would rather have
setvideomode under windows be 50% similar to other operating systems than 0%
simply for the sake of consistency. right now the caveat is that if you
call setvideomode under windows, you have to re-init your opengl context. i
don’t think it’s asking much to change the caveat to be if you change
anything aside from the resolution (first two parameters of setvideo mode),
then you must re-init your opengl context.
i get your point about wanting to know if it required a re-init or not, but
that seems like part B of the problem. it would be nice to have part A
working and then tackle part B (since it gets into growing the API in some
way – be it a flag, a function call, a triggered event, or whatever).
as it stands, i just don’t call setvideomode and live with the consequences
(which are minimal from what i can tell).
-miles vignol
fathom entertainment
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
–
Patrick “Diablo-D3” McFarland || unknown at panax.com
"Computer games don’t affect kids; I mean if Pac-Man affected us as kids, we’d
all be running around in darkened rooms, munching magic pills and listening to
repetitive electronic music." – Kristian Wilson, Nintendo, Inc, 1989
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20040603/3d125fa4/attachment.pgp