diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp index 2a0965e4508..3f8c1b991a0 100644 --- a/src/gui/sdlmain.cpp +++ b/src/gui/sdlmain.cpp @@ -959,6 +959,10 @@ static SDL_Surface * GFX_SetupSurfaceScaledOpenGL(Bit32u sdl_flags, Bit32u bpp) Bit16u fixedWidth; Bit16u fixedHeight; + int Voodoo_OGL_GetWidth(); + int Voodoo_OGL_GetHeight(); + bool Voodoo_OGL_Active(); + if (sdl.desktop.prevent_fullscreen) /* 3Dfx openGL do not allow resize */ sdl_flags &= ~SDL_RESIZABLE; @@ -983,10 +987,11 @@ static SDL_Surface * GFX_SetupSurfaceScaledOpenGL(Bit32u sdl_flags, Bit32u bpp) fixedWidth = final_width; fixedHeight = final_height; } - if (sdl.desktop.prevent_fullscreen) { /* 3Dfx openGL do not allow resize */ + if (Voodoo_OGL_GetWidth() != 0 && Voodoo_OGL_GetHeight() != 0 && + Voodoo_OGL_Active() && sdl.desktop.prevent_fullscreen) { /* 3Dfx openGL do not allow resize */ sdl.clip.x=0;sdl.clip.y=0; - sdl.clip.w=(Bit16u)(render.src.width); - sdl.clip.h=(Bit16u)(render.src.height); + sdl.clip.w=(Bit16u)Voodoo_OGL_GetWidth(); + sdl.clip.h=(Bit16u)Voodoo_OGL_GetHeight(); sdl.surface=SDL_SetVideoMode(sdl.clip.w,sdl.clip.h,bpp,sdl_flags); sdl.deferred_resize = false; sdl.must_redraw_all = true; diff --git a/src/hardware/voodoo_opengl.cpp b/src/hardware/voodoo_opengl.cpp index d79cfe18a21..17e89b39b7a 100644 --- a/src/hardware/voodoo_opengl.cpp +++ b/src/hardware/voodoo_opengl.cpp @@ -68,6 +68,18 @@ std::map textures[2]; void GFX_PreventFullscreen(bool lockout); +int Voodoo_OGL_GetWidth() { + return v->fbi.width; +} + +int Voodoo_OGL_GetHeight() { + return v->fbi.height; +} + +bool Voodoo_OGL_Active() { + return (v->clock_enabled && v->output_on); +} + static void ogl_get_depth(voodoo_state* VV, INT32 ITERZ, INT64 ITERW, INT32 *depthval, INT32 *out_wfloat) { INT32 wfloat;