From e94b2e8c7d3822a09df4e7a6a36f08ad67abd719 Mon Sep 17 00:00:00 2001 From: kiwistrongis Date: Tue, 4 Mar 2014 12:54:17 -0500 Subject: [PATCH 1/9] Fixed processing.mode.java.runner.Runner's exception trace for when the file name of a StackTraceElement is not known. Fixes issue #2346 --- app/src/processing/mode/java/runner/Runner.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/processing/mode/java/runner/Runner.java b/app/src/processing/mode/java/runner/Runner.java index 118376dd3..9bea617b5 100644 --- a/app/src/processing/mode/java/runner/Runner.java +++ b/app/src/processing/mode/java/runner/Runner.java @@ -923,7 +923,7 @@ public class Runner implements MessageConsumer { ObjectReference ref = (ObjectReference)val; method = ((ClassType) ref.referenceType()).concreteMethodByName("getFileName", "()Ljava/lang/String;"); StringReference strref = (StringReference) ref.invokeMethod(thread, method, new ArrayList(), ObjectReference.INVOKE_SINGLE_THREADED); - String filename = strref.value(); + String filename = strref == null ? "Unknown Source" : strref.value(); method = ((ClassType) ref.referenceType()).concreteMethodByName("getLineNumber", "()I"); IntegerValue intval = (IntegerValue) ref.invokeMethod(thread, method, new ArrayList(), ObjectReference.INVOKE_SINGLE_THREADED); int lineNumber = intval.intValue() - 1; From 1930f29626181c8bd64f0de63da640a89bb609e4 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Sun, 30 Mar 2014 10:05:46 -0400 Subject: [PATCH 2/9] discussing imports with Andres --- app/src/processing/mode/java/JavaBuild.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/processing/mode/java/JavaBuild.java b/app/src/processing/mode/java/JavaBuild.java index e6db686ba..1f7462ba5 100644 --- a/app/src/processing/mode/java/JavaBuild.java +++ b/app/src/processing/mode/java/JavaBuild.java @@ -531,6 +531,8 @@ public class JavaBuild { if (pkg.startsWith("processing.data.")) return true; if (pkg.startsWith("processing.event.")) return true; if (pkg.startsWith("processing.opengl.")) return true; + +// if (pkg.startsWith("com.jogamp.")) return true; // // ignore core, data, and opengl packages // String[] coreImports = preprocessor.getCoreImports(); From bc4d9b605ce5ab384329c651db3e1e9df212b05b Mon Sep 17 00:00:00 2001 From: codeanticode Date: Sun, 30 Mar 2014 16:02:34 -0400 Subject: [PATCH 4/9] disable experimental depth sorting code for raw triangles, fix #2404 --- core/src/processing/opengl/PGraphicsOpenGL.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index 53d22b6e0..799f1ca40 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -2610,14 +2610,15 @@ public class PGraphicsOpenGL extends PGraphics { raw.noStroke(); raw.beginShape(TRIANGLES); - sortTriangles(); + + //sortTriangles(); float[] vertices = tessGeo.polyVertices; int[] color = tessGeo.polyColors; float[] uv = tessGeo.polyTexCoords; - //short[] indices = tessGeo.polyIndices; // unused [fry] - + short[] indices = tessGeo.polyIndices; // unused [fry] +/* sortTriangles(); for (int i = 0; i < sortedTriangleCount; i++) { Triangle tri = sortedPolyTriangles[i]; @@ -2697,9 +2698,9 @@ public class PGraphicsOpenGL extends PGraphics { } } +*/ -/* for (int i = 0; i < texCache.size; i++) { PImage textureImage = texCache.getTextureImage(i); @@ -2791,7 +2792,7 @@ public class PGraphicsOpenGL extends PGraphics { } } } -*/ + raw.endShape(); } From 3acd891ef1587b570df0827c551d76175013dae9 Mon Sep 17 00:00:00 2001 From: codeanticode Date: Sun, 30 Mar 2014 21:20:17 -0400 Subject: [PATCH 5/9] fix #2363 --- core/src/processing/opengl/PJOGL.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/processing/opengl/PJOGL.java b/core/src/processing/opengl/PJOGL.java index 0bff30395..7b890f474 100644 --- a/core/src/processing/opengl/PJOGL.java +++ b/core/src/processing/opengl/PJOGL.java @@ -369,6 +369,7 @@ public class PJOGL extends PGL { canvasAWT = null; } + pg.parent.defaultSize = false; registerListeners(); fboLayerCreated = false; @@ -384,6 +385,7 @@ public class PJOGL extends PGL { fboLayerCreated = false; fboLayerInUse = false; firstFrame = true; + pg.parent.defaultSize = false; } From 8a203e93f9c0e440c894f5d2fb05112003b6d9db Mon Sep 17 00:00:00 2001 From: codeanticode Date: Mon, 31 Mar 2014 09:40:53 -0400 Subject: [PATCH 6/9] renamed buffer uniform to ppixels, fix #2325 --- core/src/processing/opengl/PShader.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/processing/opengl/PShader.java b/core/src/processing/opengl/PShader.java index 97dbbc891..0f2c92490 100644 --- a/core/src/processing/opengl/PShader.java +++ b/core/src/processing/opengl/PShader.java @@ -116,7 +116,7 @@ public class PShader implements PConstants { protected int transformMatLoc; protected int modelviewMatLoc; protected int projectionMatLoc; - protected int bufferLoc; + protected int ppixelsLoc; protected int bufferUnit; protected int viewportLoc; @@ -1158,7 +1158,7 @@ public class PShader implements PConstants { projectionMatLoc = getUniformLoc("projectionMatrix"); viewportLoc = getUniformLoc("viewport"); - bufferLoc = getUniformLoc("buffer"); + ppixelsLoc = getUniformLoc("ppixels"); normalMatLoc = getUniformLoc("normalMatrix"); @@ -1209,9 +1209,9 @@ public class PShader implements PConstants { setUniformValue(viewportLoc, x, y, w, h); } - if (-1 < bufferLoc) { + if (-1 < ppixelsLoc) { bufferUnit = getLastTexUnit() + 1; - setUniformValue(bufferLoc, bufferUnit); + setUniformValue(ppixelsLoc, bufferUnit); pgl.activeTexture(PGL.TEXTURE0 + bufferUnit); currentPG.bindFrontTexture(); } else { @@ -1304,7 +1304,7 @@ public class PShader implements PConstants { if (-1 < texCoordLoc) pgl.disableVertexAttribArray(texCoordLoc); if (-1 < normalLoc) pgl.disableVertexAttribArray(normalLoc); - if (-1 < bufferLoc) { + if (-1 < ppixelsLoc) { pgl.requestFBOLayer(); pgl.activeTexture(PGL.TEXTURE0 + bufferUnit); currentPG.unbindFrontTexture(); From ef4a5089bffbdd20691a281ec2fc1bf41ce446ec Mon Sep 17 00:00:00 2001 From: codeanticode Date: Mon, 31 Mar 2014 09:41:05 -0400 Subject: [PATCH 7/9] updated conway example --- .../examples/Topics/Shaders/Conway/Conway.pde | 4 ++-- .../Topics/Shaders/Conway/data/conway.glsl | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/java/examples/Topics/Shaders/Conway/Conway.pde b/java/examples/Topics/Shaders/Conway/Conway.pde index 472b6c758..529f821b0 100644 --- a/java/examples/Topics/Shaders/Conway/Conway.pde +++ b/java/examples/Topics/Shaders/Conway/Conway.pde @@ -1,7 +1,7 @@ // GLSL version of Conway's game of life, ported from GLSL sandbox: // http://glsl.heroku.com/e#207.3 -// Exemplifies the use of the buffer uniform in the shader, that gives -// access to the previous frame. +// Exemplifies the use of the ppixels uniform in the shader, that gives +// access to the pixels of the previous frame. PShader conway; PGraphics pg; diff --git a/java/examples/Topics/Shaders/Conway/data/conway.glsl b/java/examples/Topics/Shaders/Conway/data/conway.glsl index dca8dfd7f..694491ef0 100644 --- a/java/examples/Topics/Shaders/Conway/data/conway.glsl +++ b/java/examples/Topics/Shaders/Conway/data/conway.glsl @@ -9,7 +9,7 @@ precision highp float; uniform float time; uniform vec2 mouse; uniform vec2 resolution; -uniform sampler2D buffer; +uniform sampler2D ppixels; vec4 live = vec4(0.5,1.0,0.7,1.); vec4 dead = vec4(0.,0.,0.,1.); @@ -28,15 +28,15 @@ void main( void ) { } } else { float sum = 0.; - sum += texture2D(buffer, position + pixel * vec2(-1., -1.)).g; - sum += texture2D(buffer, position + pixel * vec2(-1., 0.)).g; - sum += texture2D(buffer, position + pixel * vec2(-1., 1.)).g; - sum += texture2D(buffer, position + pixel * vec2(1., -1.)).g; - sum += texture2D(buffer, position + pixel * vec2(1., 0.)).g; - sum += texture2D(buffer, position + pixel * vec2(1., 1.)).g; - sum += texture2D(buffer, position + pixel * vec2(0., -1.)).g; - sum += texture2D(buffer, position + pixel * vec2(0., 1.)).g; - vec4 me = texture2D(buffer, position); + sum += texture2D(ppixels, position + pixel * vec2(-1., -1.)).g; + sum += texture2D(ppixels, position + pixel * vec2(-1., 0.)).g; + sum += texture2D(ppixels, position + pixel * vec2(-1., 1.)).g; + sum += texture2D(ppixels, position + pixel * vec2(1., -1.)).g; + sum += texture2D(ppixels, position + pixel * vec2(1., 0.)).g; + sum += texture2D(ppixels, position + pixel * vec2(1., 1.)).g; + sum += texture2D(ppixels, position + pixel * vec2(0., -1.)).g; + sum += texture2D(ppixels, position + pixel * vec2(0., 1.)).g; + vec4 me = texture2D(ppixels, position); if (me.g <= 0.1) { if ((sum >= 2.9) && (sum <= 3.1)) { From 04205c3deae3950a0ae28186dd9383d5b9f0c615 Mon Sep 17 00:00:00 2001 From: codeanticode Date: Mon, 31 Mar 2014 10:43:07 -0400 Subject: [PATCH 8/9] fixed DomeProjection example --- .../Topics/Shaders/DomeProjection/DomeProjection.pde | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/java/examples/Topics/Shaders/DomeProjection/DomeProjection.pde b/java/examples/Topics/Shaders/DomeProjection/DomeProjection.pde index 226f18275..2c39c08cc 100644 --- a/java/examples/Topics/Shaders/DomeProjection/DomeProjection.pde +++ b/java/examples/Topics/Shaders/DomeProjection/DomeProjection.pde @@ -21,7 +21,7 @@ IntBuffer envMapTextureID; int envMapSize = 1024; void setup() { - size(640, 640, P3D); + size(640, 640, P3D); initCubeMap(); } @@ -32,6 +32,7 @@ void draw() { void drawScene() { background(0); + stroke(255, 0, 0); strokeWeight(2); for (int i = -width; i < 2 * width; i += 50) { @@ -46,6 +47,6 @@ void drawScene() { translate(mouseX, mouseY, 200); rotateX(frameCount * 0.01); rotateY(frameCount * 0.01); - box(100); + box(100); } From e073d0c5838884be8f61125a5380c35aed14c710 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Mon, 31 Mar 2014 11:31:20 -0400 Subject: [PATCH 9/9] wrong 'this' being passed into method invocation --- core/src/processing/core/PApplet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index 90f78a4fd..b16bad1b1 100755 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -10299,7 +10299,7 @@ public class PApplet extends Applet //revalidate(); // let the layout manager do its work if (revalidateMethod != null) { try { - revalidateMethod.invoke(this); + revalidateMethod.invoke(PApplet.this); } catch (Exception ex) { ex.printStackTrace(); revalidateMethod = null;