diff --git a/Src/Graphics/New3D/R3DFrameBuffers.cpp b/Src/Graphics/New3D/R3DFrameBuffers.cpp index 91d4cad..303ee9f 100644 --- a/Src/Graphics/New3D/R3DFrameBuffers.cpp +++ b/Src/Graphics/New3D/R3DFrameBuffers.cpp @@ -201,6 +201,8 @@ void R3DFrameBuffers::AllocShaderBase() { const char *vertexShader = R"glsl( + #version 120 + // inputs attribute vec3 inVertex; attribute vec2 inTexCoord; @@ -218,6 +220,8 @@ void R3DFrameBuffers::AllocShaderBase() const char *fragmentShader = R"glsl( + #version 120 + uniform sampler2D tex1; // base tex varying vec2 fsTexCoord; @@ -241,6 +245,8 @@ void R3DFrameBuffers::AllocShaderTrans() { const char *vertexShader = R"glsl( + #version 120 + // inputs attribute vec3 inVertex; attribute vec2 inTexCoord; @@ -258,6 +264,8 @@ void R3DFrameBuffers::AllocShaderTrans() const char *fragmentShader = R"glsl( + #version 120 + uniform sampler2D tex1; // trans layer 1 uniform sampler2D tex2; // trans layer 2 @@ -269,10 +277,11 @@ void R3DFrameBuffers::AllocShaderTrans() vec4 colTrans2 = texture2D( tex2, fsTexCoord); if(colTrans1.a+colTrans2.a > 0.0) { - vec3 col1 = (colTrans1.rgb * colTrans1.a) / ( colTrans1.a + colTrans2.a); // this is my best guess at the blending between the layers - vec3 col2 = (colTrans2.rgb * colTrans2.a) / ( colTrans1.a + colTrans2.a); + vec3 col1 = colTrans1.rgb * colTrans1.a; + vec3 col2 = colTrans2.rgb * colTrans2.a; - colTrans1 = vec4(col1+col2,colTrans1.a+colTrans2.a); + colTrans1 = vec4((col1+col2) / (colTrans1.a + colTrans2.a), // this is my best guess at the blending between the layers + colTrans1.a+colTrans2.a); } gl_FragColor = colTrans1; @@ -293,6 +302,8 @@ void R3DFrameBuffers::AllocShaderWipe() { const char *vertexShader = R"glsl( + #version 120 + // inputs attribute vec3 inVertex; attribute vec2 inTexCoord; @@ -310,6 +321,8 @@ void R3DFrameBuffers::AllocShaderWipe() const char *fragmentShader = R"glsl( + #version 120 + uniform sampler2D texColor; // base colour layer varying vec2 fsTexCoord; @@ -479,4 +492,4 @@ void R3DFrameBuffers::DrawAlphaLayer() m_shaderTrans.DisableShader(); } -} \ No newline at end of file +} diff --git a/Src/Graphics/New3D/R3DScrollFog.cpp b/Src/Graphics/New3D/R3DScrollFog.cpp index aa57f4a..be8e1af 100644 --- a/Src/Graphics/New3D/R3DScrollFog.cpp +++ b/Src/Graphics/New3D/R3DScrollFog.cpp @@ -6,6 +6,8 @@ namespace New3D { static const char *vertexShaderFog = R"glsl( +#version 120 + uniform mat4 mvp; attribute vec3 inVertex; @@ -18,6 +20,8 @@ void main(void) static const char *fragmentShaderFog = R"glsl( +#version 120 + uniform float fogAttenuation; uniform float fogAmbient; uniform vec4 fogColour;