From dc34aed50b5cb3840468af2591c2a0ea0f8abc29 Mon Sep 17 00:00:00 2001 From: Bernie Innocenti Date: Mon, 15 Oct 2018 00:43:40 +0900 Subject: [PATCH] Use GLSL 3.0 ES for all shaders --- shaders/mandelwow.frag | 17 +++++++++-------- shaders/mandelwow.vert | 9 +++++---- shaders/text.frag | 2 +- shaders/text.vert | 2 +- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/shaders/mandelwow.frag b/shaders/mandelwow.frag index 0551a34..8107b3d 100644 --- a/shaders/mandelwow.frag +++ b/shaders/mandelwow.frag @@ -1,7 +1,8 @@ -#version 100 +#version 300 es precision highp float; -varying vec2 c; -varying vec2 z; +in vec2 c; +in vec2 z; +out vec4 color; void main() { float zx = z.x; @@ -12,14 +13,14 @@ void main() { float zy2 = zy * zy; if (zx2 * zy2 > 4.0) { float index = float(iter) / float(maxiter); - gl_FragColor = vec4(index, 0.1, 1.0 - index / 2.0, 0.8 - index * index); + color = vec4(index, 0.1, 1.0 - index / 2.0, 0.8 - index * index); return; } zy = zx * zy * 2.0 + c.y; zx = zx2 - zy2 + c.x; } - gl_FragColor = vec4((sin(z.y) + 1.0) / 4.0, - (sin(z.x) + 1.0) / 4.0, - (sin(c.x) + 1.0) / 4.0, - 1.0); + color = vec4((sin(z.y) + 1.0) / 4.0, + (sin(z.x) + 1.0) / 4.0, + (sin(c.x) + 1.0) / 4.0, + 1.0); } diff --git a/shaders/mandelwow.vert b/shaders/mandelwow.vert index 0e67eda..b7556a7 100644 --- a/shaders/mandelwow.vert +++ b/shaders/mandelwow.vert @@ -1,11 +1,12 @@ -#version 100 +#version 300 es +precision lowp float; uniform mat4 perspective; uniform mat4 view; uniform mat4 model; uniform vec2 z0; -attribute mediump vec3 position; -varying mediump vec2 c; -varying mediump vec2 z; +in vec3 position; +out vec2 c; +out vec2 z; void main() { mat4 modelview = view * model; diff --git a/shaders/text.frag b/shaders/text.frag index ab43bfe..3df3010 100644 --- a/shaders/text.frag +++ b/shaders/text.frag @@ -1,4 +1,4 @@ -#version 140 +#version 300 es uniform sampler2D tex; uniform vec4 bgcolor; uniform vec4 fgcolor; diff --git a/shaders/text.vert b/shaders/text.vert index e3544f7..90e0b9f 100644 --- a/shaders/text.vert +++ b/shaders/text.vert @@ -1,4 +1,4 @@ -#version 140 +#version 300 es uniform mat4 model; uniform mat4 perspview; -- 2.25.1