summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2021-05-08 20:18:29 +0200
committersfan5 <sfan5@live.de>2021-05-11 21:15:39 +0200
commit69c70dd319532f7860f211f4a527a902b0386e49 (patch)
tree7ddfab40bd2f5c0bf7e50572e494bc41bf65388c /client
parent2443f1e2351d641d82597525e937792cce15be1e (diff)
downloadminetest-69c70dd319532f7860f211f4a527a902b0386e49.tar.gz
minetest-69c70dd319532f7860f211f4a527a902b0386e49.tar.bz2
minetest-69c70dd319532f7860f211f4a527a902b0386e49.zip
Fix swapped vertex colors on GLES2
Diffstat (limited to 'client')
-rw-r--r--client/shaders/default_shader/opengl_vertex.glsl4
-rw-r--r--client/shaders/minimap_shader/opengl_vertex.glsl4
-rw-r--r--client/shaders/nodes_shader/opengl_vertex.glsl10
-rw-r--r--client/shaders/object_shader/opengl_vertex.glsl4
-rw-r--r--client/shaders/selection_shader/opengl_vertex.glsl4
5 files changed, 23 insertions, 3 deletions
diff --git a/client/shaders/default_shader/opengl_vertex.glsl b/client/shaders/default_shader/opengl_vertex.glsl
index d95a3c2d3..a908ac953 100644
--- a/client/shaders/default_shader/opengl_vertex.glsl
+++ b/client/shaders/default_shader/opengl_vertex.glsl
@@ -3,5 +3,9 @@ varying lowp vec4 varColor;
void main(void)
{
gl_Position = mWorldViewProj * inVertexPosition;
+#ifdef GL_ES
+ varColor = inVertexColor.bgra;
+#else
varColor = inVertexColor;
+#endif
}
diff --git a/client/shaders/minimap_shader/opengl_vertex.glsl b/client/shaders/minimap_shader/opengl_vertex.glsl
index 1a9491805..b23d27181 100644
--- a/client/shaders/minimap_shader/opengl_vertex.glsl
+++ b/client/shaders/minimap_shader/opengl_vertex.glsl
@@ -7,5 +7,9 @@ void main(void)
{
varTexCoord = inTexCoord0.st;
gl_Position = mWorldViewProj * inVertexPosition;
+#ifdef GL_ES
+ varColor = inVertexColor.bgra;
+#else
varColor = inVertexColor;
+#endif
}
diff --git a/client/shaders/nodes_shader/opengl_vertex.glsl b/client/shaders/nodes_shader/opengl_vertex.glsl
index c68df4a8e..1a4840d35 100644
--- a/client/shaders/nodes_shader/opengl_vertex.glsl
+++ b/client/shaders/nodes_shader/opengl_vertex.glsl
@@ -146,10 +146,14 @@ void main(void)
// the brightness, so now we have to multiply these
// colors with the color of the incoming light.
// The pre-baked colors are halved to prevent overflow.
- vec4 color;
+#ifdef GL_ES
+ vec4 color = inVertexColor.bgra;
+#else
+ vec4 color = inVertexColor;
+#endif
// The alpha gives the ratio of sunlight in the incoming light.
- float nightRatio = 1.0 - inVertexColor.a;
- color.rgb = inVertexColor.rgb * (inVertexColor.a * dayLight.rgb +
+ float nightRatio = 1.0 - color.a;
+ color.rgb = color.rgb * (color.a * dayLight.rgb +
nightRatio * artificialLight.rgb) * 2.0;
color.a = 1.0;
diff --git a/client/shaders/object_shader/opengl_vertex.glsl b/client/shaders/object_shader/opengl_vertex.glsl
index b4a4d0aaa..f26224e82 100644
--- a/client/shaders/object_shader/opengl_vertex.glsl
+++ b/client/shaders/object_shader/opengl_vertex.glsl
@@ -49,5 +49,9 @@ void main(void)
: directional_ambient(normalize(inVertexNormal));
#endif
+#ifdef GL_ES
+ varColor = inVertexColor.bgra;
+#else
varColor = inVertexColor;
+#endif
}
diff --git a/client/shaders/selection_shader/opengl_vertex.glsl b/client/shaders/selection_shader/opengl_vertex.glsl
index 9ca87a9cf..39dde3056 100644
--- a/client/shaders/selection_shader/opengl_vertex.glsl
+++ b/client/shaders/selection_shader/opengl_vertex.glsl
@@ -6,5 +6,9 @@ void main(void)
varTexCoord = inTexCoord0.st;
gl_Position = mWorldViewProj * inVertexPosition;
+#ifdef GL_ES
+ varColor = inVertexColor.bgra;
+#else
varColor = inVertexColor;
+#endif
}