From 8392d6bcd411bc31824405d31b07361cbe910d20 Mon Sep 17 00:00:00 2001 From: John Peterson Date: Sun, 7 Jun 2009 11:51:53 +0000 Subject: [PATCH] OpenGL Screenshot: Fixed AA and wireframe screenshots again git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3352 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp | 2 + Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 44 ++++++++++++++++--- Source/Plugins/Plugin_VideoOGL/Src/main.cpp | 16 +++++++ 3 files changed, 57 insertions(+), 5 deletions(-) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp index 7e9adbc424..4870fa8baf 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp @@ -229,6 +229,8 @@ void ConfigDialog::CreateGUIControls() "Select internal resolution for the separate rendering window. This resolution also applies" " to the fullscreen mode" "\n\nApplies instanty during gameplay: No")); + m_MSAAModeCB->SetToolTip(wxT( + "Applies instanty during gameplay: No")); // Enhancements sbEnhancements = new wxStaticBoxSizer(wxVERTICAL, m_PageGeneral, wxT("Enhancements")); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 87557c76fe..1b57a7cc3f 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -870,9 +870,9 @@ void Renderer::Swap(const TRectangle& rc) } // --------------------------------------------------------------------- - // Save screenshot + // Save screenshot if AA and wireframe is off. // ŻŻŻŻŻŻŻŻŻŻŻŻŻ - if (s_bScreenshot) + if (s_bScreenshot && s_MSAASamples == 1 && !g_Config.bWireFrame) { s_criticalScreenshot.Enter(); @@ -885,6 +885,9 @@ void Renderer::Swap(const TRectangle& rc) } // --------------------------------------------------------------------- + // --------------------------------------------------------------------- + // Apply AA + // ŻŻŻŻŻŻŻŻŻŻŻŻŻ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); if (/*s_bHaveFramebufferBlit*/ s_MSAASamples > 1) @@ -952,12 +955,34 @@ void Renderer::Swap(const TRectangle& rc) glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0); TextureMngr::DisableStage(0); } + // --------------------------------------------------------------------- + // --------------------------------------------------------------------- // Wireframe + // ŻŻŻŻŻŻŻŻŻŻŻŻŻ if (g_Config.bWireFrame) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + // --------------------------------------------------------------------- + // --------------------------------------------------------------------- + // Save screenshot if AA or wireframe is on. + // ŻŻŻŻŻŻŻŻŻŻŻŻŻ + if (s_bScreenshot && (s_MSAASamples > 1 || g_Config.bWireFrame)) + { + s_criticalScreenshot.Enter(); + + // Save screenshot + SaveRenderTarget(s_sScreenshotName.c_str(), OpenGL_GetBackbufferWidth(), OpenGL_GetBackbufferHeight(), 0); + // Reset settings + s_sScreenshotName = ""; + s_bScreenshot = false; + s_criticalScreenshot.Leave(); + } + // --------------------------------------------------------------------- + + // --------------------------------------------------------------------- // Frame dumps are handled a little differently in Windows + // ŻŻŻŻŻŻŻŻŻŻŻŻŻ #ifdef _WIN32 if (g_Config.bDumpFrames) { s_criticalScreenshot.Enter(); @@ -1037,6 +1062,7 @@ void Renderer::Swap(const TRectangle& rc) s_bLastFrameDumped = false; } #endif + // --------------------------------------------------------------------- // Place messages on the picture, then copy it to the screen SwapBuffers(); @@ -1256,6 +1282,10 @@ void Renderer::RenderText(const char* pstr, int left, int top, u32 color) 0, nBackbufferWidth, nBackbufferHeight); } + +////////////////////////////////////////////////////////////////////////////////////////// +// Save screenshot +// ŻŻŻŻŻŻŻŻŻŻŻŻŻ void Renderer::SetScreenshot(const char *filename) { s_criticalScreenshot.Enter(); @@ -1290,15 +1320,16 @@ bool Renderer::SaveRenderTarget(const char *filename, int W, int H, int YOffset) wxImage a(W, H, data); // --------------------------------------------------------------------- - // If it's not a 4:3 picture rescale it to 4:3. This only applies to native resolutions. + // If it's not a 4:3 picture rescale it to 4:3. For example in RE1 some native pictures + // have non-4:3 resolutions. This only applies to native resolutions. // ŻŻŻŻŻŻŻŻŻŻŻŻŻ // Todo: There is currently no adjustment for non-16:9 source pictures that are intended for a 16:9 // size because I think all Wii 16:9 source pictures are 16:9 to begin with. If not, add a 16:9 adjustment // too. // ŻŻŻŻŻŻŻŻŻŻŻŻŻ - /**/ float Ratio = (float)W / (float)(H); - if (g_Config.bNativeResolution && Ratio != 4.0/3.0 && Ratio != 16.0/9.0) + if (g_Config.bNativeResolution && s_MSAASamples == 1 && !g_Config.bWireFrame + && Ratio != 4.0/3.0 && Ratio != 16.0/9.0) { // Check if the height or width should be changed if (Ratio < 4.0/3.0) @@ -1328,6 +1359,7 @@ bool Renderer::SaveRenderTarget(const char *filename, int W, int H, int YOffset) return result; } + void Renderer::FlipImageData(u8 *data, int w, int h) { // Flip image upside down. Damn OpenGL. @@ -1341,6 +1373,8 @@ void Renderer::FlipImageData(u8 *data, int w, int h) } } } +////////////////////////////////////////////////////////////////////////////////////////// + // ------------------------------------------------------------------------------------------------------------ // Function: This function does not have the final picture. Use Renderer::Swap() to adjust the final picture. diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index 1be8064e64..f3f2dcb3bd 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -30,6 +30,22 @@ 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 +1.2 Screenshots +// ŻŻŻŻŻŻŻŻŻŻŻŻŻ + +The screenshots should be taken from the internal representation of the picture regardless of +what the current window size is. Since AA and wireframe is applied together with the picture resizing +this rule is not currently applied to AA or wireframe pictures, they are instead taken from whatever +the window size is. + +Todo: Render AA and wireframe to a separate picture used for the screenshot in addition to the one +for display. + +1.3 AA +// ŻŻŻŻŻŻŻŻŻŻŻŻŻ + +Make AA apply instantly during gameplay if possible + ////////////////////////////////////////////////////////////////////////////////////////*/