Added a scissor box to clip viewable area. Prevents garbage in the "overscan" areas due to renderer creating viewports that exceed intended display area.

This commit is contained in:
Bart Trzynadlowski 2011-09-13 06:30:42 +00:00
parent fdedc60f84
commit c10e839dc0

View file

@ -1,9 +1,6 @@
//TODO before release: //TODO before release:
// - remove UI dump input state // - Re-do cursors, make them larger
// - VBL timing?
// - Controls for Dirt Devils, and other recent games (is bass working?)
// - Comment source code, clean up // - Comment source code, clean up
// - BOOL -> bool, TRUE/FALSE -> true/false
// - Add option for building with /MD in MSVC Makefile // - Add option for building with /MD in MSVC Makefile
// - Remove SUPERMODEL_SOUND // - Remove SUPERMODEL_SOUND
@ -165,7 +162,8 @@ static bool CreateGLScreen(const char *caption, unsigned *xOffsetPtr, unsigned *
return FAIL; 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 // If required, fix the aspect ratio of the resolution that the user passed to match Model 3 ratio
xRes = (float) *xResPtr; xRes = (float) *xResPtr;
@ -219,6 +217,13 @@ static bool CreateGLScreen(const char *caption, unsigned *xOffsetPtr, unsigned *
// Write back resolution parameters // Write back resolution parameters
*xResPtr = (unsigned) xRes; *xResPtr = (unsigned) xRes;
*yResPtr = (unsigned) yRes; *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; return 0;
} }
@ -752,7 +757,7 @@ int Supermodel(const char *zipFile, CInputs *Inputs, CINIFile *CmdLine)
// Show crosshairs for light gun games // Show crosshairs for light gun games
UpdateCrosshairs(Inputs, showCrosshairs); UpdateCrosshairs(Inputs, showCrosshairs);
// Swap the buffers // Swap the buffers
SDL_GL_SwapBuffers(); SDL_GL_SwapBuffers();
} }