summaryrefslogtreecommitdiff
path: root/Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp
diff options
context:
space:
mode:
authorSonicadvance1 <sonicadvance1@gmail.com>2008-08-24 10:10:48 +0000
committerSonicadvance1 <sonicadvance1@gmail.com>2008-08-24 10:10:48 +0000
commit05cbb94cbb4eec4af39df8743731e7df0c48dffc (patch)
tree55f9351d6bba93591d44fec785c84bc8ed3090ca /Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp
parent98b9cfb2ded64d75118fc7d1fae3841af4e8fe4c (diff)
GL plugin now centers video output, you can set it to render to the full window and FPS can be shown. FPS and stretch to Window res is set in INI. Maybe also the window res actually changes correctly when resizing window in Windows?
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@287 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp')
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp37
1 files changed, 32 insertions, 5 deletions
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp
index c999f6d4c4..ef5e4abd5d 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp
@@ -32,6 +32,7 @@
// screen offset
int nBackbufferWidth, nBackbufferHeight;
+int nXoff, nYoff;
#ifndef _WIN32
GLWindow GLWin;
@@ -148,8 +149,20 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
float FactorH = 480.0f / (float)nBackbufferHeight;
float Max = (FactorW < FactorH) ? FactorH : FactorW;
- MValue = 1.0f / Max;
-
+ if(g_Config.bStretchToFit)
+ {
+ MValueX = 1.0f / FactorW;
+ MValueY = 1.0f / FactorH;
+ nXoff = 0;
+ nYoff = 0;
+ }
+ else
+ {
+ MValueX = 1.0f / Max;
+ MValueY = 1.0f / Max;
+ nXoff = (nBackbufferWidth - (640 * MValueX)) / 2;
+ nYoff = (nBackbufferHeight - (480 * MValueY)) / 2;
+ }
g_VideoInitialize.pPeekMessages = &Callback_PeekMessages;
g_VideoInitialize.pUpdateFPSDisplay = &UpdateFPSDisplay;
@@ -485,12 +498,26 @@ void OpenGL_Update()
::MoveWindow(EmuWindow::GetWnd(), 0,0,width,height, FALSE);
nBackbufferWidth = width;
nBackbufferHeight = height;
- float FactorW = (float)640 / (float)nBackbufferWidth;
- float FactorH = (float)480 / (float)nBackbufferHeight;
+ float FactorW = 640.0f / (float)nBackbufferWidth;
+ float FactorH = 480.0f / (float)nBackbufferHeight;
float Max = (FactorW < FactorH) ? FactorH : FactorW;
- MValue = 1 / Max;
+ float Max = (FactorW < FactorH) ? FactorH : FactorW;
+ if(g_Config.bStretchToFit)
+ {
+ MValueX = 1.0f / FactorW;
+ MValueY = 1.0f / FactorH;
+ nXoff = 0;
+ nYoff = 0;
+ }
+ else
+ {
+ MValueX = 1.0f / Max;
+ MValueY = 1.0f / Max;
+ nXoff = (nBackbufferWidth - (640 * MValueX)) / 2;
+ nYoff = (nBackbufferHeight - (480 * MValueY)) / 2;
+ }
/*
u32 TmpAAx = (width / 640) - 1;
u32 TmpAAy = (height / 480) - 1;