From 63ae48d9f98ec0973637fd385ede2238f849773c Mon Sep 17 00:00:00 2001 From: John Peterson Date: Mon, 8 Jun 2009 20:07:20 +0000 Subject: [PATCH] OpenGL: Fixed initial framebuffer so it's not too small git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3381 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp | 2 ++ Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 23 ++++++++++--------- Source/Plugins/Plugin_VideoOGL/Src/main.cpp | 5 ++-- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp index 429a04a986..f5d84c587e 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp @@ -485,9 +485,11 @@ void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event) break; case ID_NATIVERESOLUTION: g_Config.bNativeResolution = m_NativeResolution->IsChecked(); + if (g_Config.bNativeResolution) g_Config.b2xResolution = false; break; case ID_2X_RESOLUTION: g_Config.b2xResolution = m_2xResolution->IsChecked(); + if (g_Config.b2xResolution) g_Config.bNativeResolution = false; break; case ID_VSYNC: g_Config.bVSync = m_VSync->IsChecked(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index d0ed2be5ac..3227af85b9 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -306,10 +306,12 @@ bool Renderer::Init() // The EFB is larger than 640x480 - in fact, it's 640x528, give or take a couple of lines. // So the below is wrong. // This should really be grabbed from config rather than from OpenGL. - // JP: Set these big enough to accomodate any potential 2x mode - s_targetwidth = 1280; - s_targetheight = 960; - + // JP: Set these to the biggest of the 2x mode and the custom resolution so that the framebuffer + // does not get to be too small + int W = (int)OpenGL_GetBackbufferWidth(), H = (int)OpenGL_GetBackbufferHeight(); + s_targetwidth = (1280 >= W) ? 1280 : W; + s_targetheight = (960 >= H) ? 960 : H; + // Compensate height of render target for scaling, so that we get something close to the correct number of // vertical pixels. s_targetheight *= 528.0 / 480.0; @@ -1098,7 +1100,7 @@ void Renderer::Swap(const TRectangle& rc) // Place messages on the picture, then copy it to the screen SwapBuffers(); - // Why save this as s_bNativeResolution if we updated it all the time? + // Why save this as s_bNativeResolution if we updated it every frame? s_bNativeResolution = g_Config.bNativeResolution; RestoreGLState(); @@ -1156,10 +1158,8 @@ void Renderer::SwapBuffers() } #endif // Copy the rendered frame to the real window - OpenGL_SwapBuffers(); - - + // Clear framebuffer glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT); @@ -1340,7 +1340,7 @@ void Renderer::DrawDebugText() std::string OSDM31 = g_Config.bCopyEFBToRAM ? "RAM" : "Texture"; std::string OSDM32 = - g_Config.bEFBCopyDisable ? "Yes" : "No"; + g_Config.bEFBCopyDisable ? "No" : "Yes"; // If there is more text than this we will have a collission if (g_Config.bShowFPS) @@ -1398,6 +1398,7 @@ bool Renderer::SaveRenderTarget(const char *filename, int W, int H, int YOffset) if (!(g_Config.bNativeResolution || g_Config.b2xResolution)) sscanf(g_Config.iInternalRes, "%dx%d", &W, &H); + u8 *data = (u8 *)malloc(3 * W * H); glPixelStorei(GL_PACK_ALIGNMENT, 1); glReadPixels(0, YOffset, W, H, GL_RGB, GL_UNSIGNED_BYTE, data); @@ -1424,8 +1425,8 @@ bool Renderer::SaveRenderTarget(const char *filename, int W, int H, int YOffset) // ŻŻŻŻŻŻŻŻŻŻŻŻŻ // We don't adjust non-native resolutions to avoid blurring the picture. // ŻŻŻŻŻŻŻŻŻŻŻŻŻ - float Ratio = (float)W / (float)(H), TargetRatio, TargetRatio1; - if (g_Config.bNativeResolution && (g_Config.bKeepAR169 || g_Config.bKeepAR43) + float Ratio = (float)W / (float)(H), TargetRatio; + if ((g_Config.bNativeResolution || g_Config.b2xResolution) && (g_Config.bKeepAR169 || g_Config.bKeepAR43) && Ratio != 4.0/3.0 && Ratio != 16.0/9.0) { if (g_Config.bKeepAR43) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index 167663db4f..1b7f8e2bc6 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -27,8 +27,9 @@ Internal and fullscreen resolution: Since the only internal resolutions allowed fullscreen resolution allowed by the system there is only need for one resolution setting that applies to both the internal resolution and the fullscreen resolution. -Todo: Make the internal resolution option apply instantly, currently only the native or not option -applies instantly +Todo: Make the internal resolution option apply instantly, currently only the native and 2x option +applies instantly. To do this we need to enumerate all avaliable display resolutions before +Renderer:Init(). 1.2 Screenshots // ŻŻŻŻŻŻŻŻŻŻŻŻŻ