diff --git a/core/src/processing/opengl/shaders/LightVert-vc4.glsl b/core/src/processing/opengl/shaders/LightVert-vc4.glsl index d008c529c..38366fee1 100644 --- a/core/src/processing/opengl/shaders/LightVert-vc4.glsl +++ b/core/src/processing/opengl/shaders/LightVert-vc4.glsl @@ -47,7 +47,8 @@ varying vec4 backVertColor; const float zero_float = 0.0; const float one_float = 1.0; -const vec3 zero_vec3 = vec3(0); +const vec3 zero_vec3 = vec3(0.0); +const vec3 minus_one_vec3 = vec3(0.0-1.0); float falloffFactor(vec3 lightPos, vec3 vertPos, vec3 coeff) { vec3 lpv = lightPos - vertPos; @@ -59,7 +60,7 @@ float falloffFactor(vec3 lightPos, vec3 vertPos, vec3 coeff) { float spotFactor(vec3 lightPos, vec3 vertPos, vec3 lightNorm, float minCos, float spotExp) { vec3 lpv = normalize(lightPos - vertPos); - vec3 nln = -one_float * lightNorm; + vec3 nln = minus_one_vec3 * lightNorm; float spotCos = dot(nln, lpv); return spotCos <= minCos ? zero_float : pow(spotCos, spotExp); } @@ -83,7 +84,7 @@ void main() { // Normal vector in eye coordinates vec3 ecNormal = normalize(normalMatrix * normal); - vec3 ecNormalInv = ecNormal * -one_float; + vec3 ecNormalInv = ecNormal * minus_one_vec3; // Light calculations vec3 totalAmbient = vec3(0, 0, 0); @@ -110,7 +111,7 @@ void main() { if (isDir) { falloff = one_float; - lightDir = -one_float * lightNormal[i]; + lightDir = minus_one_vec3 * lightNormal[i]; } else { falloff = falloffFactor(lightPos, ecVertex, lightFalloff[i]); lightDir = normalize(lightPos - ecVertex); diff --git a/core/src/processing/opengl/shaders/TexLightVert-vc4.glsl b/core/src/processing/opengl/shaders/TexLightVert-vc4.glsl index ef5ed5a61..daa4680fb 100644 --- a/core/src/processing/opengl/shaders/TexLightVert-vc4.glsl +++ b/core/src/processing/opengl/shaders/TexLightVert-vc4.glsl @@ -50,7 +50,8 @@ varying vec4 vertTexCoord; const float zero_float = 0.0; const float one_float = 1.0; -const vec3 zero_vec3 = vec3(0); +const vec3 zero_vec3 = vec3(0.0); +const vec3 minus_one_vec3 = vec3(0.0-1.0); float falloffFactor(vec3 lightPos, vec3 vertPos, vec3 coeff) { vec3 lpv = lightPos - vertPos; @@ -62,7 +63,7 @@ float falloffFactor(vec3 lightPos, vec3 vertPos, vec3 coeff) { float spotFactor(vec3 lightPos, vec3 vertPos, vec3 lightNorm, float minCos, float spotExp) { vec3 lpv = normalize(lightPos - vertPos); - vec3 nln = -one_float * lightNorm; + vec3 nln = minus_one_vec3 * lightNorm; float spotCos = dot(nln, lpv); return spotCos <= minCos ? zero_float : pow(spotCos, spotExp); } @@ -86,7 +87,7 @@ void main() { // Normal vector in eye coordinates vec3 ecNormal = normalize(normalMatrix * normal); - vec3 ecNormalInv = ecNormal * -one_float; + vec3 ecNormalInv = ecNormal * minus_one_vec3; // Light calculations vec3 totalAmbient = vec3(0, 0, 0); @@ -113,7 +114,7 @@ void main() { if (isDir) { falloff = one_float; - lightDir = -one_float * lightNormal[i]; + lightDir = minus_one_vec3 * lightNormal[i]; } else { falloff = falloffFactor(lightPos, ecVertex, lightFalloff[i]); lightDir = normalize(lightPos - ecVertex); diff --git a/java/src/processing/mode/java/Commander.java b/java/src/processing/mode/java/Commander.java index 4739c251f..1807b26bf 100644 --- a/java/src/processing/mode/java/Commander.java +++ b/java/src/processing/mode/java/Commander.java @@ -275,6 +275,7 @@ public class Commander implements RunnerListener { } else { runner.launch(sketchArgs); } + success = !runner.vmReturnedError(); } } else { success = false; diff --git a/java/src/processing/mode/java/runner/Runner.java b/java/src/processing/mode/java/runner/Runner.java index 2410e9c2c..05eba7764 100644 --- a/java/src/processing/mode/java/runner/Runner.java +++ b/java/src/processing/mode/java/runner/Runner.java @@ -59,6 +59,7 @@ public class Runner implements MessageConsumer { // Running remote VM protected VirtualMachine vm; + protected boolean vmReturnedError; // Thread transferring remote error stream to our error stream protected Thread errThread = null; @@ -130,6 +131,14 @@ public class Runner implements MessageConsumer { } + /** + * Whether the last invocation of launchJava() was successful or not + */ + public boolean vmReturnedError() { + return vmReturnedError; + } + + /** * Simple non-blocking launch of the virtual machine. VM starts suspended. * @return debuggee VM or null on failure @@ -408,6 +417,7 @@ public class Runner implements MessageConsumer { new Thread(new Runnable() { public void run() { // PApplet.println("java starting"); + vmReturnedError = false; process = PApplet.exec(args); try { // PApplet.println("java waiting"); @@ -445,6 +455,7 @@ public class Runner implements MessageConsumer { // changing this to separate editor and listener [091124] //if (editor != null) { listener.statusError("Could not run the sketch."); + vmReturnedError = true; //} // return null; } @@ -659,6 +670,9 @@ public class Runner implements MessageConsumer { } } else if (exceptionClass.equals("java.lang.UnsatisfiedLinkError")) { listener.statusError("A library used by this sketch is not installed properly."); + if (PApplet.platform == PConstants.LINUX) { + System.out.println(message); + } err.println("A library relies on native code that's not available."); err.println("Or only works properly when the sketch is run as a " + ((Platform.getNativeBits() == 32) ? "64-bit" : "32-bit") + " application.");