From 5d29c7d6aa9fadecd99c8e775a768be7a3d04283 Mon Sep 17 00:00:00 2001 From: codeanticode Date: Thu, 12 Apr 2012 11:17:33 +0000 Subject: [PATCH] Using float constants in the shaders to avoid errors by the GLSL compiler on Mac. --- android/core/src/processing/opengl/FillShaderVertFull.glsl | 4 ++-- android/core/src/processing/opengl/FillShaderVertLit.glsl | 4 ++-- .../opengl/src/processing/opengl/FillShaderVertFull.glsl | 6 +++--- .../opengl/src/processing/opengl/FillShaderVertLit.glsl | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/android/core/src/processing/opengl/FillShaderVertFull.glsl b/android/core/src/processing/opengl/FillShaderVertFull.glsl index c9a79eb50..cd6f6ce7f 100644 --- a/android/core/src/processing/opengl/FillShaderVertFull.glsl +++ b/android/core/src/processing/opengl/FillShaderVertFull.glsl @@ -83,10 +83,10 @@ void main() { // Normal vector in eye coordinates vec3 ecNormal = normalize(normalMatrix * inNormal); - if (dot(-ecVertex, ecNormal) < 0) { + if (dot(-ecVertex, ecNormal) < zero_float) { // If normal is away from camera, choose its opposite. // If we add backface culling, this will be backfacing - ecNormal *= -1; + ecNormal *= -one_float; } // Light calculations diff --git a/android/core/src/processing/opengl/FillShaderVertLit.glsl b/android/core/src/processing/opengl/FillShaderVertLit.glsl index 33d2360e7..7c184a807 100644 --- a/android/core/src/processing/opengl/FillShaderVertLit.glsl +++ b/android/core/src/processing/opengl/FillShaderVertLit.glsl @@ -80,10 +80,10 @@ void main() { // Normal vector in eye coordinates vec3 ecNormal = normalize(normalMatrix * inNormal); - if (dot(-ecVertex, ecNormal) < 0) { + if (dot(-ecVertex, ecNormal) < zero_float) { // If normal is away from camera, choose its opposite. // If we add backface culling, this will be backfacing - ecNormal *= -1; + ecNormal *= -one_float; } // Light calculations diff --git a/java/libraries/opengl/src/processing/opengl/FillShaderVertFull.glsl b/java/libraries/opengl/src/processing/opengl/FillShaderVertFull.glsl index c9a79eb50..edbcb78fb 100644 --- a/java/libraries/opengl/src/processing/opengl/FillShaderVertFull.glsl +++ b/java/libraries/opengl/src/processing/opengl/FillShaderVertFull.glsl @@ -83,11 +83,11 @@ void main() { // Normal vector in eye coordinates vec3 ecNormal = normalize(normalMatrix * inNormal); - if (dot(-ecVertex, ecNormal) < 0) { + if (dot(-ecVertex, ecNormal) < zero_float) { // If normal is away from camera, choose its opposite. // If we add backface culling, this will be backfacing - ecNormal *= -1; - } + ecNormal *= -one_float; + } // Light calculations vec3 totalAmbient = vec3(0, 0, 0); diff --git a/java/libraries/opengl/src/processing/opengl/FillShaderVertLit.glsl b/java/libraries/opengl/src/processing/opengl/FillShaderVertLit.glsl index 33d2360e7..7c184a807 100644 --- a/java/libraries/opengl/src/processing/opengl/FillShaderVertLit.glsl +++ b/java/libraries/opengl/src/processing/opengl/FillShaderVertLit.glsl @@ -80,10 +80,10 @@ void main() { // Normal vector in eye coordinates vec3 ecNormal = normalize(normalMatrix * inNormal); - if (dot(-ecVertex, ecNormal) < 0) { + if (dot(-ecVertex, ecNormal) < zero_float) { // If normal is away from camera, choose its opposite. // If we add backface culling, this will be backfacing - ecNormal *= -1; + ecNormal *= -one_float; } // Light calculations