From 1dea1a32bb43a2cc8eaf3d07400ddb82dd6bbb22 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Wed, 4 Mar 2020 19:15:13 +0300 Subject: [PATCH] GLES compat --- samples/ControlCatalog/Pages/OpenGlPage.xaml.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/samples/ControlCatalog/Pages/OpenGlPage.xaml.cs b/samples/ControlCatalog/Pages/OpenGlPage.xaml.cs index 358efea4d0..eb75d905a6 100644 --- a/samples/ControlCatalog/Pages/OpenGlPage.xaml.cs +++ b/samples/ControlCatalog/Pages/OpenGlPage.xaml.cs @@ -85,7 +85,7 @@ namespace ControlCatalog.Pages private string WithVersionAndPrecision(string shader, string precision) => WithVersion(DisplayType == GlDisplayType.OpenGLES ? $"precision {precision};\n{shader}" : shader); - private string VertexShaderSource => WithVersion(@" + private string VertexShaderSource => WithVersionAndPrecision(@" attribute vec3 aPos; attribute vec3 aNormal; uniform mat4 uModel; @@ -113,7 +113,7 @@ namespace ControlCatalog.Pages VecPos = aPos; Normal = normalize(vec3(uModel * vec4(aNormal, 1.0))); } -"); +", "mediump float"); private string FragmentShaderSource => WithVersionAndPrecision(@" varying vec3 FragPos; @@ -131,12 +131,12 @@ namespace ControlCatalog.Pages float s = sin(-atan(VecPos.z, VecPos.x) * 20.0 - uTime * 20.0 - y * 30.0); vec3 discoColor = vec3( - 0.5 + abs(0.5 - y) * cos(uTime * 10), - 0.25 + (smoothstep(0.3, 0.8, y) * (0.5 - c/4)), - 0.25 + abs((smoothstep(0.1, 0.4, y) * (0.5 - s/4)))); + 0.5 + abs(0.5 - y) * cos(uTime * 10.0), + 0.25 + (smoothstep(0.3, 0.8, y) * (0.5 - c / 4.0)), + 0.25 + abs((smoothstep(0.1, 0.4, y) * (0.5 - s / 4.0)))); vec3 objectColor = vec3((1.0 - y), 0.40 + y / 4.0, y * 0.75 + 0.25); - objectColor = objectColor * (1-uDisco) + discoColor * uDisco; + objectColor = objectColor * (1.0 - uDisco) + discoColor * uDisco; float ambientStrength = 0.3; vec3 lightColor = vec3(1.0, 1.0, 1.0);