[SDL] Re: SDL_VIDEORESIZE, OpenGL, Win32
stanmuffin at hotmail.com
Sun Apr 13 14:57:01 PDT 2003
> Windows requires you to nuke and reinitialize OpenGL if the pixel format
> changes, which happens when the framebuffer bit depth changes. Currently,
> SDL simply always resets OpenGL on any SDL_SetVideoMode call in Win32,
> which is overkill but consistent enough to work around.
My question is, why is there a need to call call SDL_SetVideoMode() at
all when an OpenGL window is resized (i.e., by the user dragging the
window borders)? The OS already resized the window; the SDL_Surface is
just a skeleton--pixels is NULL and hwdata (in my experience) is NULL as
well; glViewport() takes care of drawing in the new window correctly.
The only thing that doesn't work, as far as I've seen, is that mouse
coordinates are bounded by the prior dimensions of the window. I fixed
this in my Win32 build by setting w and h myself. So why not just have
an SDL_GL_ResizeWindow (or something like that) that takes care of this
common case and promises not to clobber the OpenGL state?
More information about the SDL