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
This commit is contained in:
John Peterson 2009-06-08 20:07:20 +00:00
parent 085fa5f526
commit 63ae48d9f9
3 changed files with 17 additions and 13 deletions

View File

@ -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();

View File

@ -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)

View File

@ -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
// ¯¯¯¯¯¯¯¯¯¯¯¯¯