From 0120bae9f7f7b65d4367f76513b6aeb599cfcb0f Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sat, 8 Dec 2007 15:04:47 +0000 Subject: [PATCH] From Jeremy Moles, "This extra call to SDL_VideoSetMode() prevents my viewport from getting all wonky when I resize the SDL window. I'm not sure if this bug has always existed or not, but according to the SDL documentation this operation should be safe regardless, and doesn't not introduce the need for extra memory management (that is: there is no need to "cleanup" the old screen variable, that is all handled by SDL for us). " --- examples/osgviewerSDL/osgviewerSDL.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/osgviewerSDL/osgviewerSDL.cpp b/examples/osgviewerSDL/osgviewerSDL.cpp index 72db70246..2d08a7914 100644 --- a/examples/osgviewerSDL/osgviewerSDL.cpp +++ b/examples/osgviewerSDL/osgviewerSDL.cpp @@ -99,11 +99,11 @@ int main( int argc, char **argv ) const SDL_version* linked_version = SDL_Linked_Version(); if(linked_version->major == 1 && linked_version->minor == 2) { - if(linked_version->patch < 10) - { - windowWidth = 1280; - windowHeight = 1024; - } + if(linked_version->patch < 10) + { + windowWidth = 1280; + windowHeight = 1024; + } } SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 ); @@ -146,6 +146,7 @@ int main( int argc, char **argv ) switch (event.type) { case SDL_VIDEORESIZE: + SDL_SetVideoMode(event.resize.w, event.resize.h, bitDepth, SDL_OPENGL | SDL_RESIZABLE); gw->resized(0, 0, event.resize.w, event.resize.h ); break;