From 1b14ba886090efac0a65489cc399ed1be21c1cf4 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Thu, 4 Apr 2013 02:00:06 +0000 Subject: [PATCH] tutorial: GLSL ES compilation fixes. --- tutorial/02_cube.lolfx | 4 ++++ tutorial/03_noise.lolfx | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/tutorial/02_cube.lolfx b/tutorial/02_cube.lolfx index 3d143e4c..8e1ae04f 100644 --- a/tutorial/02_cube.lolfx +++ b/tutorial/02_cube.lolfx @@ -17,6 +17,10 @@ void main(void) #version 120 +#if defined GL_ES +precision highp float; +#endif + varying vec3 pass_Color; void main(void) diff --git a/tutorial/03_noise.lolfx b/tutorial/03_noise.lolfx index 5d779fc6..184252a7 100644 --- a/tutorial/03_noise.lolfx +++ b/tutorial/03_noise.lolfx @@ -46,6 +46,10 @@ void main(void) #version 120 +#if defined GL_ES +precision highp float; +#endif + uniform float u_Time; varying vec4 pass_Position; @@ -93,11 +97,18 @@ void main(void) test += 0.5 * (length(fract(d) - 0.5) - length(fract(d + 0.5) - 0.5)); /* Compute 4 octaves of noise */ +#if defined GL_ES + vec4 n = vec4(noise3d((test > 0.0) ? fire[0] : water[0]), + noise3d((test > 0.0) ? fire[1] : water[1]), + noise3d((test > 0.0) ? fire[2] : water[2]), + noise3d((test > 0.0) ? fire[3] : water[3])); +#else vec3 points[4] = (test > 0.0) ? fire : water; vec4 n = vec4(noise3d(points[0]), noise3d(points[1]), noise3d(points[2]), noise3d(points[3])); +#endif vec4 color;