Quote Originally Posted by BlueCat
Quote Originally Posted by savage
Glad to hear you have found it usefull.

Any chance of seeing a demo on Windows or Linux?
Yes, I'm planning on using SDL from now to develop my game and I'll upload a new demo in a couple of days to the usual address (the url for dgdev without the dgdev bit ).

I've had trouble with window resizing. Unfortunately my engine uses lots of display lists. I use SDL_SetVideoMode to resize the window (or switch to fullscreen) but in the process the OpenGL context is destroyed and a new one created. The problem is, this also destroys my display lists (which reside in an octree). It takes 20 seconds or so on my 1.2GHz machine to recreate the display lists, much longer on slower machines.

Does anyone know how I can change video modes without destroying the OpenGL context? I know that might be impossible, so if not any other tricks? :twisted: :twisted: :twisted:
I posted your question on the main SDL mailing list and this is the response I got from a guy called Glenn Maynard...
"
I wrote a hack for the Windows implementation to allow changing some
window settings (everything except bit depth, I believe, which needs a
new context anyway), but only in Windows; I haven't implemented it on
anything else yet.

I'll attach it. It moves some stuff, so it's a little large. The code
to use it looks like this:

#ifndef SDL_HAS_CHANGEVIDEOMODE
/* We can't change the video mode without nuking the GL context. */
need_reload = true;
#endif

if( bpp != g_CurrentBPP )
need_reload = true; /* can't do this with SDL_SM_ChangeVideoMode_OpenGL */

if(need_reload) {
if(TEXTUREMAN) TEXTUREMAN->InvalidateTextures();
}

if(!g_screen || need_reload) {
g_screen = SDL_SetVideoMode(width, height, bpp, g_flags);
if(!g_screen)
throw RageException("SDL_SetVideoMode failed: %s", SDL_GetError());

SDL_WM_SetCaption("StepMania", "StepMania");
}
#ifdef SDL_HAS_CHANGEVIDEOMODE
else
{
SDL_SM_ChangeVideoMode_OpenGL(g_flags, g_screen, width, height);
}
#endif

You'll need to massage the patch (remove the refresh rate stuff, add a
prototype and the SDL_HAS_CHANGEVIDEOMODE #define) if you want to use it.
(Sorry, I didn't clean it up because diffing is a bit of a pain for me at
the moment ...)

I think this is something the SDL really needs to handle; nuking the GL
context to change video settings is definitely not good. I'm not sure of
a good general-purpose way to handle it, though, considering that some
archs may not be able to do certain things without a context recreation.

-- Glenn Maynard"

Sorry that it is C code, but I hope it proves useful

BTW you can join the main JEDI-SDL mailing list @
http://groups.yahoo.com/group/JEDI-SDL/join