From 3b5ca2397b08528e4e8773fc235cf66374d98cf9 Mon Sep 17 00:00:00 2001 From: OV2 Date: Mon, 21 May 2018 20:39:11 +0200 Subject: [PATCH] win32: do not overwrite glsl output --- win32/COpenGL.cpp | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/win32/COpenGL.cpp b/win32/COpenGL.cpp index 9eb220c6..8152dcb7 100644 --- a/win32/COpenGL.cpp +++ b/win32/COpenGL.cpp @@ -484,39 +484,37 @@ void COpenGL::Render(SSurface Src) if(pboFunctionsLoaded) glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); - if (shader_type != OGL_SHADER_NONE) { + RECT windowSize, displayRect; + GetClientRect(hWnd, &windowSize); + //Get maximum rect respecting AR setting + displayRect = CalculateDisplayRect(windowSize.right, windowSize.bottom, windowSize.right, windowSize.bottom); - if(shader_type == OGL_SHADER_GLSL) { - RECT windowSize, displayRect; - GetClientRect(hWnd, &windowSize); - displayRect = CalculateDisplayRect(windowSize.right, windowSize.bottom, windowSize.right, windowSize.bottom); - glslShader->render(drawTexture, afterRenderWidth, afterRenderHeight, displayRect.right - displayRect.left, displayRect.bottom - displayRect.top, displayRect.left, displayRect.top); - } else if(shader_type == OGL_SHADER_CG) { + if (shader_type == OGL_SHADER_GLSL) { + glslShader->render(drawTexture, afterRenderWidth, afterRenderHeight, displayRect.right - displayRect.left, displayRect.bottom - displayRect.top, displayRect.left, displayRect.top); + } + else { + if(shader_type == OGL_SHADER_CG) { xySize inputSize = { (float)afterRenderWidth, (float)afterRenderHeight }; - RECT windowSize, displayRect; - GetClientRect(hWnd,&windowSize); xySize xywindowSize = { (double)windowSize.right, (double)windowSize.bottom }; - //Get maximum rect respecting AR setting - displayRect=CalculateDisplayRect(windowSize.right,windowSize.bottom,windowSize.right,windowSize.bottom); xySize viewportSize = { (double)(displayRect.right - displayRect.left), (double)(displayRect.bottom - displayRect.top) }; xySize textureSize = { (double)quadTextureSize, (double)quadTextureSize }; cgShader->Render(drawTexture, textureSize, inputSize, viewportSize, xywindowSize); } + if (Settings.BilinearFilter) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + } + else { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + } + + glClearColor(0.0f, 0.0f, 0.0f, 0.5f); + glClear(GL_COLOR_BUFFER_BIT); + glDrawArrays(GL_QUADS, 0, 4); } - if(Settings.BilinearFilter) { - glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - } else { - glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - } - - glClearColor(0.0f, 0.0f, 0.0f, 0.5f); - glClear(GL_COLOR_BUFFER_BIT); - glDrawArrays (GL_QUADS, 0, 4); - glFlush(); SwapBuffers(hDC); if (GUI.ReduceInputLag)