diff --git a/desmume/src/OGLRender.cpp b/desmume/src/OGLRender.cpp index d75ea542d..c23afbeab 100755 --- a/desmume/src/OGLRender.cpp +++ b/desmume/src/OGLRender.cpp @@ -1,7 +1,7 @@ /* Copyright (C) 2006 yopyop Copyright (C) 2006-2007 shash - Copyright (C) 2008-2018 DeSmuME team + Copyright (C) 2008-2019 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -294,7 +294,8 @@ void main() \n\ \n\ vtxTexCoord = texScaleMtx * inTexCoord0; \n\ vtxColor = vec4(inColor / 63.0, polyAlpha); \n\ - gl_Position = inPosition; \n\ + gl_Position.xyw = inPosition.xyw;\n\ + gl_Position.z = (inPosition.z + inPosition.w) / 2.0;\n\ } \n\ "}; @@ -419,10 +420,10 @@ void main()\n\ #endif\n\ #else\n\ #if ENABLE_W_DEPTH\n\ - gl_FragDepth = clamp( (4096.0/gl_FragCoord.w) / 16777215.0, 0.0, 1.0 );\n\ + gl_FragDepth = (4096.0/gl_FragCoord.w) / 16777215.0;\n\ #else\n\ // hack: when using z-depth, drop some LSBs so that the overworld map in Dragon Quest IV shows up correctly\n\ - gl_FragDepth = clamp( (floor(gl_FragCoord.z * 4194303.0) * 4.0) / 16777215.0, 0.0, 1.0 );\n\ + gl_FragDepth = (floor(gl_FragCoord.z * 4194303.0) * 4.0) / 16777215.0;\n\ #endif\n\ #endif\n\ #endif\n\ diff --git a/desmume/src/OGLRender_3_2.cpp b/desmume/src/OGLRender_3_2.cpp index 729a40023..d6a57a410 100755 --- a/desmume/src/OGLRender_3_2.cpp +++ b/desmume/src/OGLRender_3_2.cpp @@ -146,7 +146,8 @@ void main()\n\ \n\ vtxTexCoord = texScaleMtx * inTexCoord0;\n\ vtxColor = vec4(inColor / 63.0, polyAlpha);\n\ - gl_Position = inPosition;\n\ + gl_Position.xyw = inPosition.xyw;\n\ + gl_Position.z = (inPosition.z + inPosition.w) / 2.0;\n\ }\n\ "}; @@ -290,10 +291,10 @@ void main()\n\ #endif\n\ #else\n\ #if ENABLE_W_DEPTH\n\ - gl_FragDepth = clamp( (4096.0/gl_FragCoord.w) / 16777215.0, 0.0, 1.0 );\n\ + gl_FragDepth = (4096.0/gl_FragCoord.w) / 16777215.0;\n\ #else\n\ // hack: when using z-depth, drop some LSBs so that the overworld map in Dragon Quest IV shows up correctly\n\ - gl_FragDepth = clamp( (floor(gl_FragCoord.z * 4194303.0) * 4.0) / 16777215.0, 0.0, 1.0 );\n\ + gl_FragDepth = (floor(gl_FragCoord.z * 4194303.0) * 4.0) / 16777215.0;\n\ #endif\n\ #endif\n\ #endif\n\