From c10e839dc077ce9926ab9eeca8843130f77ce0d1 Mon Sep 17 00:00:00 2001 From: Bart Trzynadlowski Date: Tue, 13 Sep 2011 06:30:42 +0000 Subject: [PATCH] Added a scissor box to clip viewable area. Prevents garbage in the "overscan" areas due to renderer creating viewports that exceed intended display area. --- Src/OSD/SDL/Main.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Src/OSD/SDL/Main.cpp b/Src/OSD/SDL/Main.cpp index 42eb01f..a05397d 100644 --- a/Src/OSD/SDL/Main.cpp +++ b/Src/OSD/SDL/Main.cpp @@ -1,9 +1,6 @@ //TODO before release: -// - remove UI dump input state -// - VBL timing? -// - Controls for Dirt Devils, and other recent games (is bass working?) +// - Re-do cursors, make them larger // - Comment source code, clean up -// - BOOL -> bool, TRUE/FALSE -> true/false // - Add option for building with /MD in MSVC Makefile // - Remove SUPERMODEL_SOUND @@ -165,7 +162,8 @@ static bool CreateGLScreen(const char *caption, unsigned *xOffsetPtr, unsigned * return FAIL; } - VideoInfo = SDL_GetVideoInfo(); // what resolution did we actually get? + // What resolution did we actually get? + VideoInfo = SDL_GetVideoInfo(); // If required, fix the aspect ratio of the resolution that the user passed to match Model 3 ratio xRes = (float) *xResPtr; @@ -219,6 +217,13 @@ static bool CreateGLScreen(const char *caption, unsigned *xOffsetPtr, unsigned * // Write back resolution parameters *xResPtr = (unsigned) xRes; *yResPtr = (unsigned) yRes; + + // Scissor box (to clip visible area) + if (VideoInfo->current_w > *xResPtr || VideoInfo->current_h > *yResPtr) + { + glEnable(GL_SCISSOR_TEST); + glScissor(xOffset, yOffset, xRes, yRes); + } return 0; } @@ -752,7 +757,7 @@ int Supermodel(const char *zipFile, CInputs *Inputs, CINIFile *CmdLine) // Show crosshairs for light gun games UpdateCrosshairs(Inputs, showCrosshairs); - + // Swap the buffers SDL_GL_SwapBuffers(); }