From ef7ad9a54987c195e57e1dd206bca50e37b95909 Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Sun, 1 Mar 2015 13:35:01 +0600 Subject: [PATCH] Correct force clamp condition in OGLRender::drawTexturedRect Fixed sun in Perfect Dark, which was broken after commit ba89dce8512: Remove textures coordinates swap in case of lower coordinate is larger than higher one. --- OpenGL.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenGL.cpp b/OpenGL.cpp index 06684f97..2030d7c7 100644 --- a/OpenGL.cpp +++ b/OpenGL.cpp @@ -1112,10 +1112,10 @@ void OGLRender::drawTexturedRect(const TexturedRectParams & _params) glActiveTexture( GL_TEXTURE0 ); - if ((texST[0].s0 >= 0.0 && texST[0].s1 <= cache.current[0]->width) || (cache.current[0]->maskS + cache.current[0]->mirrorS == 0 && (texST[0].s0 < -1024.0f || texST[0].s1 > 1023.99f))) + if ((texST[0].s0 < texST[0].s1 && texST[0].s0 >= 0.0 && texST[0].s1 <= cache.current[0]->width) || (cache.current[0]->maskS + cache.current[0]->mirrorS == 0 && (texST[0].s0 < -1024.0f || texST[0].s1 > 1023.99f))) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - if (texST[0].t0 >= 0.0f && texST[0].t1 <= cache.current[0]->height) + if (texST[0].t0 < texST[0].t1 && texST[0].t0 >= 0.0f && texST[0].t1 <= cache.current[0]->height) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); texST[0].s0 *= cache.current[0]->scaleS;