diff --git a/README.md b/README.md
index bd2916ed0..7d85a9b1c 100644
--- a/README.md
+++ b/README.md
@@ -17,10 +17,15 @@ The [processing-web](https://github.com/processing/processing-web/) repository
contains reference, examples, and the site.
(Please use that link to file issues regarding the web site, the examples, or the reference.)
-Someday maybe I'll even take the time to update the build instructions, write code style guidelines,
-fix all these bugs, throw together hundreds of unit tests, and solve the Israeli-Palestinian conflict.
+The instructions for building the source [are here](https://github.com/processing/processing/wiki/Build-Instructions),
+although they [need an update](https://github.com/processing/processing/issues/1629).
-But in the meantime, I ask for your patience, participation, and patches.
+Someday we'll also write code style guidelines, fix all these bugs,
+throw together hundreds of unit tests, and solve the Israeli-Palestinian conflict.
+
+But in the meantime, I ask for your patience,
+[participation](https://github.com/processing/processing/wiki/Project-List),
+and [patches](https://github.com/processing/processing/pulls).
Ben Fry, 3 February 2013
-Last updated 11 February 2013
+Last updated 19 February 2013
diff --git a/android/core/src/processing/opengl/PointShaderFrag.glsl b/android/core/src/processing/opengl/ColorFrag.glsl
similarity index 100%
rename from android/core/src/processing/opengl/PointShaderFrag.glsl
rename to android/core/src/processing/opengl/ColorFrag.glsl
diff --git a/android/core/src/processing/opengl/PolyColorShaderVert.glsl b/android/core/src/processing/opengl/ColorVert.glsl
similarity index 100%
rename from android/core/src/processing/opengl/PolyColorShaderVert.glsl
rename to android/core/src/processing/opengl/ColorVert.glsl
diff --git a/android/core/src/processing/opengl/PolyLightShaderVert.glsl b/android/core/src/processing/opengl/LightVert.glsl
similarity index 100%
rename from android/core/src/processing/opengl/PolyLightShaderVert.glsl
rename to android/core/src/processing/opengl/LightVert.glsl
diff --git a/android/core/src/processing/opengl/LineShaderFrag.glsl b/android/core/src/processing/opengl/LineFrag.glsl
similarity index 100%
rename from android/core/src/processing/opengl/LineShaderFrag.glsl
rename to android/core/src/processing/opengl/LineFrag.glsl
diff --git a/android/core/src/processing/opengl/LineShaderVert.glsl b/android/core/src/processing/opengl/LineVert.glsl
similarity index 72%
rename from android/core/src/processing/opengl/LineShaderVert.glsl
rename to android/core/src/processing/opengl/LineVert.glsl
index b60633dae..6769dc8d8 100644
--- a/android/core/src/processing/opengl/LineShaderVert.glsl
+++ b/android/core/src/processing/opengl/LineVert.glsl
@@ -29,7 +29,7 @@ uniform vec3 scale;
attribute vec4 vertex;
attribute vec4 color;
-attribute vec4 endpoint;
+attribute vec4 direction;
varying vec4 vertColor;
@@ -45,42 +45,40 @@ vec4 windowToClipVector(vec2 window, vec4 viewport, float clip_w) {
}
void main() {
- vec4 pos_p = vertex;
- vec4 v_p = modelview * pos_p;
+ vec4 posp = modelview * vertex;
+
// Moving vertices slightly toward the camera
// to avoid depth-fighting with the fill triangles.
// Discussed here:
// http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=252848
- v_p.xyz = v_p.xyz * scale;
- vec4 clip_p = projection * v_p;
- float thickness = endpoint.w;
+ posp.xyz = posp.xyz * scale;
+ vec4 clipp = projection * posp;
+ float thickness = direction.w;
if (thickness != 0.0) {
- vec4 pos_q = vec4(endpoint.xyz, 1);
- vec4 v_q = modelview * pos_q;
- v_q.xyz = v_q.xyz * scale;
- vec4 clip_q = projection * v_q;
+ vec4 posq = posp + modelview * vec4(direction.xyz, 1);
+ posq.xyz = posq.xyz * scale;
+ vec4 clipq = projection * posq;
- vec3 window_p = clipToWindow(clip_p, viewport);
- vec3 window_q = clipToWindow(clip_q, viewport);
+ vec3 window_p = clipToWindow(clipp, viewport);
+ vec3 window_q = clipToWindow(clipq, viewport);
vec3 tangent = window_q - window_p;
vec2 perp = normalize(vec2(-tangent.y, tangent.x));
- vec2 window_offset = perp * thickness;
+ vec2 offset = perp * thickness;
if (0 < perspective) {
// Perspective correction (lines will look thiner as they move away
// from the view position).
- gl_Position.xy = clip_p.xy + window_offset.xy;
- gl_Position.zw = clip_p.zw;
+ gl_Position.xy = clipp.xy + offset.xy;
+ gl_Position.zw = clipp.zw;
} else {
// No perspective correction.
- float clip_p_w = clip_p.w;
- vec4 offset_p = windowToClipVector(window_offset, viewport, clip_p_w);
- gl_Position = clip_p + offset_p;
+ vec4 offsetp = windowToClipVector(offset, viewport, clipp.w);
+ gl_Position = clipp + offsetp;
}
} else {
- gl_Position = clip_p;
+ gl_Position = clipp;
}
vertColor = color;
diff --git a/android/core/src/processing/opengl/MaskShaderFrag.glsl b/android/core/src/processing/opengl/MaskFrag.glsl
similarity index 100%
rename from android/core/src/processing/opengl/MaskShaderFrag.glsl
rename to android/core/src/processing/opengl/MaskFrag.glsl
diff --git a/android/core/src/processing/opengl/PGraphicsOpenGL.java b/android/core/src/processing/opengl/PGraphicsOpenGL.java
index ac821fa81..8f3007cfd 100644
--- a/android/core/src/processing/opengl/PGraphicsOpenGL.java
+++ b/android/core/src/processing/opengl/PGraphicsOpenGL.java
@@ -209,42 +209,42 @@ public class PGraphicsOpenGL extends PGraphics {
// Shaders
- static protected URL defPolyColorShaderVertURL =
- PGraphicsOpenGL.class.getResource("PolyColorShaderVert.glsl");
- static protected URL defPolyTexShaderVertURL =
- PGraphicsOpenGL.class.getResource("PolyTexShaderVert.glsl");
- static protected URL defPolyLightShaderVertURL =
- PGraphicsOpenGL.class.getResource("PolyLightShaderVert.glsl");
- static protected URL defPolyTexlightShaderVertURL =
- PGraphicsOpenGL.class.getResource("PolyTexlightShaderVert.glsl");
- static protected URL defPolyNoTexShaderFragURL =
- PGraphicsOpenGL.class.getResource("PolyNoTexShaderFrag.glsl");
- static protected URL defPolyTexShaderFragURL =
- PGraphicsOpenGL.class.getResource("PolyTexShaderFrag.glsl");
+ static protected URL defColorShaderVertURL =
+ PGraphicsOpenGL.class.getResource("ColorVert.glsl");
+ static protected URL defTextureShaderVertURL =
+ PGraphicsOpenGL.class.getResource("TextureVert.glsl");
+ static protected URL defLightShaderVertURL =
+ PGraphicsOpenGL.class.getResource("LightVert.glsl");
+ static protected URL defTexlightShaderVertURL =
+ PGraphicsOpenGL.class.getResource("TexlightVert.glsl");
+ static protected URL defColorShaderFragURL =
+ PGraphicsOpenGL.class.getResource("ColorFrag.glsl");
+ static protected URL defTextureShaderFragURL =
+ PGraphicsOpenGL.class.getResource("TextureFrag.glsl");
static protected URL defLineShaderVertURL =
- PGraphicsOpenGL.class.getResource("LineShaderVert.glsl");
+ PGraphicsOpenGL.class.getResource("LineVert.glsl");
static protected URL defLineShaderFragURL =
- PGraphicsOpenGL.class.getResource("LineShaderFrag.glsl");
+ PGraphicsOpenGL.class.getResource("LineFrag.glsl");
static protected URL defPointShaderVertURL =
- PGraphicsOpenGL.class.getResource("PointShaderVert.glsl");
+ PGraphicsOpenGL.class.getResource("PointVert.glsl");
static protected URL defPointShaderFragURL =
- PGraphicsOpenGL.class.getResource("PointShaderFrag.glsl");
+ PGraphicsOpenGL.class.getResource("PointFrag.glsl");
- static protected PolyColorShader defPolyColorShader;
- static protected PolyTexShader defPolyTexShader;
- static protected PolyLightShader defPolyLightShader;
- static protected PolyTexlightShader defPolyTexlightShader;
+ static protected ColorShader defColorShader;
+ static protected TexureShader defTextureShader;
+ static protected LightShader defLightShader;
+ static protected TexlightShader defTexlightShader;
static protected LineShader defLineShader;
static protected PointShader defPointShader;
static protected URL maskShaderFragURL =
- PGraphicsOpenGL.class.getResource("MaskShaderFrag.glsl");
- static protected PolyTexShader maskShader;
+ PGraphicsOpenGL.class.getResource("MaskFrag.glsl");
+ static protected TexureShader maskShader;
- protected PolyColorShader polyColorShader;
- protected PolyTexShader polyTexShader;
- protected PolyLightShader polyLightShader;
- protected PolyTexlightShader polyTexlightShader;
+ protected ColorShader colorShader;
+ protected TexureShader textureShader;
+ protected LightShader lightShader;
+ protected TexlightShader texlightShader;
protected LineShader lineShader;
protected PointShader pointShader;
@@ -1397,10 +1397,10 @@ public class PGraphicsOpenGL extends PGraphics {
pgl.bufferData(PGL.ARRAY_BUFFER, sizei,
tessGeo.lineColorsBuffer, PGL.STATIC_DRAW);
- tessGeo.updateLineAttribsBuffer();
+ tessGeo.updateLineDirectionsBuffer();
pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineAttrib);
pgl.bufferData(PGL.ARRAY_BUFFER, 4 * sizef,
- tessGeo.lineAttribsBuffer, PGL.STATIC_DRAW);
+ tessGeo.lineDirectionsBuffer, PGL.STATIC_DRAW);
tessGeo.updateLineIndicesBuffer();
pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glLineIndex);
@@ -1490,10 +1490,10 @@ public class PGraphicsOpenGL extends PGraphics {
pgl.bufferData(PGL.ARRAY_BUFFER, sizei,
tessGeo.pointColorsBuffer, PGL.STATIC_DRAW);
- tessGeo.updatePointAttribsBuffer();
+ tessGeo.updatePointOffsetsBuffer();
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointAttrib);
pgl.bufferData(PGL.ARRAY_BUFFER, 2 * sizef,
- tessGeo.pointAttribsBuffer, PGL.STATIC_DRAW);
+ tessGeo.pointOffsetsBuffer, PGL.STATIC_DRAW);
tessGeo.updatePointIndicesBuffer();
pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glPointIndex);
@@ -2511,7 +2511,7 @@ public class PGraphicsOpenGL extends PGraphics {
float[] vertices = tessGeo.lineVertices;
int[] color = tessGeo.lineColors;
- float[] attribs = tessGeo.lineAttribs;
+ float[] attribs = tessGeo.lineDirections;
short[] indices = tessGeo.lineIndices;
IndexCache cache = tessGeo.lineIndexCache;
@@ -2614,7 +2614,7 @@ public class PGraphicsOpenGL extends PGraphics {
float[] vertices = tessGeo.pointVertices;
int[] color = tessGeo.pointColors;
- float[] attribs = tessGeo.pointAttribs;
+ float[] attribs = tessGeo.pointOffsets;
short[] indices = tessGeo.pointIndices;
IndexCache cache = tessGeo.pointIndexCache;
@@ -5321,7 +5321,7 @@ public class PGraphicsOpenGL extends PGraphics {
}
if (maskShader == null) {
- maskShader = new PolyTexShader(parent, defPolyTexShaderVertURL,
+ maskShader = new TexureShader(parent, defTextureShaderVertURL,
maskShaderFragURL);
}
maskShader.set("mask", alpha);
@@ -5363,7 +5363,7 @@ public class PGraphicsOpenGL extends PGraphics {
@Override
public void filter(PShader shader) {
- if (!(shader instanceof PolyTexShader)) {
+ if (!(shader instanceof TexureShader)) {
PGraphics.showWarning(INVALID_FILTER_SHADER_ERROR);
return;
}
@@ -5399,8 +5399,8 @@ public class PGraphicsOpenGL extends PGraphics {
stroke = false;
// int prevBlendMode = blendMode;
// blendMode(REPLACE);
- PolyTexShader prevTexShader = polyTexShader;
- polyTexShader = (PolyTexShader) shader;
+ TexureShader prevTexShader = textureShader;
+ textureShader = (TexureShader) shader;
beginShape(QUADS);
texture(filterImage);
vertex(0, 0, 0, 0);
@@ -5410,7 +5410,7 @@ public class PGraphicsOpenGL extends PGraphics {
endShape();
end2D();
- polyTexShader = prevTexShader;
+ textureShader = prevTexShader;
// Restoring previous configuration.
stroke = prevStroke;
@@ -6141,17 +6141,17 @@ public class PGraphicsOpenGL extends PGraphics {
shader = new LineShader(parent);
shader.setVertexShader(defLineShaderVertURL);
} else if (shaderType == PShader.TEXLIGHT) {
- shader = new PolyTexlightShader(parent);
- shader.setVertexShader(defPolyTexlightShaderVertURL);
+ shader = new TexlightShader(parent);
+ shader.setVertexShader(defTexlightShaderVertURL);
} else if (shaderType == PShader.LIGHT) {
- shader = new PolyLightShader(parent);
- shader.setVertexShader(defPolyLightShaderVertURL);
+ shader = new LightShader(parent);
+ shader.setVertexShader(defLightShaderVertURL);
} else if (shaderType == PShader.TEXTURE) {
- shader = new PolyTexShader(parent);
- shader.setVertexShader(defPolyTexShaderVertURL);
+ shader = new TexureShader(parent);
+ shader.setVertexShader(defTextureShaderVertURL);
} else if (shaderType == PShader.COLOR) {
- shader = new PolyColorShader(parent);
- shader.setVertexShader(defPolyColorShaderVertURL);
+ shader = new ColorShader(parent);
+ shader.setVertexShader(defColorShaderVertURL);
}
shader.setFragmentShader(fragFilename);
return shader;
@@ -6178,17 +6178,17 @@ public class PGraphicsOpenGL extends PGraphics {
shader = new LineShader(parent);
shader.setFragmentShader(defLineShaderFragURL);
} else if (shaderType == PShader.TEXLIGHT) {
- shader = new PolyTexlightShader(parent);
- shader.setFragmentShader(defPolyTexShaderFragURL);
+ shader = new TexlightShader(parent);
+ shader.setFragmentShader(defTextureShaderFragURL);
} else if (shaderType == PShader.LIGHT) {
- shader = new PolyLightShader(parent);
- shader.setFragmentShader(defPolyNoTexShaderFragURL);
+ shader = new LightShader(parent);
+ shader.setFragmentShader(defColorShaderFragURL);
} else if (shaderType == PShader.TEXTURE) {
- shader = new PolyTexShader(parent);
- shader.setFragmentShader(defPolyTexShaderFragURL);
+ shader = new TexureShader(parent);
+ shader.setFragmentShader(defTextureShaderFragURL);
} else if (shaderType == PShader.COLOR) {
- shader = new PolyColorShader(parent);
- shader.setFragmentShader(defPolyNoTexShaderFragURL);
+ shader = new ColorShader(parent);
+ shader.setFragmentShader(defColorShaderFragURL);
}
if (shader != null) {
shader.setVertexShader(vertFilename);
@@ -6199,13 +6199,13 @@ public class PGraphicsOpenGL extends PGraphics {
} else if (shaderType == PShader.LINE) {
shader = new LineShader(parent, vertFilename, fragFilename);
} else if (shaderType == PShader.TEXLIGHT) {
- shader = new PolyTexlightShader(parent, vertFilename, fragFilename);
+ shader = new TexlightShader(parent, vertFilename, fragFilename);
} else if (shaderType == PShader.LIGHT) {
- shader = new PolyLightShader(parent, vertFilename, fragFilename);
+ shader = new LightShader(parent, vertFilename, fragFilename);
} else if (shaderType == PShader.TEXTURE) {
- shader = new PolyTexShader(parent, vertFilename, fragFilename);
+ shader = new TexureShader(parent, vertFilename, fragFilename);
} else if (shaderType == PShader.COLOR) {
- shader = new PolyColorShader(parent, vertFilename, fragFilename);
+ shader = new ColorShader(parent, vertFilename, fragFilename);
}
}
return shader;
@@ -6223,14 +6223,14 @@ public class PGraphicsOpenGL extends PGraphics {
flush(); // Flushing geometry drawn with a different shader.
if (kind == TRIANGLES || kind == QUADS || kind == POLYGON) {
- if (shader instanceof PolyTexShader) {
- polyTexShader = (PolyTexShader) shader;
- } else if (shader instanceof PolyColorShader) {
- polyColorShader = (PolyColorShader) shader;
- } else if (shader instanceof PolyTexlightShader) {
- polyTexlightShader = (PolyTexlightShader) shader;
- } else if (shader instanceof PolyLightShader) {
- polyLightShader = (PolyLightShader) shader;
+ if (shader instanceof TexureShader) {
+ textureShader = (TexureShader) shader;
+ } else if (shader instanceof ColorShader) {
+ colorShader = (ColorShader) shader;
+ } else if (shader instanceof TexlightShader) {
+ texlightShader = (TexlightShader) shader;
+ } else if (shader instanceof LightShader) {
+ lightShader = (LightShader) shader;
} else {
PGraphics.showWarning(WRONG_SHADER_TYPE_ERROR);
}
@@ -6263,10 +6263,10 @@ public class PGraphicsOpenGL extends PGraphics {
flush(); // Flushing geometry drawn with a different shader.
if (kind == TRIANGLES || kind == QUADS || kind == POLYGON) {
- polyTexShader = null;
- polyColorShader = null;
- polyTexlightShader = null;
- polyLightShader = null;
+ textureShader = null;
+ colorShader = null;
+ texlightShader = null;
+ lightShader = null;
} else if (kind == LINES) {
lineShader = null;
} else if (kind == POINTS) {
@@ -6308,10 +6308,10 @@ public class PGraphicsOpenGL extends PGraphics {
// The default shaders contains references to the PGraphics object that
// creates them, so when restarting the renderer, those references should
// dissapear.
- defPolyColorShader = null;
- defPolyTexShader = null;
- defPolyLightShader = null;
- defPolyTexlightShader = null;
+ defColorShader = null;
+ defTextureShader = null;
+ defLightShader = null;
+ defTexlightShader = null;
defLineShader = null;
defPointShader = null;
maskShader = null;
@@ -6322,54 +6322,54 @@ public class PGraphicsOpenGL extends PGraphics {
BaseShader shader;
if (lit) {
if (tex) {
- if (polyTexlightShader == null) {
- if (defPolyTexlightShader == null) {
- defPolyTexlightShader = new PolyTexlightShader(parent,
- defPolyTexlightShaderVertURL,
- defPolyTexShaderFragURL);
+ if (texlightShader == null) {
+ if (defTexlightShader == null) {
+ defTexlightShader = new TexlightShader(parent,
+ defTexlightShaderVertURL,
+ defTextureShaderFragURL);
}
- shader = defPolyTexlightShader;
+ shader = defTexlightShader;
texlightShaderCheck();
} else {
- shader = polyTexlightShader;
+ shader = texlightShader;
}
} else {
- if (polyLightShader == null) {
- if (defPolyLightShader == null) {
- defPolyLightShader = new PolyLightShader(parent,
- defPolyLightShaderVertURL,
- defPolyNoTexShaderFragURL);
+ if (lightShader == null) {
+ if (defLightShader == null) {
+ defLightShader = new LightShader(parent,
+ defLightShaderVertURL,
+ defColorShaderFragURL);
}
- shader = defPolyLightShader;
+ shader = defLightShader;
lightShaderCheck();
} else {
- shader = polyLightShader;
+ shader = lightShader;
}
}
} else {
if (tex) {
- if (polyTexShader == null) {
- if (defPolyTexShader == null) {
- defPolyTexShader = new PolyTexShader(parent,
- defPolyTexShaderVertURL,
- defPolyTexShaderFragURL);
+ if (textureShader == null) {
+ if (defTextureShader == null) {
+ defTextureShader = new TexureShader(parent,
+ defTextureShaderVertURL,
+ defTextureShaderFragURL);
}
- shader = defPolyTexShader;
- texShaderCheck();
+ shader = defTextureShader;
+ textureShaderCheck();
} else {
- shader = polyTexShader;
+ shader = textureShader;
}
} else {
- if (polyColorShader == null) {
- if (defPolyColorShader == null) {
- defPolyColorShader = new PolyColorShader(parent,
- defPolyColorShaderVertURL,
- defPolyNoTexShaderFragURL);
+ if (colorShader == null) {
+ if (defColorShader == null) {
+ defColorShader = new ColorShader(parent,
+ defColorShaderVertURL,
+ defColorShaderFragURL);
}
- shader = defPolyColorShader;
+ shader = defColorShader;
colorShaderCheck();
} else {
- shader = polyColorShader;
+ shader = colorShader;
}
}
}
@@ -6382,9 +6382,9 @@ public class PGraphicsOpenGL extends PGraphics {
protected void texlightShaderCheck() {
if (shaderWarningsEnabled &&
- (polyLightShader != null ||
- polyTexShader != null ||
- polyColorShader != null)) {
+ (lightShader != null ||
+ textureShader != null ||
+ colorShader != null)) {
PGraphics.showWarning(NO_TEXLIGHT_SHADER_ERROR);
}
}
@@ -6392,19 +6392,19 @@ public class PGraphicsOpenGL extends PGraphics {
protected void lightShaderCheck() {
if (shaderWarningsEnabled &&
- (polyTexlightShader != null ||
- polyTexShader != null ||
- polyColorShader != null)) {
+ (texlightShader != null ||
+ textureShader != null ||
+ colorShader != null)) {
PGraphics.showWarning(NO_LIGHT_SHADER_ERROR);
}
}
- protected void texShaderCheck() {
+ protected void textureShaderCheck() {
if (shaderWarningsEnabled &&
- (polyTexlightShader != null ||
- polyLightShader != null ||
- polyColorShader != null)) {
+ (texlightShader != null ||
+ lightShader != null ||
+ colorShader != null)) {
PGraphics.showWarning(NO_TEXTURE_SHADER_ERROR);
}
}
@@ -6412,9 +6412,9 @@ public class PGraphicsOpenGL extends PGraphics {
protected void colorShaderCheck() {
if (shaderWarningsEnabled &&
- (polyTexlightShader != null ||
- polyLightShader != null ||
- polyTexShader != null)) {
+ (texlightShader != null ||
+ lightShader != null ||
+ textureShader != null)) {
PGraphics.showWarning(NO_COLOR_SHADER_ERROR);
}
}
@@ -6549,20 +6549,20 @@ public class PGraphicsOpenGL extends PGraphics {
}
- protected class PolyColorShader extends BaseShader {
+ protected class ColorShader extends BaseShader {
protected int vertexLoc;
protected int colorLoc;
- public PolyColorShader(PApplet parent) {
+ public ColorShader(PApplet parent) {
super(parent);
}
- public PolyColorShader(PApplet parent, String vertFilename,
+ public ColorShader(PApplet parent, String vertFilename,
String fragFilename) {
super(parent, vertFilename, fragFilename);
}
- public PolyColorShader(PApplet parent, URL vertURL, URL fragURL) {
+ public ColorShader(PApplet parent, URL vertURL, URL fragURL) {
super(parent, vertURL, fragURL);
}
@@ -6599,7 +6599,7 @@ public class PGraphicsOpenGL extends PGraphics {
}
if (-1 < vertexLoc) pgl.enableVertexAttribArray(vertexLoc);
- if (-1 < colorLoc) pgl.enableVertexAttribArray(colorLoc);
+ if (-1 < colorLoc) pgl.enableVertexAttribArray(colorLoc);
setCommonUniforms();
}
@@ -6607,14 +6607,14 @@ public class PGraphicsOpenGL extends PGraphics {
@Override
public void unbind() {
if (-1 < vertexLoc) pgl.disableVertexAttribArray(vertexLoc);
- if (-1 < colorLoc) pgl.disableVertexAttribArray(colorLoc);
+ if (-1 < colorLoc) pgl.disableVertexAttribArray(colorLoc);
super.unbind();
}
}
- protected class PolyLightShader extends BaseShader {
+ protected class LightShader extends BaseShader {
protected int normalMatrixLoc;
protected int lightCountLoc;
@@ -6635,16 +6635,16 @@ public class PGraphicsOpenGL extends PGraphics {
protected int emissiveLoc;
protected int shininessLoc;
- public PolyLightShader(PApplet parent) {
+ public LightShader(PApplet parent) {
super(parent);
}
- public PolyLightShader(PApplet parent, String vertFilename,
+ public LightShader(PApplet parent, String vertFilename,
String fragFilename) {
super(parent, vertFilename, fragFilename);
}
- public PolyLightShader(PApplet parent, URL vertURL, URL fragURL) {
+ public LightShader(PApplet parent, URL vertURL, URL fragURL) {
super(parent, vertURL, fragURL);
}
@@ -6728,13 +6728,13 @@ public class PGraphicsOpenGL extends PGraphics {
}
if (-1 < vertexLoc) pgl.enableVertexAttribArray(vertexLoc);
- if (-1 < colorLoc) pgl.enableVertexAttribArray(colorLoc);
+ if (-1 < colorLoc) pgl.enableVertexAttribArray(colorLoc);
if (-1 < normalLoc) pgl.enableVertexAttribArray(normalLoc);
- if (-1 < ambientLoc) pgl.enableVertexAttribArray(ambientLoc);
+ if (-1 < ambientLoc) pgl.enableVertexAttribArray(ambientLoc);
if (-1 < specularLoc) pgl.enableVertexAttribArray(specularLoc);
if (-1 < emissiveLoc) pgl.enableVertexAttribArray(emissiveLoc);
- if (-1 < shininessLoc) pgl.enableVertexAttribArray(shininessLoc);
+ if (-1 < shininessLoc) pgl.enableVertexAttribArray(shininessLoc);
if (-1 < normalMatrixLoc) {
pgCurrent.updateGLNormal();
@@ -6748,10 +6748,9 @@ public class PGraphicsOpenGL extends PGraphics {
setUniformVector(lightAmbientLoc, pgCurrent.lightAmbient, 3, count);
setUniformVector(lightDiffuseLoc, pgCurrent.lightDiffuse, 3, count);
setUniformVector(lightSpecularLoc, pgCurrent.lightSpecular, 3, count);
- setUniformVector(lightFalloffLoc,
- pgCurrent.lightFalloffCoefficients, 3, count);
- setUniformVector(lightSpotLoc,
- pgCurrent.lightSpotParameters, 2, count);
+ setUniformVector(lightFalloffLoc, pgCurrent.lightFalloffCoefficients,
+ 3, count);
+ setUniformVector(lightSpotLoc, pgCurrent.lightSpotParameters, 2, count);
setCommonUniforms();
}
@@ -6759,10 +6758,10 @@ public class PGraphicsOpenGL extends PGraphics {
@Override
public void unbind() {
if (-1 < vertexLoc) pgl.disableVertexAttribArray(vertexLoc);
- if (-1 < colorLoc) pgl.disableVertexAttribArray(colorLoc);
+ if (-1 < colorLoc) pgl.disableVertexAttribArray(colorLoc);
if (-1 < normalLoc) pgl.disableVertexAttribArray(normalLoc);
- if (-1 < ambientLoc) pgl.disableVertexAttribArray(ambientLoc);
+ if (-1 < ambientLoc) pgl.disableVertexAttribArray(ambientLoc);
if (-1 < specularLoc) pgl.disableVertexAttribArray(specularLoc);
if (-1 < emissiveLoc) pgl.disableVertexAttribArray(emissiveLoc);
if (-1 < shininessLoc) pgl.disableVertexAttribArray(shininessLoc);
@@ -6772,7 +6771,7 @@ public class PGraphicsOpenGL extends PGraphics {
}
- protected class PolyTexShader extends PolyColorShader {
+ protected class TexureShader extends ColorShader {
protected int texCoordLoc;
protected int textureLoc;
@@ -6781,16 +6780,16 @@ public class PGraphicsOpenGL extends PGraphics {
protected float[] tcmat;
- public PolyTexShader(PApplet parent) {
+ public TexureShader(PApplet parent) {
super(parent);
}
- public PolyTexShader(PApplet parent, String vertFilename,
+ public TexureShader(PApplet parent, String vertFilename,
String fragFilename) {
super(parent, vertFilename, fragFilename);
}
- public PolyTexShader(PApplet parent, URL vertURL, URL fragURL) {
+ public TexureShader(PApplet parent, URL vertURL, URL fragURL) {
super(parent, vertURL, fragURL);
}
@@ -6872,7 +6871,7 @@ public class PGraphicsOpenGL extends PGraphics {
}
- protected class PolyTexlightShader extends PolyLightShader {
+ protected class TexlightShader extends LightShader {
protected int texCoordLoc;
protected int textureLoc;
@@ -6881,16 +6880,16 @@ public class PGraphicsOpenGL extends PGraphics {
protected float[] tcmat;
- public PolyTexlightShader(PApplet parent) {
+ public TexlightShader(PApplet parent) {
super(parent);
}
- public PolyTexlightShader(PApplet parent, String vertFilename,
+ public TexlightShader(PApplet parent, String vertFilename,
String fragFilename) {
super(parent, vertFilename, fragFilename);
}
- public PolyTexlightShader(PApplet parent, URL vertURL, URL fragURL) {
+ public TexlightShader(PApplet parent, URL vertURL, URL fragURL) {
super(parent, vertURL, fragURL);
}
@@ -6978,7 +6977,7 @@ public class PGraphicsOpenGL extends PGraphics {
protected int vertexLoc;
protected int colorLoc;
- protected int endpointLoc;
+ protected int directionLoc;
public LineShader(PApplet parent) {
super(parent);
@@ -6997,7 +6996,7 @@ public class PGraphicsOpenGL extends PGraphics {
public void loadAttributes() {
vertexLoc = getAttributeLoc("vertex");
colorLoc = getAttributeLoc("color");
- endpointLoc = getAttributeLoc("endpoint");
+ directionLoc = getAttributeLoc("direction");
}
@Override
@@ -7023,7 +7022,7 @@ public class PGraphicsOpenGL extends PGraphics {
public void setLineAttribute(int vboId, int size, int type,
int stride, int offset) {
- setAttributeVBO(endpointLoc, vboId, size, type, false, stride, offset);
+ setAttributeVBO(directionLoc, vboId, size, type, false, stride, offset);
}
@Override
@@ -7036,8 +7035,8 @@ public class PGraphicsOpenGL extends PGraphics {
}
if (-1 < vertexLoc) pgl.enableVertexAttribArray(vertexLoc);
- if (-1 < colorLoc) pgl.enableVertexAttribArray(colorLoc);
- if (-1 < endpointLoc) pgl.enableVertexAttribArray(endpointLoc);
+ if (-1 < colorLoc) pgl.enableVertexAttribArray(colorLoc);
+ if (-1 < directionLoc) pgl.enableVertexAttribArray(directionLoc);
if (pgCurrent.getHint(ENABLE_STROKE_PERSPECTIVE) &&
pgCurrent.nonOrthoProjection()) {
@@ -7062,8 +7061,8 @@ public class PGraphicsOpenGL extends PGraphics {
@Override
public void unbind() {
if (-1 < vertexLoc) pgl.disableVertexAttribArray(vertexLoc);
- if (-1 < colorLoc) pgl.disableVertexAttribArray(colorLoc);
- if (-1 < endpointLoc) pgl.disableVertexAttribArray(endpointLoc);
+ if (-1 < colorLoc) pgl.disableVertexAttribArray(colorLoc);
+ if (-1 < directionLoc) pgl.disableVertexAttribArray(directionLoc);
super.unbind();
}
@@ -7131,8 +7130,8 @@ public class PGraphicsOpenGL extends PGraphics {
}
if (-1 < vertexLoc) pgl.enableVertexAttribArray(vertexLoc);
- if (-1 < colorLoc) pgl.enableVertexAttribArray(colorLoc);
- if (-1 < offsetLoc) pgl.enableVertexAttribArray(offsetLoc);
+ if (-1 < colorLoc) pgl.enableVertexAttribArray(colorLoc);
+ if (-1 < offsetLoc) pgl.enableVertexAttribArray(offsetLoc);
if (pgCurrent.getHint(ENABLE_STROKE_PERSPECTIVE) &&
pgCurrent.nonOrthoProjection()) {
@@ -7147,8 +7146,8 @@ public class PGraphicsOpenGL extends PGraphics {
@Override
public void unbind() {
if (-1 < vertexLoc) pgl.disableVertexAttribArray(vertexLoc);
- if (-1 < colorLoc) pgl.disableVertexAttribArray(colorLoc);
- if (-1 < offsetLoc) pgl.disableVertexAttribArray(offsetLoc);
+ if (-1 < colorLoc) pgl.disableVertexAttribArray(colorLoc);
+ if (-1 < offsetLoc) pgl.disableVertexAttribArray(offsetLoc);
super.unbind();
}
@@ -8894,7 +8893,7 @@ public class PGraphicsOpenGL extends PGraphics {
int lastLineVertex;
FloatBuffer lineVerticesBuffer;
IntBuffer lineColorsBuffer;
- FloatBuffer lineAttribsBuffer;
+ FloatBuffer lineDirectionsBuffer;
int lineIndexCount;
int firstLineIndex;
@@ -8908,7 +8907,7 @@ public class PGraphicsOpenGL extends PGraphics {
int lastPointVertex;
FloatBuffer pointVerticesBuffer;
IntBuffer pointColorsBuffer;
- FloatBuffer pointAttribsBuffer;
+ FloatBuffer pointOffsetsBuffer;
int pointIndexCount;
int firstPointIndex;
@@ -8928,11 +8927,11 @@ public class PGraphicsOpenGL extends PGraphics {
short[] polyIndices;
float[] lineVertices;
int[] lineColors;
- float[] lineAttribs;
+ float[] lineDirections;
short[] lineIndices;
float[] pointVertices;
int[] pointColors;
- float[] pointAttribs;
+ float[] pointOffsets;
short[] pointIndices;
TessGeometry(int mode) {
@@ -8957,12 +8956,12 @@ public class PGraphicsOpenGL extends PGraphics {
lineVertices = new float[4 * PGL.DEFAULT_TESS_VERTICES];
lineColors = new int[PGL.DEFAULT_TESS_VERTICES];
- lineAttribs = new float[4 * PGL.DEFAULT_TESS_VERTICES];
+ lineDirections = new float[4 * PGL.DEFAULT_TESS_VERTICES];
lineIndices = new short[PGL.DEFAULT_TESS_VERTICES];
pointVertices = new float[4 * PGL.DEFAULT_TESS_VERTICES];
pointColors = new int[PGL.DEFAULT_TESS_VERTICES];
- pointAttribs = new float[2 * PGL.DEFAULT_TESS_VERTICES];
+ pointOffsets = new float[2 * PGL.DEFAULT_TESS_VERTICES];
pointIndices = new short[PGL.DEFAULT_TESS_VERTICES];
polyVerticesBuffer = PGL.allocateFloatBuffer(polyVertices);
@@ -8977,12 +8976,12 @@ public class PGraphicsOpenGL extends PGraphics {
lineVerticesBuffer = PGL.allocateFloatBuffer(lineVertices);
lineColorsBuffer = PGL.allocateIntBuffer(lineColors);
- lineAttribsBuffer = PGL.allocateFloatBuffer(lineAttribs);
+ lineDirectionsBuffer = PGL.allocateFloatBuffer(lineDirections);
lineIndicesBuffer = PGL.allocateShortBuffer(lineIndices);
pointVerticesBuffer = PGL.allocateFloatBuffer(pointVertices);
pointColorsBuffer = PGL.allocateIntBuffer(pointColors);
- pointAttribsBuffer = PGL.allocateFloatBuffer(pointAttribs);
+ pointOffsetsBuffer = PGL.allocateFloatBuffer(pointOffsets);
pointIndicesBuffer = PGL.allocateShortBuffer(pointIndices);
clear();
@@ -9075,7 +9074,7 @@ public class PGraphicsOpenGL extends PGraphics {
expandLineVertices(newSize);
expandLineColors(newSize);
- expandLineAttribs(newSize);
+ expandLineDirections(newSize);
}
firstLineVertex = lineVertexCount;
@@ -9103,7 +9102,7 @@ public class PGraphicsOpenGL extends PGraphics {
expandPointVertices(newSize);
expandPointColors(newSize);
- expandPointAttribs(newSize);
+ expandPointOffsets(newSize);
}
firstPointVertex = pointVertexCount;
@@ -9314,12 +9313,12 @@ public class PGraphicsOpenGL extends PGraphics {
PGL.updateIntBuffer(lineColorsBuffer, lineColors, offset, size);
}
- protected void updateLineAttribsBuffer() {
- updateLineAttribsBuffer(0, lineVertexCount);
+ protected void updateLineDirectionsBuffer() {
+ updateLineDirectionsBuffer(0, lineVertexCount);
}
- protected void updateLineAttribsBuffer(int offset, int size) {
- PGL.updateFloatBuffer(lineAttribsBuffer, lineAttribs,
+ protected void updateLineDirectionsBuffer(int offset, int size) {
+ PGL.updateFloatBuffer(lineDirectionsBuffer, lineDirections,
4 * offset, 4 * size);
}
@@ -9348,12 +9347,12 @@ public class PGraphicsOpenGL extends PGraphics {
PGL.updateIntBuffer(pointColorsBuffer, pointColors, offset, size);
}
- protected void updatePointAttribsBuffer() {
- updatePointAttribsBuffer(0, pointVertexCount);
+ protected void updatePointOffsetsBuffer() {
+ updatePointOffsetsBuffer(0, pointVertexCount);
}
- protected void updatePointAttribsBuffer(int offset, int size) {
- PGL.updateFloatBuffer(pointAttribsBuffer, pointAttribs,
+ protected void updatePointOffsetsBuffer(int offset, int size) {
+ PGL.updateFloatBuffer(pointOffsetsBuffer, pointOffsets,
2 * offset, 2 * size);
}
@@ -9446,11 +9445,11 @@ public class PGraphicsOpenGL extends PGraphics {
lineColorsBuffer = PGL.allocateIntBuffer(lineColors);
}
- void expandLineAttribs(int n) {
+ void expandLineDirections(int n) {
float temp[] = new float[4 * n];
- PApplet.arrayCopy(lineAttribs, 0, temp, 0, 4 * lineVertexCount);
- lineAttribs = temp;
- lineAttribsBuffer = PGL.allocateFloatBuffer(lineAttribs);
+ PApplet.arrayCopy(lineDirections, 0, temp, 0, 4 * lineVertexCount);
+ lineDirections = temp;
+ lineDirectionsBuffer = PGL.allocateFloatBuffer(lineDirections);
}
void expandLineIndices(int n) {
@@ -9474,11 +9473,11 @@ public class PGraphicsOpenGL extends PGraphics {
pointColorsBuffer = PGL.allocateIntBuffer(pointColors);
}
- void expandPointAttribs(int n) {
+ void expandPointOffsets(int n) {
float temp[] = new float[2 * n];
- PApplet.arrayCopy(pointAttribs, 0, temp, 0, 2 * pointVertexCount);
- pointAttribs = temp;
- pointAttribsBuffer = PGL.allocateFloatBuffer(pointAttribs);
+ PApplet.arrayCopy(pointOffsets, 0, temp, 0, 2 * pointVertexCount);
+ pointOffsets = temp;
+ pointOffsetsBuffer = PGL.allocateFloatBuffer(pointOffsets);
}
void expandPointIndices(int n) {
@@ -9511,7 +9510,7 @@ public class PGraphicsOpenGL extends PGraphics {
if (0 < lineVertexCount && lineVertexCount < lineVertices.length / 4) {
trimLineVertices();
trimLineColors();
- trimLineAttribs();
+ trimLineDirections();
}
if (0 < lineIndexCount && lineIndexCount < lineIndices.length) {
@@ -9521,7 +9520,7 @@ public class PGraphicsOpenGL extends PGraphics {
if (0 < pointVertexCount && pointVertexCount < pointVertices.length / 4) {
trimPointVertices();
trimPointColors();
- trimPointAttribs();
+ trimPointOffsets();
}
if (0 < pointIndexCount && pointIndexCount < pointIndices.length) {
@@ -9606,11 +9605,11 @@ public class PGraphicsOpenGL extends PGraphics {
lineColorsBuffer = PGL.allocateIntBuffer(lineColors);
}
- void trimLineAttribs() {
+ void trimLineDirections() {
float temp[] = new float[4 * lineVertexCount];
- PApplet.arrayCopy(lineAttribs, 0, temp, 0, 4 * lineVertexCount);
- lineAttribs = temp;
- lineAttribsBuffer = PGL.allocateFloatBuffer(lineAttribs);
+ PApplet.arrayCopy(lineDirections, 0, temp, 0, 4 * lineVertexCount);
+ lineDirections = temp;
+ lineDirectionsBuffer = PGL.allocateFloatBuffer(lineDirections);
}
void trimLineIndices() {
@@ -9634,11 +9633,11 @@ public class PGraphicsOpenGL extends PGraphics {
pointColorsBuffer = PGL.allocateIntBuffer(pointColors);
}
- void trimPointAttribs() {
+ void trimPointOffsets() {
float temp[] = new float[2 * pointVertexCount];
- PApplet.arrayCopy(pointAttribs, 0, temp, 0, 2 * pointVertexCount);
- pointAttribs = temp;
- pointAttribsBuffer = PGL.allocateFloatBuffer(pointAttribs);
+ PApplet.arrayCopy(pointOffsets, 0, temp, 0, 2 * pointVertexCount);
+ pointOffsets = temp;
+ pointOffsetsBuffer = PGL.allocateFloatBuffer(pointOffsets);
}
void trimPointIndices() {
@@ -9787,10 +9786,10 @@ public class PGraphicsOpenGL extends PGraphics {
lineColors[tessIdx] = rgba;
index = 4 * tessIdx;
- lineAttribs[index++] = 0;
- lineAttribs[index++] = 0;
- lineAttribs[index++] = 0;
- lineAttribs[index ] = 0;
+ lineDirections[index++] = 0;
+ lineDirections[index++] = 0;
+ lineDirections[index++] = 0;
+ lineDirections[index ] = 0;
}
// Sets line vertex with index tessIdx using the data from input vertices
@@ -9809,6 +9808,10 @@ public class PGraphicsOpenGL extends PGraphics {
float y1 = in.vertices[index++];
float z1 = in.vertices[index ];
+ float dx = x1 - x0;
+ float dy = y1 - y0;
+ float dz = z1 - z0;
+
if (renderMode == IMMEDIATE && flushMode == FLUSH_WHEN_FULL) {
PMatrix3D mm = modelview;
@@ -9819,9 +9822,9 @@ public class PGraphicsOpenGL extends PGraphics {
lineVertices[index ] = x0*mm.m30 + y0*mm.m31 + z0*mm.m32 + mm.m33;
index = 4 * tessIdx;
- lineAttribs[index++] = x1*mm.m00 + y1*mm.m01 + z1*mm.m02 + mm.m03;
- lineAttribs[index++] = x1*mm.m10 + y1*mm.m11 + z1*mm.m12 + mm.m13;
- lineAttribs[index ] = x1*mm.m20 + y1*mm.m21 + z1*mm.m22 + mm.m23;
+ lineDirections[index++] = dx*mm.m00 + dy*mm.m01 + dz*mm.m02;
+ lineDirections[index++] = dx*mm.m10 + dy*mm.m11 + dz*mm.m12;
+ lineDirections[index ] = dx*mm.m20 + dy*mm.m21 + dz*mm.m22;
} else {
index = 4 * tessIdx;
lineVertices[index++] = x0;
@@ -9830,13 +9833,13 @@ public class PGraphicsOpenGL extends PGraphics {
lineVertices[index ] = 1;
index = 4 * tessIdx;
- lineAttribs[index++] = x1;
- lineAttribs[index++] = y1;
- lineAttribs[index ] = z1;
+ lineDirections[index++] = dx;
+ lineDirections[index++] = dy;
+ lineDirections[index ] = dz;
}
lineColors[tessIdx] = rgba;
- lineAttribs[4 * tessIdx + 3] = weight;
+ lineDirections[4 * tessIdx + 3] = weight;
}
// -----------------------------------------------------------------
@@ -10094,16 +10097,19 @@ public class PGraphicsOpenGL extends PGraphics {
float y = lineVertices[index ];
index = 4 * i;
- float xa = lineAttribs[index++];
- float ya = lineAttribs[index ];
+ float xa = lineDirections[index++];
+ float ya = lineDirections[index ];
+
+ float dx = xa - x;
+ float dy = ya - y;
index = 4 * i;
lineVertices[index++] = x*tr.m00 + y*tr.m01 + tr.m02;
lineVertices[index ] = x*tr.m10 + y*tr.m11 + tr.m12;
index = 4 * i;
- lineAttribs[index++] = xa*tr.m00 + ya*tr.m01 + tr.m02;
- lineAttribs[index ] = xa*tr.m10 + ya*tr.m11 + tr.m12;
+ lineDirections[index++] = dx*tr.m00 + dy*tr.m01;
+ lineDirections[index ] = dx*tr.m10 + dy*tr.m11;
}
}
}
@@ -10166,9 +10172,13 @@ public class PGraphicsOpenGL extends PGraphics {
float w = lineVertices[index ];
index = 4 * i;
- float xa = lineAttribs[index++];
- float ya = lineAttribs[index++];
- float za = lineAttribs[index ];
+ float xa = lineDirections[index++];
+ float ya = lineDirections[index++];
+ float za = lineDirections[index ];
+
+ float dx = xa - x;
+ float dy = ya - y;
+ float dz = za - z;
index = 4 * i;
lineVertices[index++] = x*tr.m00 + y*tr.m01 + z*tr.m02 + w*tr.m03;
@@ -10177,9 +10187,9 @@ public class PGraphicsOpenGL extends PGraphics {
lineVertices[index ] = x*tr.m30 + y*tr.m31 + z*tr.m32 + w*tr.m33;
index = 4 * i;
- lineAttribs[index++] = xa*tr.m00 + ya*tr.m01 + za*tr.m02 + tr.m03;
- lineAttribs[index++] = xa*tr.m10 + ya*tr.m11 + za*tr.m12 + tr.m13;
- lineAttribs[index ] = xa*tr.m20 + ya*tr.m21 + za*tr.m22 + tr.m23;
+ lineDirections[index++] = dx*tr.m00 + dy*tr.m01 + dz*tr.m02;
+ lineDirections[index++] = dx*tr.m10 + dy*tr.m11 + dz*tr.m12;
+ lineDirections[index ] = dx*tr.m20 + dy*tr.m21 + dz*tr.m22;
}
}
}
@@ -10384,15 +10394,15 @@ public class PGraphicsOpenGL extends PGraphics {
// the circle perimeter. The point shader will read these attributes and
// displace the vertices in screen coordinates so the circles are always
// camera facing (bilboards)
- tess.pointAttribs[2 * attribIdx + 0] = 0;
- tess.pointAttribs[2 * attribIdx + 1] = 0;
+ tess.pointOffsets[2 * attribIdx + 0] = 0;
+ tess.pointOffsets[2 * attribIdx + 1] = 0;
attribIdx++;
float val = 0;
float inc = (float) SINCOS_LENGTH / perim;
for (int k = 0; k < perim; k++) {
- tess.pointAttribs[2 * attribIdx + 0] =
+ tess.pointOffsets[2 * attribIdx + 0] =
0.5f * cosLUT[(int) val] * strokeWeight;
- tess.pointAttribs[2 * attribIdx + 1] =
+ tess.pointOffsets[2 * attribIdx + 1] =
0.5f * sinLUT[(int) val] * strokeWeight;
val = (val + inc) % SINCOS_LENGTH;
attribIdx++;
@@ -10515,13 +10525,13 @@ public class PGraphicsOpenGL extends PGraphics {
// the quad corners. The point shader will read these attributes and
// displace the vertices in screen coordinates so the quads are always
// camera facing (bilboards)
- tess.pointAttribs[2 * attribIdx + 0] = 0;
- tess.pointAttribs[2 * attribIdx + 1] = 0;
+ tess.pointOffsets[2 * attribIdx + 0] = 0;
+ tess.pointOffsets[2 * attribIdx + 1] = 0;
attribIdx++;
for (int k = 0; k < 4; k++) {
- tess.pointAttribs[2 * attribIdx + 0] =
+ tess.pointOffsets[2 * attribIdx + 0] =
0.5f * QUAD_POINT_SIGNS[k][0] * strokeWeight;
- tess.pointAttribs[2 * attribIdx + 1] =
+ tess.pointOffsets[2 * attribIdx + 1] =
0.5f * QUAD_POINT_SIGNS[k][1] * strokeWeight;
attribIdx++;
}
diff --git a/android/core/src/processing/opengl/PShapeOpenGL.java b/android/core/src/processing/opengl/PShapeOpenGL.java
index ee88a5519..e7ffc3730 100644
--- a/android/core/src/processing/opengl/PShapeOpenGL.java
+++ b/android/core/src/processing/opengl/PShapeOpenGL.java
@@ -616,32 +616,6 @@ public class PShapeOpenGL extends PShape {
}
- /*
- @Override
- public PVector getTop(PVector top) {
- if (top == null) {
- top = new PVector();
- }
- top.set(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY,
- Float.POSITIVE_INFINITY);
- getVertexMin(top);
- return top;
- }
-
-
- @Override
- public PVector getBottom(PVector bottom) {
- if (bottom == null) {
- bottom = new PVector();
- }
- bottom.set(Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY,
- Float.NEGATIVE_INFINITY);
- getVertexMax(bottom);
- return bottom;
- }
- */
-
-
protected void getVertexMin(PVector min) {
updateTessellation();
@@ -990,25 +964,6 @@ public class PShapeOpenGL extends PShape {
}
}
-/*
- @Override
- public void beginShape() {
- beginShape(POLYGON);
- }
-
-
- @Override
- public void beginShape(int kind) {
- this.kind = kind;
- openShape = true;
- }
-
-
- @Override
- public void endShape() {
- endShape(OPEN);
- }
-*/
@Override
public void endShape(int mode) {
@@ -1051,772 +1006,6 @@ public class PShapeOpenGL extends PShape {
}
- //////////////////////////////////////////////////////////////
-
- // Stroke cap/join/weight set/update
-
-/*
- @Override
- public void strokeWeight(float weight) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.strokeWeight(weight);
- }
- } else {
- updateStrokeWeight(weight);
- }
- }
-
-
- protected void updateStrokeWeight(float newWeight) {
- if (PGraphicsOpenGL.same(strokeWeight, newWeight)) return;
- float oldWeight = strokeWeight;
- strokeWeight = newWeight;
-
- Arrays.fill(inGeo.strokeWeights, 0, inGeo.vertexCount, strokeWeight);
- if (shapeCreated && tessellated && (hasLines || hasPoints)) {
- float resizeFactor = newWeight / oldWeight;
- if (hasLines) {
- if (is3D()) {
- for (int i = firstLineVertex; i <= lastLineVertex; i++) {
- tessGeo.lineAttribs[4 * i + 3] *= resizeFactor;
- }
- root.setModifiedLineAttributes(firstLineVertex, lastLineVertex);
- } else if (is2D()) {
- // Changing the stroke weight on a 2D shape needs a
- // re-tesellation in order to replace the old line
- // geometry.
- markForTessellation();
- }
- }
- if (hasPoints) {
- if (is3D()) {
- for (int i = firstPointVertex; i <= lastPointVertex; i++) {
- tessGeo.pointAttribs[2 * i + 0] *= resizeFactor;
- tessGeo.pointAttribs[2 * i + 1] *= resizeFactor;
- }
- root.setModifiedPointAttributes(firstPointVertex, lastPointVertex);
- } else if (is2D()) {
- // Changing the stroke weight on a 2D shape needs a
- // re-tesellation in order to replace the old point
- // geometry.
- markForTessellation();
- }
- }
- }
- }
-
-
- @Override
- public void strokeJoin(int join) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.strokeJoin(join);
- }
- } else {
- if (is2D() && strokeJoin != join) {
- // Changing the stroke join on a 2D shape needs a
- // re-tesellation in order to replace the old join
- // geometry.
- markForTessellation();
- }
- strokeJoin = join;
- }
- }
-
-
- @Override
- public void strokeCap(int cap) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.strokeCap(cap);
- }
- } else {
- if (is2D() && strokeCap != cap) {
- // Changing the stroke cap on a 2D shape needs a
- // re-tesellation in order to replace the old cap
- // geometry.
- markForTessellation();
- }
- strokeCap = cap;
- }
- }
-*/
-
- //////////////////////////////////////////////////////////////
-
- // Fill set/update
-
-/*
- @Override
- public void noFill() {
- fill = false;
-// if (family == GROUP) {
-// for (int i = 0; i < childCount; i++) {
-// PShapeOpenGL child = (PShapeOpenGL) children[i];
-// child.noFill();
-// }
-// } else {
-// fill = false;
-// updateFillColor(0x0);
-// }
- }
-
- @Override
- public void fill(int argb) {
-
- }
- */
-
-/*
- @Override
- public void fill(int rgb) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.fill(rgb);
- }
- } else {
- colorCalc(rgb);
- fillFromCalc();
- }
- }
-
-
- @Override
- public void fill(int rgb, float alpha) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.fill(rgb, alpha);
- }
- } else {
- colorCalc(rgb, alpha);
- fillFromCalc();
- }
- }
-
-
- @Override
- public void fill(float gray) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.fill(gray);
- }
- } else {
- colorCalc(gray);
- fillFromCalc();
- }
- }
-
-
- @Override
- public void fill(float gray, float alpha) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.fill(gray, alpha);
- }
- } else {
- colorCalc(gray, alpha);
- fillFromCalc();
- }
- }
-
-
- @Override
- public void fill(float x, float y, float z) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.fill(x, y, z);
- }
- } else {
- colorCalc(x, y, z);
- fillFromCalc();
- }
- }
-
-
- @Override
- public void fill(float x, float y, float z, float a) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.fill(x, y, z, a);
- }
- } else {
- colorCalc(x, y, z, a);
- fillFromCalc();
- }
- }
-
-
- protected void fillFromCalc() {
- fill = true;
- updateFillColor(calcColor);
-
- if (!setAmbient) {
- // Setting the ambient color from the current fill
- // is what the old P3D did and allows to have an
- // default ambient color when the user doesn't specify
- // it explicitly.
- ambientFromCalc();
- setAmbient = false;
- }
- }
-
-
- protected void updateFillColor(int newFillColor) {
- if (!openShape) {
- PGraphics.showWarning("Neet to call beginShape() first");
- return;
- }
-
- fillColor = newFillColor;
- }
-*/
-
- //////////////////////////////////////////////////////////////
-
- // Stroke (color) set/update
-
-/*
- @Override
- public void noStroke() {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.noStroke();
- }
- } else {
- if (stroke) {
- // Disabling stroke on a shape previously with
- // stroke needs a re-tesellation in order to remove
- // the additional geometry of lines and/or points.
- markForTessellation();
- stroke = false;
- }
- updateStrokeColor(0x0);
- if (is2D() && parent != null) {
- ((PShapeOpenGL)parent).strokedTexture(false);
- }
- }
- }
-
-
- @Override
- public void stroke(int rgb) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.stroke(rgb);
- }
- } else {
- colorCalc(rgb);
- strokeFromCalc();
- }
- }
-
-
- @Override
- public void stroke(int rgb, float alpha) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.stroke(rgb, alpha);
- }
- } else {
- colorCalc(rgb, alpha);
- strokeFromCalc();
- }
- }
-
-
- @Override
- public void stroke(float gray) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.stroke(gray);
- }
- } else {
- colorCalc(gray);
- strokeFromCalc();
- }
- }
-
-
- @Override
- public void stroke(float gray, float alpha) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.stroke(gray, alpha);
- }
- } else {
- colorCalc(gray, alpha);
- strokeFromCalc();
- }
- }
-
-
- @Override
- public void stroke(float x, float y, float z) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.stroke(x, y, z);
- }
- } else {
- colorCalc(x, y, z);
- strokeFromCalc();
- }
- }
-
-
- @Override
- public void stroke(float x, float y, float z, float alpha) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.stroke(x, y, z, alpha);
- }
- } else {
- colorCalc(x, y, z, alpha);
- strokeFromCalc();
- }
- }
-
-
- protected void strokeFromCalc() {
- if (!stroke) {
- // Enabling stroke on a shape previously without
- // stroke needs a re-tessellation in order to incorporate
- // the additional geometry of lines and/or points.
- markForTessellation();
- stroke = true;
- }
- updateStrokeColor(calcColor);
- if (is2D() && image != null && parent != null) {
- ((PShapeOpenGL)parent).strokedTexture(true);
- }
- }
-
-
- protected void updateStrokeColor(int newStrokeColor) {
- if (!openShape) {
- PGraphics.showWarning("Neet to call beginShape() first");
- return;
- }
-
- strokeColor = newStrokeColor;
- }
-*/
-
- //////////////////////////////////////////////////////////////
-
- // Tint set/update
-
-/*
- @Override
- public void noTint() {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.noTint();
- }
- } else {
- tint = false;
- updateTintColor(0x0);
- }
- }
-
-
- @Override
- public void tint(int rgb) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.tint(rgb);
- }
- } else {
- colorCalc(rgb);
- tintFromCalc();
- }
- }
-
-
- @Override
- public void tint(int rgb, float alpha) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.tint(rgb, alpha);
- }
- } else {
- colorCalc(rgb, alpha);
- tintFromCalc();
- }
- }
-
-
- @Override
- public void tint(float gray) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.tint(gray);
- }
- } else {
- colorCalc(gray);
- tintFromCalc();
- }
- }
-
-
- @Override
- public void tint(float gray, float alpha) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.tint(gray, alpha);
- }
- } else {
- colorCalc(gray, alpha);
- tintFromCalc();
- }
- }
-
-
- @Override
- public void tint(float x, float y, float z) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.tint(x, y, z);
- }
- } else {
- colorCalc(x, y, z);
- tintFromCalc();
- }
- }
-
-
- @Override
- public void tint(float x, float y, float z, float alpha) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.tint(x, y, z, alpha);
- }
- } else {
- colorCalc(x, y, z, alpha);
- tintFromCalc();
- }
- }
-
-
- protected void tintFromCalc() {
- tint = true;
- updateTintColor(calcColor);
- }
-
-
- protected void updateTintColor(int newTintColor) {
- if (tintColor == newTintColor) return;
- tintColor = newTintColor;
-
- if (image != null) {
- Arrays.fill(inGeo.colors, 0, inGeo.vertexCount,
- PGL.javaToNativeARGB(tintColor));
- if (shapeCreated && tessellated && hasPolys) {
- if (is3D()) {
- Arrays.fill(tessGeo.polyColors, firstPolyVertex, lastPolyVertex + 1,
- PGL.javaToNativeARGB(tintColor));
- root.setModifiedPolyColors(firstPolyVertex, lastPolyVertex);
- } else if (is2D()) {
- int last1 = lastPolyVertex + 1;
- if (-1 < firstLineVertex) last1 = firstLineVertex;
- if (-1 < firstPointVertex) last1 = firstPointVertex;
- Arrays.fill(tessGeo.polyColors, firstPolyVertex, last1,
- PGL.javaToNativeARGB(tintColor));
- root.setModifiedPolyColors(firstPolyVertex, last1 - 1);
- }
- }
- }
- }
-*/
-
- //////////////////////////////////////////////////////////////
-
- // Ambient set/update
-
-/*
- @Override
- public void ambient(int rgb) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.ambient(rgb);
- }
- } else {
- colorCalc(rgb);
- ambientFromCalc();
- }
- }
-
-
- @Override
- public void ambient(float gray) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.ambient(gray);
- }
- } else {
- colorCalc(gray);
- ambientFromCalc();
- }
- }
-
-
- @Override
- public void ambient(float x, float y, float z) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.ambient(x, y, z);
- }
- } else {
- colorCalc(x, y, z);
- ambientFromCalc();
- }
- }
-
-
- protected void ambientFromCalc() {
- updateAmbientColor(calcColor);
- setAmbient = true;
- }
-
-
- protected void updateAmbientColor(int newAmbientColor) {
- if (ambientColor == newAmbientColor) return;
- ambientColor = newAmbientColor;
-
- Arrays.fill(inGeo.ambient, 0, inGeo.vertexCount,
- PGL.javaToNativeARGB(ambientColor));
- if (shapeCreated && tessellated && hasPolys) {
- if (is3D()) {
- Arrays.fill(tessGeo.polyAmbient, firstPolyVertex, lastPolyVertex + 1,
- PGL.javaToNativeARGB(ambientColor));
- root.setModifiedPolyAmbient(firstPolyVertex, lastPolyVertex);
- } else if (is2D()) {
- int last1 = lastPolyVertex + 1;
- if (-1 < firstLineVertex) last1 = firstLineVertex;
- if (-1 < firstPointVertex) last1 = firstPointVertex;
- Arrays.fill(tessGeo.polyAmbient, firstPolyVertex, last1,
- PGL.javaToNativeARGB(ambientColor));
- root.setModifiedPolyColors(firstPolyVertex, last1 - 1);
- }
- }
- }
-*/
-
- //////////////////////////////////////////////////////////////
-
- // Specular set/update
-
-/*
- @Override
- public void specular(int rgb) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.specular(rgb);
- }
- } else {
- colorCalc(rgb);
- specularFromCalc();
- }
- }
-
-
- @Override
- public void specular(float gray) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.specular(gray);
- }
- } else {
- colorCalc(gray);
- specularFromCalc();
- }
- }
-
-
- @Override
- public void specular(float x, float y, float z) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.specular(x, y, z);
- }
- } else {
- colorCalc(x, y, z);
- specularFromCalc();
- }
- }
-
-
- protected void specularFromCalc() {
- updateSpecularColor(calcColor);
- }
-
-
- protected void updateSpecularColor(int newSpecularColor) {
- if (specularColor == newSpecularColor) return;
- specularColor = newSpecularColor;
-
- Arrays.fill(inGeo.specular, 0, inGeo.vertexCount,
- PGL.javaToNativeARGB(specularColor));
- if (shapeCreated && tessellated && hasPolys) {
- if (is3D()) {
- Arrays.fill(tessGeo.polySpecular, firstPolyVertex, lastPolyVertex + 1,
- PGL.javaToNativeARGB(specularColor));
- root.setModifiedPolySpecular(firstPolyVertex, lastPolyVertex);
- } else if (is2D()) {
- int last1 = lastPolyVertex + 1;
- if (-1 < firstLineVertex) last1 = firstLineVertex;
- if (-1 < firstPointVertex) last1 = firstPointVertex;
- Arrays.fill(tessGeo.polySpecular, firstPolyVertex, last1,
- PGL.javaToNativeARGB(specularColor));
- root.setModifiedPolyColors(firstPolyVertex, last1 - 1);
- }
- }
- }
-*/
-
- //////////////////////////////////////////////////////////////
-
- // Emissive set/update
-
-/*
- @Override
- public void emissive(int rgb) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.emissive(rgb);
- }
- } else {
- colorCalc(rgb);
- emissiveFromCalc();
- }
- }
-
-
- @Override
- public void emissive(float gray) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.emissive(gray);
- }
- } else {
- colorCalc(gray);
- emissiveFromCalc();
- }
- }
-
-
- @Override
- public void emissive(float x, float y, float z) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.emissive(x, y, z);
- }
- } else {
- colorCalc(x, y, z);
- emissiveFromCalc();
- }
- }
-
-
- protected void emissiveFromCalc() {
- updateEmissiveColor(calcColor);
- }
-
-
- protected void updateEmissiveColor(int newEmissiveColor) {
- if (emissiveColor == newEmissiveColor) return;
- emissiveColor = newEmissiveColor;
-
- Arrays.fill(inGeo.emissive, 0, inGeo.vertexCount,
- PGL.javaToNativeARGB(emissiveColor));
- if (shapeCreated && tessellated && 0 < tessGeo.polyVertexCount) {
- if (is3D()) {
- Arrays.fill(tessGeo.polyEmissive, firstPolyVertex, lastPolyVertex + 1,
- PGL.javaToNativeARGB(emissiveColor));
- root.setModifiedPolyEmissive(firstPolyVertex, lastPolyVertex);
- } else if (is2D()) {
- int last1 = lastPolyVertex + 1;
- if (-1 < firstLineVertex) last1 = firstLineVertex;
- if (-1 < firstPointVertex) last1 = firstPointVertex;
- Arrays.fill(tessGeo.polyEmissive, firstPolyVertex, last1,
- PGL.javaToNativeARGB(emissiveColor));
- root.setModifiedPolyColors(firstPolyVertex, last1 - 1);
- }
- }
- }
-*/
-
- //////////////////////////////////////////////////////////////
-
- // Shininess set/update
-
-/*
- @Override
- public void shininess(float shine) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.shininess(shine);
- }
- } else {
- updateShininessFactor(shine);
- }
- }
-
-
- protected void updateShininessFactor(float newShininess) {
- if (PGraphicsOpenGL.same(shininess, newShininess)) return;
- shininess = newShininess;
-
- Arrays.fill(inGeo.shininess, 0, inGeo.vertexCount, shininess);
- if (shapeCreated && tessellated && hasPolys) {
- if (is3D()) {
- Arrays.fill(tessGeo.polyShininess, firstPolyVertex, lastPolyVertex + 1,
- shininess);
- root.setModifiedPolyShininess(firstPolyVertex, lastPolyVertex);
- } else if (is2D()) {
- int last1 = lastPolyVertex + 1;
- if (-1 < firstLineVertex) last1 = firstLineVertex;
- if (-1 < firstPointVertex) last1 = firstPointVertex;
- Arrays.fill(tessGeo.polyShininess, firstPolyVertex, last1, shininess);
- root.setModifiedPolyColors(firstPolyVertex, last1 - 1);
- }
- }
- }
-*/
-
///////////////////////////////////////////////////////////
//
@@ -2613,7 +1802,7 @@ public class PShapeOpenGL extends PShape {
if (hasLines) {
if (is3D()) {
for (int i = firstLineVertex; i <= lastLineVertex; i++) {
- tessGeo.lineAttribs[4 * i + 3] *= resizeFactor;
+ tessGeo.lineDirections[4 * i + 3] *= resizeFactor;
}
root.setModifiedLineAttributes(firstLineVertex, lastLineVertex);
} else if (is2D()) {
@@ -2626,8 +1815,8 @@ public class PShapeOpenGL extends PShape {
if (hasPoints) {
if (is3D()) {
for (int i = firstPointVertex; i <= lastPointVertex; i++) {
- tessGeo.pointAttribs[2 * i + 0] *= resizeFactor;
- tessGeo.pointAttribs[2 * i + 1] *= resizeFactor;
+ tessGeo.pointOffsets[2 * i + 0] *= resizeFactor;
+ tessGeo.pointOffsets[2 * i + 1] *= resizeFactor;
}
root.setModifiedPointAttributes(firstPointVertex, lastPointVertex);
} else if (is2D()) {
@@ -4080,11 +3269,11 @@ public class PShapeOpenGL extends PShape {
pgl.bufferData(PGL.ARRAY_BUFFER, sizei,
tessGeo.lineColorsBuffer, PGL.STATIC_DRAW);
- tessGeo.updateLineAttribsBuffer();
+ tessGeo.updateLineDirectionsBuffer();
glLineAttrib = pg.createVertexBufferObject(context);
pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineAttrib);
pgl.bufferData(PGL.ARRAY_BUFFER, 4 * sizef,
- tessGeo.lineAttribsBuffer, PGL.STATIC_DRAW);
+ tessGeo.lineDirectionsBuffer, PGL.STATIC_DRAW);
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
@@ -4116,11 +3305,11 @@ public class PShapeOpenGL extends PShape {
pgl.bufferData(PGL.ARRAY_BUFFER, sizei,
tessGeo.pointColorsBuffer, PGL.STATIC_DRAW);
- tessGeo.updatePointAttribsBuffer();
+ tessGeo.updatePointOffsetsBuffer();
glPointAttrib = pg.createVertexBufferObject(context);
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointAttrib);
pgl.bufferData(PGL.ARRAY_BUFFER, 2 * sizef,
- tessGeo.pointAttribsBuffer, PGL.STATIC_DRAW);
+ tessGeo.pointOffsetsBuffer, PGL.STATIC_DRAW);
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
@@ -4544,12 +3733,12 @@ public class PShapeOpenGL extends PShape {
protected void copyLineAttributes(int offset, int size) {
- tessGeo.updateLineAttribsBuffer(offset, size);
+ tessGeo.updateLineDirectionsBuffer(offset, size);
pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineAttrib);
- tessGeo.lineAttribsBuffer.position(4 * offset);
+ tessGeo.lineDirectionsBuffer.position(4 * offset);
pgl.bufferSubData(PGL.ARRAY_BUFFER, 4 * offset * PGL.SIZEOF_FLOAT,
- 4 * size * PGL.SIZEOF_FLOAT, tessGeo.lineAttribsBuffer);
- tessGeo.lineAttribsBuffer.rewind();
+ 4 * size * PGL.SIZEOF_FLOAT, tessGeo.lineDirectionsBuffer);
+ tessGeo.lineDirectionsBuffer.rewind();
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
}
@@ -4577,12 +3766,12 @@ public class PShapeOpenGL extends PShape {
protected void copyPointAttributes(int offset, int size) {
- tessGeo.updatePointAttribsBuffer(offset, size);
+ tessGeo.updatePointOffsetsBuffer(offset, size);
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointAttrib);
- tessGeo.pointAttribsBuffer.position(2 * offset);
+ tessGeo.pointOffsetsBuffer.position(2 * offset);
pgl.bufferSubData(PGL.ARRAY_BUFFER, 2 * offset * PGL.SIZEOF_FLOAT,
- 2 * size * PGL.SIZEOF_FLOAT, tessGeo.pointAttribsBuffer);
- tessGeo.pointAttribsBuffer.rewind();
+ 2 * size * PGL.SIZEOF_FLOAT, tessGeo.pointOffsetsBuffer);
+ tessGeo.pointOffsetsBuffer.rewind();
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
}
@@ -5095,7 +4284,7 @@ public class PShapeOpenGL extends PShape {
float[] vertices = tessGeo.lineVertices;
int[] color = tessGeo.lineColors;
- float[] attribs = tessGeo.lineAttribs;
+ float[] attribs = tessGeo.lineDirections;
short[] indices = tessGeo.lineIndices;
IndexCache cache = tessGeo.lineIndexCache;
@@ -5194,7 +4383,7 @@ public class PShapeOpenGL extends PShape {
float[] vertices = tessGeo.pointVertices;
int[] color = tessGeo.pointColors;
- float[] attribs = tessGeo.pointAttribs;
+ float[] attribs = tessGeo.pointOffsets;
short[] indices = tessGeo.pointIndices;
IndexCache cache = tessGeo.pointIndexCache;
diff --git a/android/core/src/processing/opengl/PolyNoTexShaderFrag.glsl b/android/core/src/processing/opengl/PointFrag.glsl
similarity index 100%
rename from android/core/src/processing/opengl/PolyNoTexShaderFrag.glsl
rename to android/core/src/processing/opengl/PointFrag.glsl
diff --git a/android/core/src/processing/opengl/PointShaderVert.glsl b/android/core/src/processing/opengl/PointVert.glsl
similarity index 93%
rename from android/core/src/processing/opengl/PointShaderVert.glsl
rename to android/core/src/processing/opengl/PointVert.glsl
index fd64d0dc1..7523e3326 100644
--- a/android/core/src/processing/opengl/PointShaderVert.glsl
+++ b/android/core/src/processing/opengl/PointVert.glsl
@@ -32,9 +32,9 @@ attribute vec2 offset;
varying vec4 vertColor;
-vec4 windowToClipVector(vec2 window, vec4 viewport, float clip_w) {
+vec4 windowToClipVector(vec2 window, vec4 viewport, float clipw) {
vec2 xypos = (window / viewport.zw) * 2.0;
- return vec4(xypos, 0.0, 0.0) * clip_w;
+ return vec4(xypos, 0.0, 0.0) * clipw;
}
void main() {
diff --git a/android/core/src/processing/opengl/PolyTexlightShaderVert.glsl b/android/core/src/processing/opengl/TexlightVert.glsl
similarity index 100%
rename from android/core/src/processing/opengl/PolyTexlightShaderVert.glsl
rename to android/core/src/processing/opengl/TexlightVert.glsl
diff --git a/android/core/src/processing/opengl/PolyTexShaderFrag.glsl b/android/core/src/processing/opengl/TextureFrag.glsl
similarity index 100%
rename from android/core/src/processing/opengl/PolyTexShaderFrag.glsl
rename to android/core/src/processing/opengl/TextureFrag.glsl
diff --git a/android/core/src/processing/opengl/PolyTexShaderVert.glsl b/android/core/src/processing/opengl/TextureVert.glsl
similarity index 100%
rename from android/core/src/processing/opengl/PolyTexShaderVert.glsl
rename to android/core/src/processing/opengl/TextureVert.glsl
diff --git a/app/src/processing/app/contrib/ContributionListing.java b/app/src/processing/app/contrib/ContributionListing.java
index 2388b8c9c..aa05a72c5 100644
--- a/app/src/processing/app/contrib/ContributionListing.java
+++ b/app/src/processing/app/contrib/ContributionListing.java
@@ -343,10 +343,7 @@ public class ContributionListing {
* Starts a new thread to download the advertised list of contributions.
* Only one instance will run at a time.
*/
- protected void downloadAvailableList(ProgressMonitor pm) {
- final ProgressMonitor progressMonitor =
- (pm != null) ? pm : new NullProgressMonitor();
-
+ protected void downloadAvailableList(final ProgressMonitor progress) {
new Thread(new Runnable() {
public void run() {
downloadingListingLock.lock();
@@ -355,13 +352,13 @@ public class ContributionListing {
try {
url = new URL(LISTING_URL);
} catch (MalformedURLException e) {
- progressMonitor.error(e);
- progressMonitor.finished();
+ progress.error(e);
+ progress.finished();
}
- if (!progressMonitor.isFinished()) {
- ContributionManager.download(url, listingFile, progressMonitor);
- if (!progressMonitor.isCanceled() && !progressMonitor.isError()) {
+ if (!progress.isFinished()) {
+ ContributionManager.download(url, listingFile, progress);
+ if (!progress.isCanceled() && !progress.isError()) {
hasDownloadedLatestList = true;
setAdvertisedList(listingFile);
}
diff --git a/app/src/processing/app/contrib/ContributionManagerDialog.java b/app/src/processing/app/contrib/ContributionManagerDialog.java
index 5bef465ee..d725151b6 100644
--- a/app/src/processing/app/contrib/ContributionManagerDialog.java
+++ b/app/src/processing/app/contrib/ContributionManagerDialog.java
@@ -98,10 +98,10 @@ public class ContributionManagerDialog {
updateContributionListing();
} else {
- contribListing.downloadAvailableList(new AbstractProgressMonitor() {
- public void startTask(String name, int maxValue) {
- }
-
+ contribListing.downloadAvailableList(new ProgressMonitor() {
+// public void startTask(String name, int maxValue) {
+// }
+//
public void finished() {
super.finished();
diff --git a/app/src/processing/app/contrib/LocalContribution.java b/app/src/processing/app/contrib/LocalContribution.java
index b719a7eac..20af38f22 100644
--- a/app/src/processing/app/contrib/LocalContribution.java
+++ b/app/src/processing/app/contrib/LocalContribution.java
@@ -293,7 +293,7 @@ public abstract class LocalContribution extends Contribution {
new Thread(new Runnable() {
public void run() {
remove(editor,
- (pm != null) ? pm : new NullProgressMonitor(),
+ pm,
status,
ContributionListing.getInstance());
}
diff --git a/app/src/processing/app/contrib/ProgressMonitor.java b/app/src/processing/app/contrib/ProgressMonitor.java
index 616ebfca4..9e767364b 100644
--- a/app/src/processing/app/contrib/ProgressMonitor.java
+++ b/app/src/processing/app/contrib/ProgressMonitor.java
@@ -24,86 +24,89 @@ package processing.app.contrib;
import javax.swing.JProgressBar;
-/**
- * The ProgressMonitor interface should be implemented by objects that observe
- * progress of a task or activity.
- */
-public interface ProgressMonitor {
+// 4 classes is more abstraction than is necessary for a single progress bar
- int UNKNOWN = -1;
-
- /**
- * Starts a new task with the given name.
- *
- * @param maxValue
- * the amount of progress that must be made before a task is
- * finished. This may be set to UNKNOWN.
- */
- public void startTask(String name, int maxValue);
-
- /**
- * Updates the amount of progress for the current task.
- */
- public void setProgress(int value);
-
- /**
- * Returns the progress made toward the current task, as previously set by a
- * call to setProgress().
- */
- public int getProgress();
-
- /**
- * @return true if a cancellation has been requested, false
- * otherwise
- */
- public boolean isCanceled();
-
- /**
- * Requests for the task to be cancelled by setting isCanceled() to true.
- */
- public void cancel();
-
- /**
- * @return true if an error occured while completing the task
- */
- public boolean isError();
-
- /**
- * @return an exception that caused the error, may be null.
- */
- public Exception getException();
-
- /**
- * Indicates that an error occurred while performing the task. Exception may
- * be null.
- */
- public void error(Exception e);
-
- /**
- * Returns true if this task is complete
- */
- public boolean isFinished();
-
- /**
- * This is called when the current task is finished. This should always be
- * called when a task is finished, whether or not an error occurred or the
- * task was cancelled.
- */
- public void finished();
-}
+///**
+// * The ProgressMonitor interface should be implemented by objects that observe
+// * progress of a task or activity.
+// */
+//public interface ProgressMonitor {
+//
+// int UNKNOWN = -1;
+//
+// /**
+// * Starts a new task with the given name.
+// *
+// * @param maxValue
+// * the amount of progress that must be made before a task is
+// * finished. This may be set to UNKNOWN.
+// */
+// public void startTask(String name, int maxValue);
+//
+// /**
+// * Updates the amount of progress for the current task.
+// */
+// public void setProgress(int value);
+//
+// /**
+// * Returns the progress made toward the current task, as previously set by a
+// * call to setProgress().
+// */
+// public int getProgress();
+//
+// /**
+// * @return true if a cancellation has been requested, false
+// * otherwise
+// */
+// public boolean isCanceled();
+//
+// /**
+// * Requests for the task to be cancelled by setting isCanceled() to true.
+// */
+// public void cancel();
+//
+// /**
+// * @return true if an error occured while completing the task
+// */
+// public boolean isError();
+//
+// /**
+// * @return an exception that caused the error, may be null.
+// */
+// public Exception getException();
+//
+// /**
+// * Indicates that an error occurred while performing the task. Exception may
+// * be null.
+// */
+// public void error(Exception e);
+//
+// /**
+// * Returns true if this task is complete
+// */
+// public boolean isFinished();
+//
+// /**
+// * This is called when the current task is finished. This should always be
+// * called when a task is finished, whether or not an error occurred or the
+// * task was cancelled.
+// */
+// public void finished();
+//}
-abstract class AbstractProgressMonitor implements ProgressMonitor {
- boolean isCanceled = false;
-
- boolean isError = false;
-
- boolean isFinished = false;
-
+//abstract class AbstractProgressMonitor implements ProgressMonitor {
+abstract class ProgressMonitor {
+ static final int UNKNOWN = -1;
+ boolean canceled = false;
+ boolean error = false;
+ boolean finished = false;
Exception exception;
-
int progress = 0;
+ public void startTask(String name, int maxValue) {
+ }
+
public void setProgress(int value) {
progress = value;
}
@@ -113,15 +116,15 @@ abstract class AbstractProgressMonitor implements ProgressMonitor {
}
public boolean isCanceled() {
- return isCanceled;
+ return canceled;
}
public void cancel() {
- isCanceled = true;
+ canceled = true;
}
public boolean isError() {
- return isError;
+ return error;
}
public Exception getException() {
@@ -129,34 +132,36 @@ abstract class AbstractProgressMonitor implements ProgressMonitor {
}
public void error(Exception e) {
- isError = true;
+ error = true;
exception = e;
}
public boolean isFinished() {
- return isFinished;
+ return finished;
}
public void finished() {
- isFinished = true;
+ finished = true;
}
}
-class NullProgressMonitor extends AbstractProgressMonitor {
- public void startTask(String name, int maxValue) { }
-}
+//class NullProgressMonitor extends AbstractProgressMonitor {
+// public void startTask(String name, int maxValue) { }
+//}
-abstract class JProgressMonitor extends AbstractProgressMonitor {
+abstract class JProgressMonitor extends ProgressMonitor {
JProgressBar progressBar;
public JProgressMonitor(JProgressBar progressBar) {
this.progressBar = progressBar;
+ // doesn't center properly
+// progressBar.setFont(new Font("Dialog", Font.PLAIN, 10));
}
public void startTask(String name, int maxValue) {
- isFinished = false;
+ finished = false;
progressBar.setString(name);
progressBar.setIndeterminate(maxValue == UNKNOWN);
progressBar.setMaximum(maxValue);
diff --git a/app/src/processing/mode/java/Compiler.java b/app/src/processing/mode/java/Compiler.java
index da9c7c1dd..ca716d9d0 100644
--- a/app/src/processing/mode/java/Compiler.java
+++ b/app/src/processing/mode/java/Compiler.java
@@ -42,6 +42,7 @@ public class Compiler {
importSuggestions.put("Arrays", "java.util.Arrays");
importSuggestions.put("Collections", "java.util.Collections");
importSuggestions.put("Date", "java.util.Date");
+ importSuggestions.put("Frame", "java.awt.Frame");
importSuggestions.put("Iterator", "java.util.Iterator");
}
diff --git a/build/build.xml b/build/build.xml
index 1a0016f1b..7c1594162 100644
--- a/build/build.xml
+++ b/build/build.xml
@@ -43,15 +43,12 @@
-
+
+
+
+ message="To build on OS X, you must install both Apple's Java 6 and Oracle's JDK 7 (not just the plugin). Then add this line: ${line.separator}export JAVA_HOME=`/usr/libexec/java_home`${line.separator}to ~/.profile and open a new Terminal window." />
diff --git a/build/windows/.gitignore b/build/windows/.gitignore
new file mode 100644
index 000000000..5d5afb57b
--- /dev/null
+++ b/build/windows/.gitignore
@@ -0,0 +1 @@
+jre.zip
diff --git a/core/src/processing/opengl/PointShaderFrag.glsl b/core/src/processing/opengl/ColorFrag.glsl
similarity index 100%
rename from core/src/processing/opengl/PointShaderFrag.glsl
rename to core/src/processing/opengl/ColorFrag.glsl
diff --git a/core/src/processing/opengl/PolyColorShaderVert.glsl b/core/src/processing/opengl/ColorVert.glsl
similarity index 100%
rename from core/src/processing/opengl/PolyColorShaderVert.glsl
rename to core/src/processing/opengl/ColorVert.glsl
diff --git a/core/src/processing/opengl/PolyLightShaderVert.glsl b/core/src/processing/opengl/LightVert.glsl
similarity index 100%
rename from core/src/processing/opengl/PolyLightShaderVert.glsl
rename to core/src/processing/opengl/LightVert.glsl
diff --git a/core/src/processing/opengl/LineShaderFrag.glsl b/core/src/processing/opengl/LineFrag.glsl
similarity index 100%
rename from core/src/processing/opengl/LineShaderFrag.glsl
rename to core/src/processing/opengl/LineFrag.glsl
diff --git a/core/src/processing/opengl/LineShaderVert.glsl b/core/src/processing/opengl/LineVert.glsl
similarity index 72%
rename from core/src/processing/opengl/LineShaderVert.glsl
rename to core/src/processing/opengl/LineVert.glsl
index b60633dae..6769dc8d8 100644
--- a/core/src/processing/opengl/LineShaderVert.glsl
+++ b/core/src/processing/opengl/LineVert.glsl
@@ -29,7 +29,7 @@ uniform vec3 scale;
attribute vec4 vertex;
attribute vec4 color;
-attribute vec4 endpoint;
+attribute vec4 direction;
varying vec4 vertColor;
@@ -45,42 +45,40 @@ vec4 windowToClipVector(vec2 window, vec4 viewport, float clip_w) {
}
void main() {
- vec4 pos_p = vertex;
- vec4 v_p = modelview * pos_p;
+ vec4 posp = modelview * vertex;
+
// Moving vertices slightly toward the camera
// to avoid depth-fighting with the fill triangles.
// Discussed here:
// http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=252848
- v_p.xyz = v_p.xyz * scale;
- vec4 clip_p = projection * v_p;
- float thickness = endpoint.w;
+ posp.xyz = posp.xyz * scale;
+ vec4 clipp = projection * posp;
+ float thickness = direction.w;
if (thickness != 0.0) {
- vec4 pos_q = vec4(endpoint.xyz, 1);
- vec4 v_q = modelview * pos_q;
- v_q.xyz = v_q.xyz * scale;
- vec4 clip_q = projection * v_q;
+ vec4 posq = posp + modelview * vec4(direction.xyz, 1);
+ posq.xyz = posq.xyz * scale;
+ vec4 clipq = projection * posq;
- vec3 window_p = clipToWindow(clip_p, viewport);
- vec3 window_q = clipToWindow(clip_q, viewport);
+ vec3 window_p = clipToWindow(clipp, viewport);
+ vec3 window_q = clipToWindow(clipq, viewport);
vec3 tangent = window_q - window_p;
vec2 perp = normalize(vec2(-tangent.y, tangent.x));
- vec2 window_offset = perp * thickness;
+ vec2 offset = perp * thickness;
if (0 < perspective) {
// Perspective correction (lines will look thiner as they move away
// from the view position).
- gl_Position.xy = clip_p.xy + window_offset.xy;
- gl_Position.zw = clip_p.zw;
+ gl_Position.xy = clipp.xy + offset.xy;
+ gl_Position.zw = clipp.zw;
} else {
// No perspective correction.
- float clip_p_w = clip_p.w;
- vec4 offset_p = windowToClipVector(window_offset, viewport, clip_p_w);
- gl_Position = clip_p + offset_p;
+ vec4 offsetp = windowToClipVector(offset, viewport, clipp.w);
+ gl_Position = clipp + offsetp;
}
} else {
- gl_Position = clip_p;
+ gl_Position = clipp;
}
vertColor = color;
diff --git a/core/src/processing/opengl/MaskShaderFrag.glsl b/core/src/processing/opengl/MaskFrag.glsl
similarity index 100%
rename from core/src/processing/opengl/MaskShaderFrag.glsl
rename to core/src/processing/opengl/MaskFrag.glsl
diff --git a/core/src/processing/opengl/PGL.java b/core/src/processing/opengl/PGL.java
index 7d5ee9d0b..100d7e065 100644
--- a/core/src/processing/opengl/PGL.java
+++ b/core/src/processing/opengl/PGL.java
@@ -34,8 +34,6 @@ import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;
import java.util.Arrays;
-import java.util.Timer;
-import java.util.TimerTask;
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
@@ -63,7 +61,6 @@ import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.event.InputEvent;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.FBObject;
-import com.jogamp.opengl.util.AnimatorBase;
/**
* Processing-OpenGL abstraction layer.
@@ -134,6 +131,7 @@ public class PGL {
protected static final int NEWT = 1; // http://jogamp.org/jogl/doc/NEWT-Overview.html
protected static int toolkit;
+ protected static int events;
static {
if (PApplet.platform == PConstants.WINDOWS) {
// Using AWT on Windows because NEWT displays a black background while
@@ -143,20 +141,21 @@ public class PGL {
// but apparently nothing to set the cursor icon:
// https://jogamp.org/bugzilla/show_bug.cgi?id=409
toolkit = AWT;
+ events = AWT;
} else if (PApplet.platform == PConstants.MACOSX) {
// NEWT solves the issues with Java 7 and OS X 10.7+: calls to frame
// hanging the sketch, as well as cursor, etc.
toolkit = NEWT;
+ events = AWT;
} else if (PApplet.platform == PConstants.LINUX) {
toolkit = NEWT; // AWT extremely broken on Linux?
+ events = NEWT;
} else if (PApplet.platform == PConstants.OTHER) {
toolkit = NEWT; // NEWT should work on the Raspberry pi
+ events = NEWT;
}
}
- /** Enables/disables use of animator */
- protected static boolean useAnimator = false;
-
protected static int request_depth_bits = 24;
protected static int request_stencil_bits = 8;
protected static int request_alpha_bits = 8;
@@ -412,9 +411,6 @@ public class PGL {
/** The listener that fires the frame rendering in Processing */
protected static PGLListener listener;
- /** Animator to drive the rendering thread in NEWT */
- protected static PGLAnimator animator;
-
/** Desired target framerate */
protected float targetFramerate = 60;
protected boolean setFramerate = false;
@@ -585,18 +581,10 @@ public class PGL {
} else {
// Restarting...
if (canvasAWT != null) {
- if (useAnimator) {
- animator.stop();
- animator.remove(canvasAWT);
- }
canvasAWT.removeGLEventListener(listener);
pg.parent.removeListeners(canvasAWT);
pg.parent.remove(canvasAWT);
} else if (canvasNEWT != null) {
- if (useAnimator) {
- animator.stop();
- animator.remove(window);
- }
window.removeGLEventListener(listener);
pg.parent.remove(canvasNEWT);
}
@@ -641,10 +629,6 @@ public class PGL {
listener = new PGLListener();
canvasAWT.addGLEventListener(listener);
- if (useAnimator) {
- animator = new PGLAnimator(canvasAWT);
- animator.start();
- }
} else if (toolkit == NEWT) {
window = GLWindow.create(caps);
canvasNEWT = new NewtCanvasAWT(window);
@@ -652,27 +636,28 @@ public class PGL {
canvasNEWT.setBackground(new Color(pg.backgroundColor, true));
canvasNEWT.setFocusable(true);
- NEWTMouseListener mouseListener = new NEWTMouseListener();
- window.addMouseListener(mouseListener);
- NEWTKeyListener keyListener = new NEWTKeyListener();
- window.addKeyListener(keyListener);
- NEWTWindowListener winListener = new NEWTWindowListener();
- window.addWindowListener(winListener);
- canvasNEWT.addFocusListener(pg.parent); // So focus detection work.
-
pg.parent.setLayout(new BorderLayout());
pg.parent.add(canvasNEWT, BorderLayout.CENTER);
+ if (events == NEWT) {
+ NEWTMouseListener mouseListener = new NEWTMouseListener();
+ window.addMouseListener(mouseListener);
+ NEWTKeyListener keyListener = new NEWTKeyListener();
+ window.addKeyListener(keyListener);
+ NEWTWindowListener winListener = new NEWTWindowListener();
+ window.addWindowListener(winListener);
+ canvasNEWT.addFocusListener(pg.parent); // So focus detection work.
+ } else if (events == AWT) {
+ pg.parent.removeListeners(canvasNEWT);
+ pg.parent.addListeners(canvasNEWT);
+ }
+
capabilities = window.getChosenGLCapabilities();
canvas = canvasNEWT;
canvasAWT = null;
listener = new PGLListener();
window.addGLEventListener(listener);
- if (useAnimator) {
- animator = new PGLAnimator(window);
- animator.start();
- }
}
fboLayerCreated = false;
@@ -1189,14 +1174,10 @@ public class PGL {
protected void requestDraw() {
if (pg.initialized) {
try {
- if (useAnimator) {
- animator.requestDisplay();
- } else {
- if (toolkit == AWT) {
- canvasAWT.display();
- } else if (toolkit == NEWT) {
- window.display();
- }
+ if (toolkit == AWT) {
+ canvasAWT.display();
+ } else if (toolkit == NEWT) {
+ window.display();
}
} catch (GLException e) {
// Unwrap GLException so that only the causing exception is shown.
@@ -3277,7 +3258,6 @@ public class PGL {
protected void nativeMouseEvent(com.jogamp.newt.event.MouseEvent nativeEvent,
int peAction) {
-// if (!hasFocus) return;
int modifiers = nativeEvent.getModifiers();
int peModifiers = modifiers &
(InputEvent.SHIFT_MASK |
@@ -3337,40 +3317,31 @@ public class PGL {
pg.parent.postEvent(ke);
}
- boolean hasFocus = true;
class NEWTWindowListener implements com.jogamp.newt.event.WindowListener {
@Override
public void windowGainedFocus(com.jogamp.newt.event.WindowEvent arg0) {
- PApplet.println("window gained focus");
pg.parent.focusGained(null);
- hasFocus = true;
}
@Override
public void windowLostFocus(com.jogamp.newt.event.WindowEvent arg0) {
- PApplet.println("window lost focus");
pg.parent.focusLost(null);
- hasFocus = false;
}
@Override
public void windowDestroyNotify(com.jogamp.newt.event.WindowEvent arg0) {
- PApplet.println("destroy");
}
@Override
public void windowDestroyed(com.jogamp.newt.event.WindowEvent arg0) {
- PApplet.println("destroyed");
}
@Override
public void windowMoved(com.jogamp.newt.event.WindowEvent arg0) {
- PApplet.println("moved");
}
@Override
public void windowRepaint(com.jogamp.newt.event.WindowUpdateEvent arg0) {
- PApplet.println("window repaint");
}
@Override
@@ -3379,54 +3350,36 @@ public class PGL {
// NEWT mouse listener
class NEWTMouseListener extends com.jogamp.newt.event.MouseAdapter {
- boolean pointerInside = false;
-
@Override
public void mousePressed(com.jogamp.newt.event.MouseEvent e) {
- if (pointerInside) {
- nativeMouseEvent(e, MouseEvent.PRESS);
- }
+ nativeMouseEvent(e, MouseEvent.PRESS);
}
@Override
public void mouseReleased(com.jogamp.newt.event.MouseEvent e) {
- if (pointerInside) {
- nativeMouseEvent(e, MouseEvent.RELEASE);
- }
+ nativeMouseEvent(e, MouseEvent.RELEASE);
}
@Override
public void mouseClicked(com.jogamp.newt.event.MouseEvent e) {
- if (pointerInside) {
- nativeMouseEvent(e, MouseEvent.CLICK);
- }
+ nativeMouseEvent(e, MouseEvent.CLICK);
}
@Override
public void mouseDragged(com.jogamp.newt.event.MouseEvent e) {
- if (pointerInside) {
- nativeMouseEvent(e, MouseEvent.DRAG);
- }
+ nativeMouseEvent(e, MouseEvent.DRAG);
}
@Override
public void mouseMoved(com.jogamp.newt.event.MouseEvent e) {
- if (pointerInside) {
- nativeMouseEvent(e, MouseEvent.MOVE);
- }
+ nativeMouseEvent(e, MouseEvent.MOVE);
}
@Override
public void mouseWheelMoved(com.jogamp.newt.event.MouseEvent e) {
- if (pointerInside) {
- nativeMouseEvent(e, MouseEvent.WHEEL);
- }
+ nativeMouseEvent(e, MouseEvent.WHEEL);
}
@Override
public void mouseEntered(com.jogamp.newt.event.MouseEvent e) {
- PApplet.println("mouse entered");
- pointerInside = true;
nativeMouseEvent(e, MouseEvent.ENTER);
}
@Override
public void mouseExited(com.jogamp.newt.event.MouseEvent e) {
- PApplet.println("mouse exited");
- pointerInside = false;
nativeMouseEvent(e, MouseEvent.EXIT);
}
}
@@ -3446,141 +3399,4 @@ public class PGL {
nativeKeyEvent(e, KeyEvent.TYPE);
}
}
-
- // Animator to drive render loop when using NEWT.
- protected static class PGLAnimator extends AnimatorBase {
- private static int count = 0;
- private Timer timer = null;
- private Task task = null;
-
- @Override
- protected String getBaseName(String prefix) {
- return prefix + "PGLAnimator";
- }
-
- /** Creates an CustomAnimator with an initial drawable to
- * animate.
- */
- public PGLAnimator(GLAutoDrawable drawable) {
- if (drawable != null) {
- add(drawable);
- }
- }
-
- public void requestDisplay() {
- if (task != null) {
- task.shouldRun();
- }
- }
-
- @Override
- public final boolean isStarted() {
- stateSync.lock();
- try {
- return (timer != null);
- } finally {
- stateSync.unlock();
- }
- }
-
- public final boolean isAnimating() {
- stateSync.lock();
- try {
- return (timer != null) && (task != null);
- } finally {
- stateSync.unlock();
- }
- }
-
- private void startTask() {
- if (null != task) {
- return;
- }
-
- task = new Task();
- fpsCounter.resetFPSCounter();
- timer.schedule(task, 0, 1);
- }
-
- public synchronized boolean start() {
- if (timer != null) {
- return false;
- }
- stateSync.lock();
- try {
- timer = new Timer();
- startTask();
- } finally {
- stateSync.unlock();
- }
- return true;
- }
-
- /** Stops this CustomAnimator. */
- public synchronized boolean stop() {
- if (timer == null) {
- return false;
- }
- stateSync.lock();
- try {
- if (null != task) {
- task.cancel();
- task = null;
- }
- if (null != timer) {
- timer.cancel();
- timer = null;
- }
- animThread = null;
- try {
- Thread.sleep(20); // ~ 1/60 hz wait, since we can't ctrl stopped threads
- } catch (InterruptedException e) { }
- } finally {
- stateSync.unlock();
- }
- return true;
- }
-
- public final boolean isPaused() { return false; }
- public synchronized boolean resume() { return false; }
- public synchronized boolean pause() { return false; }
-
- private class Task extends TimerTask {
- private boolean firstRun = true;
- private boolean shouldRun = false;
-
- public void shouldRun() {
- synchronized (this) {
- shouldRun = true;
- }
- }
-
- @Override
- public void run() {
- if (firstRun) {
- Thread.currentThread().setName("PGL-RenderQueue-" + count);
- firstRun = false;
- count++;
- }
- if (shouldRun) {
- PGLAnimator.this.animThread = Thread.currentThread();
- // display impl. uses synchronized block on the animator instance
- display();
- synchronized (this) {
- // done with current frame.
- shouldRun = false;
- }
- }
- }
-
- @Override
- public boolean cancel() {
- synchronized (this) {
- // done with current frame.
- shouldRun = false;
- }
- return super.cancel();
- }
- }
- }
}
diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java
index ac821fa81..8f3007cfd 100644
--- a/core/src/processing/opengl/PGraphicsOpenGL.java
+++ b/core/src/processing/opengl/PGraphicsOpenGL.java
@@ -209,42 +209,42 @@ public class PGraphicsOpenGL extends PGraphics {
// Shaders
- static protected URL defPolyColorShaderVertURL =
- PGraphicsOpenGL.class.getResource("PolyColorShaderVert.glsl");
- static protected URL defPolyTexShaderVertURL =
- PGraphicsOpenGL.class.getResource("PolyTexShaderVert.glsl");
- static protected URL defPolyLightShaderVertURL =
- PGraphicsOpenGL.class.getResource("PolyLightShaderVert.glsl");
- static protected URL defPolyTexlightShaderVertURL =
- PGraphicsOpenGL.class.getResource("PolyTexlightShaderVert.glsl");
- static protected URL defPolyNoTexShaderFragURL =
- PGraphicsOpenGL.class.getResource("PolyNoTexShaderFrag.glsl");
- static protected URL defPolyTexShaderFragURL =
- PGraphicsOpenGL.class.getResource("PolyTexShaderFrag.glsl");
+ static protected URL defColorShaderVertURL =
+ PGraphicsOpenGL.class.getResource("ColorVert.glsl");
+ static protected URL defTextureShaderVertURL =
+ PGraphicsOpenGL.class.getResource("TextureVert.glsl");
+ static protected URL defLightShaderVertURL =
+ PGraphicsOpenGL.class.getResource("LightVert.glsl");
+ static protected URL defTexlightShaderVertURL =
+ PGraphicsOpenGL.class.getResource("TexlightVert.glsl");
+ static protected URL defColorShaderFragURL =
+ PGraphicsOpenGL.class.getResource("ColorFrag.glsl");
+ static protected URL defTextureShaderFragURL =
+ PGraphicsOpenGL.class.getResource("TextureFrag.glsl");
static protected URL defLineShaderVertURL =
- PGraphicsOpenGL.class.getResource("LineShaderVert.glsl");
+ PGraphicsOpenGL.class.getResource("LineVert.glsl");
static protected URL defLineShaderFragURL =
- PGraphicsOpenGL.class.getResource("LineShaderFrag.glsl");
+ PGraphicsOpenGL.class.getResource("LineFrag.glsl");
static protected URL defPointShaderVertURL =
- PGraphicsOpenGL.class.getResource("PointShaderVert.glsl");
+ PGraphicsOpenGL.class.getResource("PointVert.glsl");
static protected URL defPointShaderFragURL =
- PGraphicsOpenGL.class.getResource("PointShaderFrag.glsl");
+ PGraphicsOpenGL.class.getResource("PointFrag.glsl");
- static protected PolyColorShader defPolyColorShader;
- static protected PolyTexShader defPolyTexShader;
- static protected PolyLightShader defPolyLightShader;
- static protected PolyTexlightShader defPolyTexlightShader;
+ static protected ColorShader defColorShader;
+ static protected TexureShader defTextureShader;
+ static protected LightShader defLightShader;
+ static protected TexlightShader defTexlightShader;
static protected LineShader defLineShader;
static protected PointShader defPointShader;
static protected URL maskShaderFragURL =
- PGraphicsOpenGL.class.getResource("MaskShaderFrag.glsl");
- static protected PolyTexShader maskShader;
+ PGraphicsOpenGL.class.getResource("MaskFrag.glsl");
+ static protected TexureShader maskShader;
- protected PolyColorShader polyColorShader;
- protected PolyTexShader polyTexShader;
- protected PolyLightShader polyLightShader;
- protected PolyTexlightShader polyTexlightShader;
+ protected ColorShader colorShader;
+ protected TexureShader textureShader;
+ protected LightShader lightShader;
+ protected TexlightShader texlightShader;
protected LineShader lineShader;
protected PointShader pointShader;
@@ -1397,10 +1397,10 @@ public class PGraphicsOpenGL extends PGraphics {
pgl.bufferData(PGL.ARRAY_BUFFER, sizei,
tessGeo.lineColorsBuffer, PGL.STATIC_DRAW);
- tessGeo.updateLineAttribsBuffer();
+ tessGeo.updateLineDirectionsBuffer();
pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineAttrib);
pgl.bufferData(PGL.ARRAY_BUFFER, 4 * sizef,
- tessGeo.lineAttribsBuffer, PGL.STATIC_DRAW);
+ tessGeo.lineDirectionsBuffer, PGL.STATIC_DRAW);
tessGeo.updateLineIndicesBuffer();
pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glLineIndex);
@@ -1490,10 +1490,10 @@ public class PGraphicsOpenGL extends PGraphics {
pgl.bufferData(PGL.ARRAY_BUFFER, sizei,
tessGeo.pointColorsBuffer, PGL.STATIC_DRAW);
- tessGeo.updatePointAttribsBuffer();
+ tessGeo.updatePointOffsetsBuffer();
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointAttrib);
pgl.bufferData(PGL.ARRAY_BUFFER, 2 * sizef,
- tessGeo.pointAttribsBuffer, PGL.STATIC_DRAW);
+ tessGeo.pointOffsetsBuffer, PGL.STATIC_DRAW);
tessGeo.updatePointIndicesBuffer();
pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glPointIndex);
@@ -2511,7 +2511,7 @@ public class PGraphicsOpenGL extends PGraphics {
float[] vertices = tessGeo.lineVertices;
int[] color = tessGeo.lineColors;
- float[] attribs = tessGeo.lineAttribs;
+ float[] attribs = tessGeo.lineDirections;
short[] indices = tessGeo.lineIndices;
IndexCache cache = tessGeo.lineIndexCache;
@@ -2614,7 +2614,7 @@ public class PGraphicsOpenGL extends PGraphics {
float[] vertices = tessGeo.pointVertices;
int[] color = tessGeo.pointColors;
- float[] attribs = tessGeo.pointAttribs;
+ float[] attribs = tessGeo.pointOffsets;
short[] indices = tessGeo.pointIndices;
IndexCache cache = tessGeo.pointIndexCache;
@@ -5321,7 +5321,7 @@ public class PGraphicsOpenGL extends PGraphics {
}
if (maskShader == null) {
- maskShader = new PolyTexShader(parent, defPolyTexShaderVertURL,
+ maskShader = new TexureShader(parent, defTextureShaderVertURL,
maskShaderFragURL);
}
maskShader.set("mask", alpha);
@@ -5363,7 +5363,7 @@ public class PGraphicsOpenGL extends PGraphics {
@Override
public void filter(PShader shader) {
- if (!(shader instanceof PolyTexShader)) {
+ if (!(shader instanceof TexureShader)) {
PGraphics.showWarning(INVALID_FILTER_SHADER_ERROR);
return;
}
@@ -5399,8 +5399,8 @@ public class PGraphicsOpenGL extends PGraphics {
stroke = false;
// int prevBlendMode = blendMode;
// blendMode(REPLACE);
- PolyTexShader prevTexShader = polyTexShader;
- polyTexShader = (PolyTexShader) shader;
+ TexureShader prevTexShader = textureShader;
+ textureShader = (TexureShader) shader;
beginShape(QUADS);
texture(filterImage);
vertex(0, 0, 0, 0);
@@ -5410,7 +5410,7 @@ public class PGraphicsOpenGL extends PGraphics {
endShape();
end2D();
- polyTexShader = prevTexShader;
+ textureShader = prevTexShader;
// Restoring previous configuration.
stroke = prevStroke;
@@ -6141,17 +6141,17 @@ public class PGraphicsOpenGL extends PGraphics {
shader = new LineShader(parent);
shader.setVertexShader(defLineShaderVertURL);
} else if (shaderType == PShader.TEXLIGHT) {
- shader = new PolyTexlightShader(parent);
- shader.setVertexShader(defPolyTexlightShaderVertURL);
+ shader = new TexlightShader(parent);
+ shader.setVertexShader(defTexlightShaderVertURL);
} else if (shaderType == PShader.LIGHT) {
- shader = new PolyLightShader(parent);
- shader.setVertexShader(defPolyLightShaderVertURL);
+ shader = new LightShader(parent);
+ shader.setVertexShader(defLightShaderVertURL);
} else if (shaderType == PShader.TEXTURE) {
- shader = new PolyTexShader(parent);
- shader.setVertexShader(defPolyTexShaderVertURL);
+ shader = new TexureShader(parent);
+ shader.setVertexShader(defTextureShaderVertURL);
} else if (shaderType == PShader.COLOR) {
- shader = new PolyColorShader(parent);
- shader.setVertexShader(defPolyColorShaderVertURL);
+ shader = new ColorShader(parent);
+ shader.setVertexShader(defColorShaderVertURL);
}
shader.setFragmentShader(fragFilename);
return shader;
@@ -6178,17 +6178,17 @@ public class PGraphicsOpenGL extends PGraphics {
shader = new LineShader(parent);
shader.setFragmentShader(defLineShaderFragURL);
} else if (shaderType == PShader.TEXLIGHT) {
- shader = new PolyTexlightShader(parent);
- shader.setFragmentShader(defPolyTexShaderFragURL);
+ shader = new TexlightShader(parent);
+ shader.setFragmentShader(defTextureShaderFragURL);
} else if (shaderType == PShader.LIGHT) {
- shader = new PolyLightShader(parent);
- shader.setFragmentShader(defPolyNoTexShaderFragURL);
+ shader = new LightShader(parent);
+ shader.setFragmentShader(defColorShaderFragURL);
} else if (shaderType == PShader.TEXTURE) {
- shader = new PolyTexShader(parent);
- shader.setFragmentShader(defPolyTexShaderFragURL);
+ shader = new TexureShader(parent);
+ shader.setFragmentShader(defTextureShaderFragURL);
} else if (shaderType == PShader.COLOR) {
- shader = new PolyColorShader(parent);
- shader.setFragmentShader(defPolyNoTexShaderFragURL);
+ shader = new ColorShader(parent);
+ shader.setFragmentShader(defColorShaderFragURL);
}
if (shader != null) {
shader.setVertexShader(vertFilename);
@@ -6199,13 +6199,13 @@ public class PGraphicsOpenGL extends PGraphics {
} else if (shaderType == PShader.LINE) {
shader = new LineShader(parent, vertFilename, fragFilename);
} else if (shaderType == PShader.TEXLIGHT) {
- shader = new PolyTexlightShader(parent, vertFilename, fragFilename);
+ shader = new TexlightShader(parent, vertFilename, fragFilename);
} else if (shaderType == PShader.LIGHT) {
- shader = new PolyLightShader(parent, vertFilename, fragFilename);
+ shader = new LightShader(parent, vertFilename, fragFilename);
} else if (shaderType == PShader.TEXTURE) {
- shader = new PolyTexShader(parent, vertFilename, fragFilename);
+ shader = new TexureShader(parent, vertFilename, fragFilename);
} else if (shaderType == PShader.COLOR) {
- shader = new PolyColorShader(parent, vertFilename, fragFilename);
+ shader = new ColorShader(parent, vertFilename, fragFilename);
}
}
return shader;
@@ -6223,14 +6223,14 @@ public class PGraphicsOpenGL extends PGraphics {
flush(); // Flushing geometry drawn with a different shader.
if (kind == TRIANGLES || kind == QUADS || kind == POLYGON) {
- if (shader instanceof PolyTexShader) {
- polyTexShader = (PolyTexShader) shader;
- } else if (shader instanceof PolyColorShader) {
- polyColorShader = (PolyColorShader) shader;
- } else if (shader instanceof PolyTexlightShader) {
- polyTexlightShader = (PolyTexlightShader) shader;
- } else if (shader instanceof PolyLightShader) {
- polyLightShader = (PolyLightShader) shader;
+ if (shader instanceof TexureShader) {
+ textureShader = (TexureShader) shader;
+ } else if (shader instanceof ColorShader) {
+ colorShader = (ColorShader) shader;
+ } else if (shader instanceof TexlightShader) {
+ texlightShader = (TexlightShader) shader;
+ } else if (shader instanceof LightShader) {
+ lightShader = (LightShader) shader;
} else {
PGraphics.showWarning(WRONG_SHADER_TYPE_ERROR);
}
@@ -6263,10 +6263,10 @@ public class PGraphicsOpenGL extends PGraphics {
flush(); // Flushing geometry drawn with a different shader.
if (kind == TRIANGLES || kind == QUADS || kind == POLYGON) {
- polyTexShader = null;
- polyColorShader = null;
- polyTexlightShader = null;
- polyLightShader = null;
+ textureShader = null;
+ colorShader = null;
+ texlightShader = null;
+ lightShader = null;
} else if (kind == LINES) {
lineShader = null;
} else if (kind == POINTS) {
@@ -6308,10 +6308,10 @@ public class PGraphicsOpenGL extends PGraphics {
// The default shaders contains references to the PGraphics object that
// creates them, so when restarting the renderer, those references should
// dissapear.
- defPolyColorShader = null;
- defPolyTexShader = null;
- defPolyLightShader = null;
- defPolyTexlightShader = null;
+ defColorShader = null;
+ defTextureShader = null;
+ defLightShader = null;
+ defTexlightShader = null;
defLineShader = null;
defPointShader = null;
maskShader = null;
@@ -6322,54 +6322,54 @@ public class PGraphicsOpenGL extends PGraphics {
BaseShader shader;
if (lit) {
if (tex) {
- if (polyTexlightShader == null) {
- if (defPolyTexlightShader == null) {
- defPolyTexlightShader = new PolyTexlightShader(parent,
- defPolyTexlightShaderVertURL,
- defPolyTexShaderFragURL);
+ if (texlightShader == null) {
+ if (defTexlightShader == null) {
+ defTexlightShader = new TexlightShader(parent,
+ defTexlightShaderVertURL,
+ defTextureShaderFragURL);
}
- shader = defPolyTexlightShader;
+ shader = defTexlightShader;
texlightShaderCheck();
} else {
- shader = polyTexlightShader;
+ shader = texlightShader;
}
} else {
- if (polyLightShader == null) {
- if (defPolyLightShader == null) {
- defPolyLightShader = new PolyLightShader(parent,
- defPolyLightShaderVertURL,
- defPolyNoTexShaderFragURL);
+ if (lightShader == null) {
+ if (defLightShader == null) {
+ defLightShader = new LightShader(parent,
+ defLightShaderVertURL,
+ defColorShaderFragURL);
}
- shader = defPolyLightShader;
+ shader = defLightShader;
lightShaderCheck();
} else {
- shader = polyLightShader;
+ shader = lightShader;
}
}
} else {
if (tex) {
- if (polyTexShader == null) {
- if (defPolyTexShader == null) {
- defPolyTexShader = new PolyTexShader(parent,
- defPolyTexShaderVertURL,
- defPolyTexShaderFragURL);
+ if (textureShader == null) {
+ if (defTextureShader == null) {
+ defTextureShader = new TexureShader(parent,
+ defTextureShaderVertURL,
+ defTextureShaderFragURL);
}
- shader = defPolyTexShader;
- texShaderCheck();
+ shader = defTextureShader;
+ textureShaderCheck();
} else {
- shader = polyTexShader;
+ shader = textureShader;
}
} else {
- if (polyColorShader == null) {
- if (defPolyColorShader == null) {
- defPolyColorShader = new PolyColorShader(parent,
- defPolyColorShaderVertURL,
- defPolyNoTexShaderFragURL);
+ if (colorShader == null) {
+ if (defColorShader == null) {
+ defColorShader = new ColorShader(parent,
+ defColorShaderVertURL,
+ defColorShaderFragURL);
}
- shader = defPolyColorShader;
+ shader = defColorShader;
colorShaderCheck();
} else {
- shader = polyColorShader;
+ shader = colorShader;
}
}
}
@@ -6382,9 +6382,9 @@ public class PGraphicsOpenGL extends PGraphics {
protected void texlightShaderCheck() {
if (shaderWarningsEnabled &&
- (polyLightShader != null ||
- polyTexShader != null ||
- polyColorShader != null)) {
+ (lightShader != null ||
+ textureShader != null ||
+ colorShader != null)) {
PGraphics.showWarning(NO_TEXLIGHT_SHADER_ERROR);
}
}
@@ -6392,19 +6392,19 @@ public class PGraphicsOpenGL extends PGraphics {
protected void lightShaderCheck() {
if (shaderWarningsEnabled &&
- (polyTexlightShader != null ||
- polyTexShader != null ||
- polyColorShader != null)) {
+ (texlightShader != null ||
+ textureShader != null ||
+ colorShader != null)) {
PGraphics.showWarning(NO_LIGHT_SHADER_ERROR);
}
}
- protected void texShaderCheck() {
+ protected void textureShaderCheck() {
if (shaderWarningsEnabled &&
- (polyTexlightShader != null ||
- polyLightShader != null ||
- polyColorShader != null)) {
+ (texlightShader != null ||
+ lightShader != null ||
+ colorShader != null)) {
PGraphics.showWarning(NO_TEXTURE_SHADER_ERROR);
}
}
@@ -6412,9 +6412,9 @@ public class PGraphicsOpenGL extends PGraphics {
protected void colorShaderCheck() {
if (shaderWarningsEnabled &&
- (polyTexlightShader != null ||
- polyLightShader != null ||
- polyTexShader != null)) {
+ (texlightShader != null ||
+ lightShader != null ||
+ textureShader != null)) {
PGraphics.showWarning(NO_COLOR_SHADER_ERROR);
}
}
@@ -6549,20 +6549,20 @@ public class PGraphicsOpenGL extends PGraphics {
}
- protected class PolyColorShader extends BaseShader {
+ protected class ColorShader extends BaseShader {
protected int vertexLoc;
protected int colorLoc;
- public PolyColorShader(PApplet parent) {
+ public ColorShader(PApplet parent) {
super(parent);
}
- public PolyColorShader(PApplet parent, String vertFilename,
+ public ColorShader(PApplet parent, String vertFilename,
String fragFilename) {
super(parent, vertFilename, fragFilename);
}
- public PolyColorShader(PApplet parent, URL vertURL, URL fragURL) {
+ public ColorShader(PApplet parent, URL vertURL, URL fragURL) {
super(parent, vertURL, fragURL);
}
@@ -6599,7 +6599,7 @@ public class PGraphicsOpenGL extends PGraphics {
}
if (-1 < vertexLoc) pgl.enableVertexAttribArray(vertexLoc);
- if (-1 < colorLoc) pgl.enableVertexAttribArray(colorLoc);
+ if (-1 < colorLoc) pgl.enableVertexAttribArray(colorLoc);
setCommonUniforms();
}
@@ -6607,14 +6607,14 @@ public class PGraphicsOpenGL extends PGraphics {
@Override
public void unbind() {
if (-1 < vertexLoc) pgl.disableVertexAttribArray(vertexLoc);
- if (-1 < colorLoc) pgl.disableVertexAttribArray(colorLoc);
+ if (-1 < colorLoc) pgl.disableVertexAttribArray(colorLoc);
super.unbind();
}
}
- protected class PolyLightShader extends BaseShader {
+ protected class LightShader extends BaseShader {
protected int normalMatrixLoc;
protected int lightCountLoc;
@@ -6635,16 +6635,16 @@ public class PGraphicsOpenGL extends PGraphics {
protected int emissiveLoc;
protected int shininessLoc;
- public PolyLightShader(PApplet parent) {
+ public LightShader(PApplet parent) {
super(parent);
}
- public PolyLightShader(PApplet parent, String vertFilename,
+ public LightShader(PApplet parent, String vertFilename,
String fragFilename) {
super(parent, vertFilename, fragFilename);
}
- public PolyLightShader(PApplet parent, URL vertURL, URL fragURL) {
+ public LightShader(PApplet parent, URL vertURL, URL fragURL) {
super(parent, vertURL, fragURL);
}
@@ -6728,13 +6728,13 @@ public class PGraphicsOpenGL extends PGraphics {
}
if (-1 < vertexLoc) pgl.enableVertexAttribArray(vertexLoc);
- if (-1 < colorLoc) pgl.enableVertexAttribArray(colorLoc);
+ if (-1 < colorLoc) pgl.enableVertexAttribArray(colorLoc);
if (-1 < normalLoc) pgl.enableVertexAttribArray(normalLoc);
- if (-1 < ambientLoc) pgl.enableVertexAttribArray(ambientLoc);
+ if (-1 < ambientLoc) pgl.enableVertexAttribArray(ambientLoc);
if (-1 < specularLoc) pgl.enableVertexAttribArray(specularLoc);
if (-1 < emissiveLoc) pgl.enableVertexAttribArray(emissiveLoc);
- if (-1 < shininessLoc) pgl.enableVertexAttribArray(shininessLoc);
+ if (-1 < shininessLoc) pgl.enableVertexAttribArray(shininessLoc);
if (-1 < normalMatrixLoc) {
pgCurrent.updateGLNormal();
@@ -6748,10 +6748,9 @@ public class PGraphicsOpenGL extends PGraphics {
setUniformVector(lightAmbientLoc, pgCurrent.lightAmbient, 3, count);
setUniformVector(lightDiffuseLoc, pgCurrent.lightDiffuse, 3, count);
setUniformVector(lightSpecularLoc, pgCurrent.lightSpecular, 3, count);
- setUniformVector(lightFalloffLoc,
- pgCurrent.lightFalloffCoefficients, 3, count);
- setUniformVector(lightSpotLoc,
- pgCurrent.lightSpotParameters, 2, count);
+ setUniformVector(lightFalloffLoc, pgCurrent.lightFalloffCoefficients,
+ 3, count);
+ setUniformVector(lightSpotLoc, pgCurrent.lightSpotParameters, 2, count);
setCommonUniforms();
}
@@ -6759,10 +6758,10 @@ public class PGraphicsOpenGL extends PGraphics {
@Override
public void unbind() {
if (-1 < vertexLoc) pgl.disableVertexAttribArray(vertexLoc);
- if (-1 < colorLoc) pgl.disableVertexAttribArray(colorLoc);
+ if (-1 < colorLoc) pgl.disableVertexAttribArray(colorLoc);
if (-1 < normalLoc) pgl.disableVertexAttribArray(normalLoc);
- if (-1 < ambientLoc) pgl.disableVertexAttribArray(ambientLoc);
+ if (-1 < ambientLoc) pgl.disableVertexAttribArray(ambientLoc);
if (-1 < specularLoc) pgl.disableVertexAttribArray(specularLoc);
if (-1 < emissiveLoc) pgl.disableVertexAttribArray(emissiveLoc);
if (-1 < shininessLoc) pgl.disableVertexAttribArray(shininessLoc);
@@ -6772,7 +6771,7 @@ public class PGraphicsOpenGL extends PGraphics {
}
- protected class PolyTexShader extends PolyColorShader {
+ protected class TexureShader extends ColorShader {
protected int texCoordLoc;
protected int textureLoc;
@@ -6781,16 +6780,16 @@ public class PGraphicsOpenGL extends PGraphics {
protected float[] tcmat;
- public PolyTexShader(PApplet parent) {
+ public TexureShader(PApplet parent) {
super(parent);
}
- public PolyTexShader(PApplet parent, String vertFilename,
+ public TexureShader(PApplet parent, String vertFilename,
String fragFilename) {
super(parent, vertFilename, fragFilename);
}
- public PolyTexShader(PApplet parent, URL vertURL, URL fragURL) {
+ public TexureShader(PApplet parent, URL vertURL, URL fragURL) {
super(parent, vertURL, fragURL);
}
@@ -6872,7 +6871,7 @@ public class PGraphicsOpenGL extends PGraphics {
}
- protected class PolyTexlightShader extends PolyLightShader {
+ protected class TexlightShader extends LightShader {
protected int texCoordLoc;
protected int textureLoc;
@@ -6881,16 +6880,16 @@ public class PGraphicsOpenGL extends PGraphics {
protected float[] tcmat;
- public PolyTexlightShader(PApplet parent) {
+ public TexlightShader(PApplet parent) {
super(parent);
}
- public PolyTexlightShader(PApplet parent, String vertFilename,
+ public TexlightShader(PApplet parent, String vertFilename,
String fragFilename) {
super(parent, vertFilename, fragFilename);
}
- public PolyTexlightShader(PApplet parent, URL vertURL, URL fragURL) {
+ public TexlightShader(PApplet parent, URL vertURL, URL fragURL) {
super(parent, vertURL, fragURL);
}
@@ -6978,7 +6977,7 @@ public class PGraphicsOpenGL extends PGraphics {
protected int vertexLoc;
protected int colorLoc;
- protected int endpointLoc;
+ protected int directionLoc;
public LineShader(PApplet parent) {
super(parent);
@@ -6997,7 +6996,7 @@ public class PGraphicsOpenGL extends PGraphics {
public void loadAttributes() {
vertexLoc = getAttributeLoc("vertex");
colorLoc = getAttributeLoc("color");
- endpointLoc = getAttributeLoc("endpoint");
+ directionLoc = getAttributeLoc("direction");
}
@Override
@@ -7023,7 +7022,7 @@ public class PGraphicsOpenGL extends PGraphics {
public void setLineAttribute(int vboId, int size, int type,
int stride, int offset) {
- setAttributeVBO(endpointLoc, vboId, size, type, false, stride, offset);
+ setAttributeVBO(directionLoc, vboId, size, type, false, stride, offset);
}
@Override
@@ -7036,8 +7035,8 @@ public class PGraphicsOpenGL extends PGraphics {
}
if (-1 < vertexLoc) pgl.enableVertexAttribArray(vertexLoc);
- if (-1 < colorLoc) pgl.enableVertexAttribArray(colorLoc);
- if (-1 < endpointLoc) pgl.enableVertexAttribArray(endpointLoc);
+ if (-1 < colorLoc) pgl.enableVertexAttribArray(colorLoc);
+ if (-1 < directionLoc) pgl.enableVertexAttribArray(directionLoc);
if (pgCurrent.getHint(ENABLE_STROKE_PERSPECTIVE) &&
pgCurrent.nonOrthoProjection()) {
@@ -7062,8 +7061,8 @@ public class PGraphicsOpenGL extends PGraphics {
@Override
public void unbind() {
if (-1 < vertexLoc) pgl.disableVertexAttribArray(vertexLoc);
- if (-1 < colorLoc) pgl.disableVertexAttribArray(colorLoc);
- if (-1 < endpointLoc) pgl.disableVertexAttribArray(endpointLoc);
+ if (-1 < colorLoc) pgl.disableVertexAttribArray(colorLoc);
+ if (-1 < directionLoc) pgl.disableVertexAttribArray(directionLoc);
super.unbind();
}
@@ -7131,8 +7130,8 @@ public class PGraphicsOpenGL extends PGraphics {
}
if (-1 < vertexLoc) pgl.enableVertexAttribArray(vertexLoc);
- if (-1 < colorLoc) pgl.enableVertexAttribArray(colorLoc);
- if (-1 < offsetLoc) pgl.enableVertexAttribArray(offsetLoc);
+ if (-1 < colorLoc) pgl.enableVertexAttribArray(colorLoc);
+ if (-1 < offsetLoc) pgl.enableVertexAttribArray(offsetLoc);
if (pgCurrent.getHint(ENABLE_STROKE_PERSPECTIVE) &&
pgCurrent.nonOrthoProjection()) {
@@ -7147,8 +7146,8 @@ public class PGraphicsOpenGL extends PGraphics {
@Override
public void unbind() {
if (-1 < vertexLoc) pgl.disableVertexAttribArray(vertexLoc);
- if (-1 < colorLoc) pgl.disableVertexAttribArray(colorLoc);
- if (-1 < offsetLoc) pgl.disableVertexAttribArray(offsetLoc);
+ if (-1 < colorLoc) pgl.disableVertexAttribArray(colorLoc);
+ if (-1 < offsetLoc) pgl.disableVertexAttribArray(offsetLoc);
super.unbind();
}
@@ -8894,7 +8893,7 @@ public class PGraphicsOpenGL extends PGraphics {
int lastLineVertex;
FloatBuffer lineVerticesBuffer;
IntBuffer lineColorsBuffer;
- FloatBuffer lineAttribsBuffer;
+ FloatBuffer lineDirectionsBuffer;
int lineIndexCount;
int firstLineIndex;
@@ -8908,7 +8907,7 @@ public class PGraphicsOpenGL extends PGraphics {
int lastPointVertex;
FloatBuffer pointVerticesBuffer;
IntBuffer pointColorsBuffer;
- FloatBuffer pointAttribsBuffer;
+ FloatBuffer pointOffsetsBuffer;
int pointIndexCount;
int firstPointIndex;
@@ -8928,11 +8927,11 @@ public class PGraphicsOpenGL extends PGraphics {
short[] polyIndices;
float[] lineVertices;
int[] lineColors;
- float[] lineAttribs;
+ float[] lineDirections;
short[] lineIndices;
float[] pointVertices;
int[] pointColors;
- float[] pointAttribs;
+ float[] pointOffsets;
short[] pointIndices;
TessGeometry(int mode) {
@@ -8957,12 +8956,12 @@ public class PGraphicsOpenGL extends PGraphics {
lineVertices = new float[4 * PGL.DEFAULT_TESS_VERTICES];
lineColors = new int[PGL.DEFAULT_TESS_VERTICES];
- lineAttribs = new float[4 * PGL.DEFAULT_TESS_VERTICES];
+ lineDirections = new float[4 * PGL.DEFAULT_TESS_VERTICES];
lineIndices = new short[PGL.DEFAULT_TESS_VERTICES];
pointVertices = new float[4 * PGL.DEFAULT_TESS_VERTICES];
pointColors = new int[PGL.DEFAULT_TESS_VERTICES];
- pointAttribs = new float[2 * PGL.DEFAULT_TESS_VERTICES];
+ pointOffsets = new float[2 * PGL.DEFAULT_TESS_VERTICES];
pointIndices = new short[PGL.DEFAULT_TESS_VERTICES];
polyVerticesBuffer = PGL.allocateFloatBuffer(polyVertices);
@@ -8977,12 +8976,12 @@ public class PGraphicsOpenGL extends PGraphics {
lineVerticesBuffer = PGL.allocateFloatBuffer(lineVertices);
lineColorsBuffer = PGL.allocateIntBuffer(lineColors);
- lineAttribsBuffer = PGL.allocateFloatBuffer(lineAttribs);
+ lineDirectionsBuffer = PGL.allocateFloatBuffer(lineDirections);
lineIndicesBuffer = PGL.allocateShortBuffer(lineIndices);
pointVerticesBuffer = PGL.allocateFloatBuffer(pointVertices);
pointColorsBuffer = PGL.allocateIntBuffer(pointColors);
- pointAttribsBuffer = PGL.allocateFloatBuffer(pointAttribs);
+ pointOffsetsBuffer = PGL.allocateFloatBuffer(pointOffsets);
pointIndicesBuffer = PGL.allocateShortBuffer(pointIndices);
clear();
@@ -9075,7 +9074,7 @@ public class PGraphicsOpenGL extends PGraphics {
expandLineVertices(newSize);
expandLineColors(newSize);
- expandLineAttribs(newSize);
+ expandLineDirections(newSize);
}
firstLineVertex = lineVertexCount;
@@ -9103,7 +9102,7 @@ public class PGraphicsOpenGL extends PGraphics {
expandPointVertices(newSize);
expandPointColors(newSize);
- expandPointAttribs(newSize);
+ expandPointOffsets(newSize);
}
firstPointVertex = pointVertexCount;
@@ -9314,12 +9313,12 @@ public class PGraphicsOpenGL extends PGraphics {
PGL.updateIntBuffer(lineColorsBuffer, lineColors, offset, size);
}
- protected void updateLineAttribsBuffer() {
- updateLineAttribsBuffer(0, lineVertexCount);
+ protected void updateLineDirectionsBuffer() {
+ updateLineDirectionsBuffer(0, lineVertexCount);
}
- protected void updateLineAttribsBuffer(int offset, int size) {
- PGL.updateFloatBuffer(lineAttribsBuffer, lineAttribs,
+ protected void updateLineDirectionsBuffer(int offset, int size) {
+ PGL.updateFloatBuffer(lineDirectionsBuffer, lineDirections,
4 * offset, 4 * size);
}
@@ -9348,12 +9347,12 @@ public class PGraphicsOpenGL extends PGraphics {
PGL.updateIntBuffer(pointColorsBuffer, pointColors, offset, size);
}
- protected void updatePointAttribsBuffer() {
- updatePointAttribsBuffer(0, pointVertexCount);
+ protected void updatePointOffsetsBuffer() {
+ updatePointOffsetsBuffer(0, pointVertexCount);
}
- protected void updatePointAttribsBuffer(int offset, int size) {
- PGL.updateFloatBuffer(pointAttribsBuffer, pointAttribs,
+ protected void updatePointOffsetsBuffer(int offset, int size) {
+ PGL.updateFloatBuffer(pointOffsetsBuffer, pointOffsets,
2 * offset, 2 * size);
}
@@ -9446,11 +9445,11 @@ public class PGraphicsOpenGL extends PGraphics {
lineColorsBuffer = PGL.allocateIntBuffer(lineColors);
}
- void expandLineAttribs(int n) {
+ void expandLineDirections(int n) {
float temp[] = new float[4 * n];
- PApplet.arrayCopy(lineAttribs, 0, temp, 0, 4 * lineVertexCount);
- lineAttribs = temp;
- lineAttribsBuffer = PGL.allocateFloatBuffer(lineAttribs);
+ PApplet.arrayCopy(lineDirections, 0, temp, 0, 4 * lineVertexCount);
+ lineDirections = temp;
+ lineDirectionsBuffer = PGL.allocateFloatBuffer(lineDirections);
}
void expandLineIndices(int n) {
@@ -9474,11 +9473,11 @@ public class PGraphicsOpenGL extends PGraphics {
pointColorsBuffer = PGL.allocateIntBuffer(pointColors);
}
- void expandPointAttribs(int n) {
+ void expandPointOffsets(int n) {
float temp[] = new float[2 * n];
- PApplet.arrayCopy(pointAttribs, 0, temp, 0, 2 * pointVertexCount);
- pointAttribs = temp;
- pointAttribsBuffer = PGL.allocateFloatBuffer(pointAttribs);
+ PApplet.arrayCopy(pointOffsets, 0, temp, 0, 2 * pointVertexCount);
+ pointOffsets = temp;
+ pointOffsetsBuffer = PGL.allocateFloatBuffer(pointOffsets);
}
void expandPointIndices(int n) {
@@ -9511,7 +9510,7 @@ public class PGraphicsOpenGL extends PGraphics {
if (0 < lineVertexCount && lineVertexCount < lineVertices.length / 4) {
trimLineVertices();
trimLineColors();
- trimLineAttribs();
+ trimLineDirections();
}
if (0 < lineIndexCount && lineIndexCount < lineIndices.length) {
@@ -9521,7 +9520,7 @@ public class PGraphicsOpenGL extends PGraphics {
if (0 < pointVertexCount && pointVertexCount < pointVertices.length / 4) {
trimPointVertices();
trimPointColors();
- trimPointAttribs();
+ trimPointOffsets();
}
if (0 < pointIndexCount && pointIndexCount < pointIndices.length) {
@@ -9606,11 +9605,11 @@ public class PGraphicsOpenGL extends PGraphics {
lineColorsBuffer = PGL.allocateIntBuffer(lineColors);
}
- void trimLineAttribs() {
+ void trimLineDirections() {
float temp[] = new float[4 * lineVertexCount];
- PApplet.arrayCopy(lineAttribs, 0, temp, 0, 4 * lineVertexCount);
- lineAttribs = temp;
- lineAttribsBuffer = PGL.allocateFloatBuffer(lineAttribs);
+ PApplet.arrayCopy(lineDirections, 0, temp, 0, 4 * lineVertexCount);
+ lineDirections = temp;
+ lineDirectionsBuffer = PGL.allocateFloatBuffer(lineDirections);
}
void trimLineIndices() {
@@ -9634,11 +9633,11 @@ public class PGraphicsOpenGL extends PGraphics {
pointColorsBuffer = PGL.allocateIntBuffer(pointColors);
}
- void trimPointAttribs() {
+ void trimPointOffsets() {
float temp[] = new float[2 * pointVertexCount];
- PApplet.arrayCopy(pointAttribs, 0, temp, 0, 2 * pointVertexCount);
- pointAttribs = temp;
- pointAttribsBuffer = PGL.allocateFloatBuffer(pointAttribs);
+ PApplet.arrayCopy(pointOffsets, 0, temp, 0, 2 * pointVertexCount);
+ pointOffsets = temp;
+ pointOffsetsBuffer = PGL.allocateFloatBuffer(pointOffsets);
}
void trimPointIndices() {
@@ -9787,10 +9786,10 @@ public class PGraphicsOpenGL extends PGraphics {
lineColors[tessIdx] = rgba;
index = 4 * tessIdx;
- lineAttribs[index++] = 0;
- lineAttribs[index++] = 0;
- lineAttribs[index++] = 0;
- lineAttribs[index ] = 0;
+ lineDirections[index++] = 0;
+ lineDirections[index++] = 0;
+ lineDirections[index++] = 0;
+ lineDirections[index ] = 0;
}
// Sets line vertex with index tessIdx using the data from input vertices
@@ -9809,6 +9808,10 @@ public class PGraphicsOpenGL extends PGraphics {
float y1 = in.vertices[index++];
float z1 = in.vertices[index ];
+ float dx = x1 - x0;
+ float dy = y1 - y0;
+ float dz = z1 - z0;
+
if (renderMode == IMMEDIATE && flushMode == FLUSH_WHEN_FULL) {
PMatrix3D mm = modelview;
@@ -9819,9 +9822,9 @@ public class PGraphicsOpenGL extends PGraphics {
lineVertices[index ] = x0*mm.m30 + y0*mm.m31 + z0*mm.m32 + mm.m33;
index = 4 * tessIdx;
- lineAttribs[index++] = x1*mm.m00 + y1*mm.m01 + z1*mm.m02 + mm.m03;
- lineAttribs[index++] = x1*mm.m10 + y1*mm.m11 + z1*mm.m12 + mm.m13;
- lineAttribs[index ] = x1*mm.m20 + y1*mm.m21 + z1*mm.m22 + mm.m23;
+ lineDirections[index++] = dx*mm.m00 + dy*mm.m01 + dz*mm.m02;
+ lineDirections[index++] = dx*mm.m10 + dy*mm.m11 + dz*mm.m12;
+ lineDirections[index ] = dx*mm.m20 + dy*mm.m21 + dz*mm.m22;
} else {
index = 4 * tessIdx;
lineVertices[index++] = x0;
@@ -9830,13 +9833,13 @@ public class PGraphicsOpenGL extends PGraphics {
lineVertices[index ] = 1;
index = 4 * tessIdx;
- lineAttribs[index++] = x1;
- lineAttribs[index++] = y1;
- lineAttribs[index ] = z1;
+ lineDirections[index++] = dx;
+ lineDirections[index++] = dy;
+ lineDirections[index ] = dz;
}
lineColors[tessIdx] = rgba;
- lineAttribs[4 * tessIdx + 3] = weight;
+ lineDirections[4 * tessIdx + 3] = weight;
}
// -----------------------------------------------------------------
@@ -10094,16 +10097,19 @@ public class PGraphicsOpenGL extends PGraphics {
float y = lineVertices[index ];
index = 4 * i;
- float xa = lineAttribs[index++];
- float ya = lineAttribs[index ];
+ float xa = lineDirections[index++];
+ float ya = lineDirections[index ];
+
+ float dx = xa - x;
+ float dy = ya - y;
index = 4 * i;
lineVertices[index++] = x*tr.m00 + y*tr.m01 + tr.m02;
lineVertices[index ] = x*tr.m10 + y*tr.m11 + tr.m12;
index = 4 * i;
- lineAttribs[index++] = xa*tr.m00 + ya*tr.m01 + tr.m02;
- lineAttribs[index ] = xa*tr.m10 + ya*tr.m11 + tr.m12;
+ lineDirections[index++] = dx*tr.m00 + dy*tr.m01;
+ lineDirections[index ] = dx*tr.m10 + dy*tr.m11;
}
}
}
@@ -10166,9 +10172,13 @@ public class PGraphicsOpenGL extends PGraphics {
float w = lineVertices[index ];
index = 4 * i;
- float xa = lineAttribs[index++];
- float ya = lineAttribs[index++];
- float za = lineAttribs[index ];
+ float xa = lineDirections[index++];
+ float ya = lineDirections[index++];
+ float za = lineDirections[index ];
+
+ float dx = xa - x;
+ float dy = ya - y;
+ float dz = za - z;
index = 4 * i;
lineVertices[index++] = x*tr.m00 + y*tr.m01 + z*tr.m02 + w*tr.m03;
@@ -10177,9 +10187,9 @@ public class PGraphicsOpenGL extends PGraphics {
lineVertices[index ] = x*tr.m30 + y*tr.m31 + z*tr.m32 + w*tr.m33;
index = 4 * i;
- lineAttribs[index++] = xa*tr.m00 + ya*tr.m01 + za*tr.m02 + tr.m03;
- lineAttribs[index++] = xa*tr.m10 + ya*tr.m11 + za*tr.m12 + tr.m13;
- lineAttribs[index ] = xa*tr.m20 + ya*tr.m21 + za*tr.m22 + tr.m23;
+ lineDirections[index++] = dx*tr.m00 + dy*tr.m01 + dz*tr.m02;
+ lineDirections[index++] = dx*tr.m10 + dy*tr.m11 + dz*tr.m12;
+ lineDirections[index ] = dx*tr.m20 + dy*tr.m21 + dz*tr.m22;
}
}
}
@@ -10384,15 +10394,15 @@ public class PGraphicsOpenGL extends PGraphics {
// the circle perimeter. The point shader will read these attributes and
// displace the vertices in screen coordinates so the circles are always
// camera facing (bilboards)
- tess.pointAttribs[2 * attribIdx + 0] = 0;
- tess.pointAttribs[2 * attribIdx + 1] = 0;
+ tess.pointOffsets[2 * attribIdx + 0] = 0;
+ tess.pointOffsets[2 * attribIdx + 1] = 0;
attribIdx++;
float val = 0;
float inc = (float) SINCOS_LENGTH / perim;
for (int k = 0; k < perim; k++) {
- tess.pointAttribs[2 * attribIdx + 0] =
+ tess.pointOffsets[2 * attribIdx + 0] =
0.5f * cosLUT[(int) val] * strokeWeight;
- tess.pointAttribs[2 * attribIdx + 1] =
+ tess.pointOffsets[2 * attribIdx + 1] =
0.5f * sinLUT[(int) val] * strokeWeight;
val = (val + inc) % SINCOS_LENGTH;
attribIdx++;
@@ -10515,13 +10525,13 @@ public class PGraphicsOpenGL extends PGraphics {
// the quad corners. The point shader will read these attributes and
// displace the vertices in screen coordinates so the quads are always
// camera facing (bilboards)
- tess.pointAttribs[2 * attribIdx + 0] = 0;
- tess.pointAttribs[2 * attribIdx + 1] = 0;
+ tess.pointOffsets[2 * attribIdx + 0] = 0;
+ tess.pointOffsets[2 * attribIdx + 1] = 0;
attribIdx++;
for (int k = 0; k < 4; k++) {
- tess.pointAttribs[2 * attribIdx + 0] =
+ tess.pointOffsets[2 * attribIdx + 0] =
0.5f * QUAD_POINT_SIGNS[k][0] * strokeWeight;
- tess.pointAttribs[2 * attribIdx + 1] =
+ tess.pointOffsets[2 * attribIdx + 1] =
0.5f * QUAD_POINT_SIGNS[k][1] * strokeWeight;
attribIdx++;
}
diff --git a/core/src/processing/opengl/PShapeOpenGL.java b/core/src/processing/opengl/PShapeOpenGL.java
index ee88a5519..e7ffc3730 100644
--- a/core/src/processing/opengl/PShapeOpenGL.java
+++ b/core/src/processing/opengl/PShapeOpenGL.java
@@ -616,32 +616,6 @@ public class PShapeOpenGL extends PShape {
}
- /*
- @Override
- public PVector getTop(PVector top) {
- if (top == null) {
- top = new PVector();
- }
- top.set(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY,
- Float.POSITIVE_INFINITY);
- getVertexMin(top);
- return top;
- }
-
-
- @Override
- public PVector getBottom(PVector bottom) {
- if (bottom == null) {
- bottom = new PVector();
- }
- bottom.set(Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY,
- Float.NEGATIVE_INFINITY);
- getVertexMax(bottom);
- return bottom;
- }
- */
-
-
protected void getVertexMin(PVector min) {
updateTessellation();
@@ -990,25 +964,6 @@ public class PShapeOpenGL extends PShape {
}
}
-/*
- @Override
- public void beginShape() {
- beginShape(POLYGON);
- }
-
-
- @Override
- public void beginShape(int kind) {
- this.kind = kind;
- openShape = true;
- }
-
-
- @Override
- public void endShape() {
- endShape(OPEN);
- }
-*/
@Override
public void endShape(int mode) {
@@ -1051,772 +1006,6 @@ public class PShapeOpenGL extends PShape {
}
- //////////////////////////////////////////////////////////////
-
- // Stroke cap/join/weight set/update
-
-/*
- @Override
- public void strokeWeight(float weight) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.strokeWeight(weight);
- }
- } else {
- updateStrokeWeight(weight);
- }
- }
-
-
- protected void updateStrokeWeight(float newWeight) {
- if (PGraphicsOpenGL.same(strokeWeight, newWeight)) return;
- float oldWeight = strokeWeight;
- strokeWeight = newWeight;
-
- Arrays.fill(inGeo.strokeWeights, 0, inGeo.vertexCount, strokeWeight);
- if (shapeCreated && tessellated && (hasLines || hasPoints)) {
- float resizeFactor = newWeight / oldWeight;
- if (hasLines) {
- if (is3D()) {
- for (int i = firstLineVertex; i <= lastLineVertex; i++) {
- tessGeo.lineAttribs[4 * i + 3] *= resizeFactor;
- }
- root.setModifiedLineAttributes(firstLineVertex, lastLineVertex);
- } else if (is2D()) {
- // Changing the stroke weight on a 2D shape needs a
- // re-tesellation in order to replace the old line
- // geometry.
- markForTessellation();
- }
- }
- if (hasPoints) {
- if (is3D()) {
- for (int i = firstPointVertex; i <= lastPointVertex; i++) {
- tessGeo.pointAttribs[2 * i + 0] *= resizeFactor;
- tessGeo.pointAttribs[2 * i + 1] *= resizeFactor;
- }
- root.setModifiedPointAttributes(firstPointVertex, lastPointVertex);
- } else if (is2D()) {
- // Changing the stroke weight on a 2D shape needs a
- // re-tesellation in order to replace the old point
- // geometry.
- markForTessellation();
- }
- }
- }
- }
-
-
- @Override
- public void strokeJoin(int join) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.strokeJoin(join);
- }
- } else {
- if (is2D() && strokeJoin != join) {
- // Changing the stroke join on a 2D shape needs a
- // re-tesellation in order to replace the old join
- // geometry.
- markForTessellation();
- }
- strokeJoin = join;
- }
- }
-
-
- @Override
- public void strokeCap(int cap) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.strokeCap(cap);
- }
- } else {
- if (is2D() && strokeCap != cap) {
- // Changing the stroke cap on a 2D shape needs a
- // re-tesellation in order to replace the old cap
- // geometry.
- markForTessellation();
- }
- strokeCap = cap;
- }
- }
-*/
-
- //////////////////////////////////////////////////////////////
-
- // Fill set/update
-
-/*
- @Override
- public void noFill() {
- fill = false;
-// if (family == GROUP) {
-// for (int i = 0; i < childCount; i++) {
-// PShapeOpenGL child = (PShapeOpenGL) children[i];
-// child.noFill();
-// }
-// } else {
-// fill = false;
-// updateFillColor(0x0);
-// }
- }
-
- @Override
- public void fill(int argb) {
-
- }
- */
-
-/*
- @Override
- public void fill(int rgb) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.fill(rgb);
- }
- } else {
- colorCalc(rgb);
- fillFromCalc();
- }
- }
-
-
- @Override
- public void fill(int rgb, float alpha) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.fill(rgb, alpha);
- }
- } else {
- colorCalc(rgb, alpha);
- fillFromCalc();
- }
- }
-
-
- @Override
- public void fill(float gray) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.fill(gray);
- }
- } else {
- colorCalc(gray);
- fillFromCalc();
- }
- }
-
-
- @Override
- public void fill(float gray, float alpha) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.fill(gray, alpha);
- }
- } else {
- colorCalc(gray, alpha);
- fillFromCalc();
- }
- }
-
-
- @Override
- public void fill(float x, float y, float z) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.fill(x, y, z);
- }
- } else {
- colorCalc(x, y, z);
- fillFromCalc();
- }
- }
-
-
- @Override
- public void fill(float x, float y, float z, float a) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.fill(x, y, z, a);
- }
- } else {
- colorCalc(x, y, z, a);
- fillFromCalc();
- }
- }
-
-
- protected void fillFromCalc() {
- fill = true;
- updateFillColor(calcColor);
-
- if (!setAmbient) {
- // Setting the ambient color from the current fill
- // is what the old P3D did and allows to have an
- // default ambient color when the user doesn't specify
- // it explicitly.
- ambientFromCalc();
- setAmbient = false;
- }
- }
-
-
- protected void updateFillColor(int newFillColor) {
- if (!openShape) {
- PGraphics.showWarning("Neet to call beginShape() first");
- return;
- }
-
- fillColor = newFillColor;
- }
-*/
-
- //////////////////////////////////////////////////////////////
-
- // Stroke (color) set/update
-
-/*
- @Override
- public void noStroke() {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.noStroke();
- }
- } else {
- if (stroke) {
- // Disabling stroke on a shape previously with
- // stroke needs a re-tesellation in order to remove
- // the additional geometry of lines and/or points.
- markForTessellation();
- stroke = false;
- }
- updateStrokeColor(0x0);
- if (is2D() && parent != null) {
- ((PShapeOpenGL)parent).strokedTexture(false);
- }
- }
- }
-
-
- @Override
- public void stroke(int rgb) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.stroke(rgb);
- }
- } else {
- colorCalc(rgb);
- strokeFromCalc();
- }
- }
-
-
- @Override
- public void stroke(int rgb, float alpha) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.stroke(rgb, alpha);
- }
- } else {
- colorCalc(rgb, alpha);
- strokeFromCalc();
- }
- }
-
-
- @Override
- public void stroke(float gray) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.stroke(gray);
- }
- } else {
- colorCalc(gray);
- strokeFromCalc();
- }
- }
-
-
- @Override
- public void stroke(float gray, float alpha) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.stroke(gray, alpha);
- }
- } else {
- colorCalc(gray, alpha);
- strokeFromCalc();
- }
- }
-
-
- @Override
- public void stroke(float x, float y, float z) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.stroke(x, y, z);
- }
- } else {
- colorCalc(x, y, z);
- strokeFromCalc();
- }
- }
-
-
- @Override
- public void stroke(float x, float y, float z, float alpha) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.stroke(x, y, z, alpha);
- }
- } else {
- colorCalc(x, y, z, alpha);
- strokeFromCalc();
- }
- }
-
-
- protected void strokeFromCalc() {
- if (!stroke) {
- // Enabling stroke on a shape previously without
- // stroke needs a re-tessellation in order to incorporate
- // the additional geometry of lines and/or points.
- markForTessellation();
- stroke = true;
- }
- updateStrokeColor(calcColor);
- if (is2D() && image != null && parent != null) {
- ((PShapeOpenGL)parent).strokedTexture(true);
- }
- }
-
-
- protected void updateStrokeColor(int newStrokeColor) {
- if (!openShape) {
- PGraphics.showWarning("Neet to call beginShape() first");
- return;
- }
-
- strokeColor = newStrokeColor;
- }
-*/
-
- //////////////////////////////////////////////////////////////
-
- // Tint set/update
-
-/*
- @Override
- public void noTint() {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.noTint();
- }
- } else {
- tint = false;
- updateTintColor(0x0);
- }
- }
-
-
- @Override
- public void tint(int rgb) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.tint(rgb);
- }
- } else {
- colorCalc(rgb);
- tintFromCalc();
- }
- }
-
-
- @Override
- public void tint(int rgb, float alpha) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.tint(rgb, alpha);
- }
- } else {
- colorCalc(rgb, alpha);
- tintFromCalc();
- }
- }
-
-
- @Override
- public void tint(float gray) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.tint(gray);
- }
- } else {
- colorCalc(gray);
- tintFromCalc();
- }
- }
-
-
- @Override
- public void tint(float gray, float alpha) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.tint(gray, alpha);
- }
- } else {
- colorCalc(gray, alpha);
- tintFromCalc();
- }
- }
-
-
- @Override
- public void tint(float x, float y, float z) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.tint(x, y, z);
- }
- } else {
- colorCalc(x, y, z);
- tintFromCalc();
- }
- }
-
-
- @Override
- public void tint(float x, float y, float z, float alpha) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.tint(x, y, z, alpha);
- }
- } else {
- colorCalc(x, y, z, alpha);
- tintFromCalc();
- }
- }
-
-
- protected void tintFromCalc() {
- tint = true;
- updateTintColor(calcColor);
- }
-
-
- protected void updateTintColor(int newTintColor) {
- if (tintColor == newTintColor) return;
- tintColor = newTintColor;
-
- if (image != null) {
- Arrays.fill(inGeo.colors, 0, inGeo.vertexCount,
- PGL.javaToNativeARGB(tintColor));
- if (shapeCreated && tessellated && hasPolys) {
- if (is3D()) {
- Arrays.fill(tessGeo.polyColors, firstPolyVertex, lastPolyVertex + 1,
- PGL.javaToNativeARGB(tintColor));
- root.setModifiedPolyColors(firstPolyVertex, lastPolyVertex);
- } else if (is2D()) {
- int last1 = lastPolyVertex + 1;
- if (-1 < firstLineVertex) last1 = firstLineVertex;
- if (-1 < firstPointVertex) last1 = firstPointVertex;
- Arrays.fill(tessGeo.polyColors, firstPolyVertex, last1,
- PGL.javaToNativeARGB(tintColor));
- root.setModifiedPolyColors(firstPolyVertex, last1 - 1);
- }
- }
- }
- }
-*/
-
- //////////////////////////////////////////////////////////////
-
- // Ambient set/update
-
-/*
- @Override
- public void ambient(int rgb) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.ambient(rgb);
- }
- } else {
- colorCalc(rgb);
- ambientFromCalc();
- }
- }
-
-
- @Override
- public void ambient(float gray) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.ambient(gray);
- }
- } else {
- colorCalc(gray);
- ambientFromCalc();
- }
- }
-
-
- @Override
- public void ambient(float x, float y, float z) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.ambient(x, y, z);
- }
- } else {
- colorCalc(x, y, z);
- ambientFromCalc();
- }
- }
-
-
- protected void ambientFromCalc() {
- updateAmbientColor(calcColor);
- setAmbient = true;
- }
-
-
- protected void updateAmbientColor(int newAmbientColor) {
- if (ambientColor == newAmbientColor) return;
- ambientColor = newAmbientColor;
-
- Arrays.fill(inGeo.ambient, 0, inGeo.vertexCount,
- PGL.javaToNativeARGB(ambientColor));
- if (shapeCreated && tessellated && hasPolys) {
- if (is3D()) {
- Arrays.fill(tessGeo.polyAmbient, firstPolyVertex, lastPolyVertex + 1,
- PGL.javaToNativeARGB(ambientColor));
- root.setModifiedPolyAmbient(firstPolyVertex, lastPolyVertex);
- } else if (is2D()) {
- int last1 = lastPolyVertex + 1;
- if (-1 < firstLineVertex) last1 = firstLineVertex;
- if (-1 < firstPointVertex) last1 = firstPointVertex;
- Arrays.fill(tessGeo.polyAmbient, firstPolyVertex, last1,
- PGL.javaToNativeARGB(ambientColor));
- root.setModifiedPolyColors(firstPolyVertex, last1 - 1);
- }
- }
- }
-*/
-
- //////////////////////////////////////////////////////////////
-
- // Specular set/update
-
-/*
- @Override
- public void specular(int rgb) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.specular(rgb);
- }
- } else {
- colorCalc(rgb);
- specularFromCalc();
- }
- }
-
-
- @Override
- public void specular(float gray) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.specular(gray);
- }
- } else {
- colorCalc(gray);
- specularFromCalc();
- }
- }
-
-
- @Override
- public void specular(float x, float y, float z) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.specular(x, y, z);
- }
- } else {
- colorCalc(x, y, z);
- specularFromCalc();
- }
- }
-
-
- protected void specularFromCalc() {
- updateSpecularColor(calcColor);
- }
-
-
- protected void updateSpecularColor(int newSpecularColor) {
- if (specularColor == newSpecularColor) return;
- specularColor = newSpecularColor;
-
- Arrays.fill(inGeo.specular, 0, inGeo.vertexCount,
- PGL.javaToNativeARGB(specularColor));
- if (shapeCreated && tessellated && hasPolys) {
- if (is3D()) {
- Arrays.fill(tessGeo.polySpecular, firstPolyVertex, lastPolyVertex + 1,
- PGL.javaToNativeARGB(specularColor));
- root.setModifiedPolySpecular(firstPolyVertex, lastPolyVertex);
- } else if (is2D()) {
- int last1 = lastPolyVertex + 1;
- if (-1 < firstLineVertex) last1 = firstLineVertex;
- if (-1 < firstPointVertex) last1 = firstPointVertex;
- Arrays.fill(tessGeo.polySpecular, firstPolyVertex, last1,
- PGL.javaToNativeARGB(specularColor));
- root.setModifiedPolyColors(firstPolyVertex, last1 - 1);
- }
- }
- }
-*/
-
- //////////////////////////////////////////////////////////////
-
- // Emissive set/update
-
-/*
- @Override
- public void emissive(int rgb) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.emissive(rgb);
- }
- } else {
- colorCalc(rgb);
- emissiveFromCalc();
- }
- }
-
-
- @Override
- public void emissive(float gray) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.emissive(gray);
- }
- } else {
- colorCalc(gray);
- emissiveFromCalc();
- }
- }
-
-
- @Override
- public void emissive(float x, float y, float z) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.emissive(x, y, z);
- }
- } else {
- colorCalc(x, y, z);
- emissiveFromCalc();
- }
- }
-
-
- protected void emissiveFromCalc() {
- updateEmissiveColor(calcColor);
- }
-
-
- protected void updateEmissiveColor(int newEmissiveColor) {
- if (emissiveColor == newEmissiveColor) return;
- emissiveColor = newEmissiveColor;
-
- Arrays.fill(inGeo.emissive, 0, inGeo.vertexCount,
- PGL.javaToNativeARGB(emissiveColor));
- if (shapeCreated && tessellated && 0 < tessGeo.polyVertexCount) {
- if (is3D()) {
- Arrays.fill(tessGeo.polyEmissive, firstPolyVertex, lastPolyVertex + 1,
- PGL.javaToNativeARGB(emissiveColor));
- root.setModifiedPolyEmissive(firstPolyVertex, lastPolyVertex);
- } else if (is2D()) {
- int last1 = lastPolyVertex + 1;
- if (-1 < firstLineVertex) last1 = firstLineVertex;
- if (-1 < firstPointVertex) last1 = firstPointVertex;
- Arrays.fill(tessGeo.polyEmissive, firstPolyVertex, last1,
- PGL.javaToNativeARGB(emissiveColor));
- root.setModifiedPolyColors(firstPolyVertex, last1 - 1);
- }
- }
- }
-*/
-
- //////////////////////////////////////////////////////////////
-
- // Shininess set/update
-
-/*
- @Override
- public void shininess(float shine) {
- if (family == GROUP) {
- for (int i = 0; i < childCount; i++) {
- PShapeOpenGL child = (PShapeOpenGL) children[i];
- child.shininess(shine);
- }
- } else {
- updateShininessFactor(shine);
- }
- }
-
-
- protected void updateShininessFactor(float newShininess) {
- if (PGraphicsOpenGL.same(shininess, newShininess)) return;
- shininess = newShininess;
-
- Arrays.fill(inGeo.shininess, 0, inGeo.vertexCount, shininess);
- if (shapeCreated && tessellated && hasPolys) {
- if (is3D()) {
- Arrays.fill(tessGeo.polyShininess, firstPolyVertex, lastPolyVertex + 1,
- shininess);
- root.setModifiedPolyShininess(firstPolyVertex, lastPolyVertex);
- } else if (is2D()) {
- int last1 = lastPolyVertex + 1;
- if (-1 < firstLineVertex) last1 = firstLineVertex;
- if (-1 < firstPointVertex) last1 = firstPointVertex;
- Arrays.fill(tessGeo.polyShininess, firstPolyVertex, last1, shininess);
- root.setModifiedPolyColors(firstPolyVertex, last1 - 1);
- }
- }
- }
-*/
-
///////////////////////////////////////////////////////////
//
@@ -2613,7 +1802,7 @@ public class PShapeOpenGL extends PShape {
if (hasLines) {
if (is3D()) {
for (int i = firstLineVertex; i <= lastLineVertex; i++) {
- tessGeo.lineAttribs[4 * i + 3] *= resizeFactor;
+ tessGeo.lineDirections[4 * i + 3] *= resizeFactor;
}
root.setModifiedLineAttributes(firstLineVertex, lastLineVertex);
} else if (is2D()) {
@@ -2626,8 +1815,8 @@ public class PShapeOpenGL extends PShape {
if (hasPoints) {
if (is3D()) {
for (int i = firstPointVertex; i <= lastPointVertex; i++) {
- tessGeo.pointAttribs[2 * i + 0] *= resizeFactor;
- tessGeo.pointAttribs[2 * i + 1] *= resizeFactor;
+ tessGeo.pointOffsets[2 * i + 0] *= resizeFactor;
+ tessGeo.pointOffsets[2 * i + 1] *= resizeFactor;
}
root.setModifiedPointAttributes(firstPointVertex, lastPointVertex);
} else if (is2D()) {
@@ -4080,11 +3269,11 @@ public class PShapeOpenGL extends PShape {
pgl.bufferData(PGL.ARRAY_BUFFER, sizei,
tessGeo.lineColorsBuffer, PGL.STATIC_DRAW);
- tessGeo.updateLineAttribsBuffer();
+ tessGeo.updateLineDirectionsBuffer();
glLineAttrib = pg.createVertexBufferObject(context);
pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineAttrib);
pgl.bufferData(PGL.ARRAY_BUFFER, 4 * sizef,
- tessGeo.lineAttribsBuffer, PGL.STATIC_DRAW);
+ tessGeo.lineDirectionsBuffer, PGL.STATIC_DRAW);
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
@@ -4116,11 +3305,11 @@ public class PShapeOpenGL extends PShape {
pgl.bufferData(PGL.ARRAY_BUFFER, sizei,
tessGeo.pointColorsBuffer, PGL.STATIC_DRAW);
- tessGeo.updatePointAttribsBuffer();
+ tessGeo.updatePointOffsetsBuffer();
glPointAttrib = pg.createVertexBufferObject(context);
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointAttrib);
pgl.bufferData(PGL.ARRAY_BUFFER, 2 * sizef,
- tessGeo.pointAttribsBuffer, PGL.STATIC_DRAW);
+ tessGeo.pointOffsetsBuffer, PGL.STATIC_DRAW);
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
@@ -4544,12 +3733,12 @@ public class PShapeOpenGL extends PShape {
protected void copyLineAttributes(int offset, int size) {
- tessGeo.updateLineAttribsBuffer(offset, size);
+ tessGeo.updateLineDirectionsBuffer(offset, size);
pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineAttrib);
- tessGeo.lineAttribsBuffer.position(4 * offset);
+ tessGeo.lineDirectionsBuffer.position(4 * offset);
pgl.bufferSubData(PGL.ARRAY_BUFFER, 4 * offset * PGL.SIZEOF_FLOAT,
- 4 * size * PGL.SIZEOF_FLOAT, tessGeo.lineAttribsBuffer);
- tessGeo.lineAttribsBuffer.rewind();
+ 4 * size * PGL.SIZEOF_FLOAT, tessGeo.lineDirectionsBuffer);
+ tessGeo.lineDirectionsBuffer.rewind();
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
}
@@ -4577,12 +3766,12 @@ public class PShapeOpenGL extends PShape {
protected void copyPointAttributes(int offset, int size) {
- tessGeo.updatePointAttribsBuffer(offset, size);
+ tessGeo.updatePointOffsetsBuffer(offset, size);
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointAttrib);
- tessGeo.pointAttribsBuffer.position(2 * offset);
+ tessGeo.pointOffsetsBuffer.position(2 * offset);
pgl.bufferSubData(PGL.ARRAY_BUFFER, 2 * offset * PGL.SIZEOF_FLOAT,
- 2 * size * PGL.SIZEOF_FLOAT, tessGeo.pointAttribsBuffer);
- tessGeo.pointAttribsBuffer.rewind();
+ 2 * size * PGL.SIZEOF_FLOAT, tessGeo.pointOffsetsBuffer);
+ tessGeo.pointOffsetsBuffer.rewind();
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
}
@@ -5095,7 +4284,7 @@ public class PShapeOpenGL extends PShape {
float[] vertices = tessGeo.lineVertices;
int[] color = tessGeo.lineColors;
- float[] attribs = tessGeo.lineAttribs;
+ float[] attribs = tessGeo.lineDirections;
short[] indices = tessGeo.lineIndices;
IndexCache cache = tessGeo.lineIndexCache;
@@ -5194,7 +4383,7 @@ public class PShapeOpenGL extends PShape {
float[] vertices = tessGeo.pointVertices;
int[] color = tessGeo.pointColors;
- float[] attribs = tessGeo.pointAttribs;
+ float[] attribs = tessGeo.pointOffsets;
short[] indices = tessGeo.pointIndices;
IndexCache cache = tessGeo.pointIndexCache;
diff --git a/core/src/processing/opengl/PolyNoTexShaderFrag.glsl b/core/src/processing/opengl/PointFrag.glsl
similarity index 100%
rename from core/src/processing/opengl/PolyNoTexShaderFrag.glsl
rename to core/src/processing/opengl/PointFrag.glsl
diff --git a/core/src/processing/opengl/PointShaderVert.glsl b/core/src/processing/opengl/PointVert.glsl
similarity index 93%
rename from core/src/processing/opengl/PointShaderVert.glsl
rename to core/src/processing/opengl/PointVert.glsl
index fd64d0dc1..7523e3326 100644
--- a/core/src/processing/opengl/PointShaderVert.glsl
+++ b/core/src/processing/opengl/PointVert.glsl
@@ -32,9 +32,9 @@ attribute vec2 offset;
varying vec4 vertColor;
-vec4 windowToClipVector(vec2 window, vec4 viewport, float clip_w) {
+vec4 windowToClipVector(vec2 window, vec4 viewport, float clipw) {
vec2 xypos = (window / viewport.zw) * 2.0;
- return vec4(xypos, 0.0, 0.0) * clip_w;
+ return vec4(xypos, 0.0, 0.0) * clipw;
}
void main() {
diff --git a/core/src/processing/opengl/PolyTexlightShaderVert.glsl b/core/src/processing/opengl/TexlightVert.glsl
similarity index 100%
rename from core/src/processing/opengl/PolyTexlightShaderVert.glsl
rename to core/src/processing/opengl/TexlightVert.glsl
diff --git a/core/src/processing/opengl/PolyTexShaderFrag.glsl b/core/src/processing/opengl/TextureFrag.glsl
similarity index 100%
rename from core/src/processing/opengl/PolyTexShaderFrag.glsl
rename to core/src/processing/opengl/TextureFrag.glsl
diff --git a/core/src/processing/opengl/PolyTexShaderVert.glsl b/core/src/processing/opengl/TextureVert.glsl
similarity index 100%
rename from core/src/processing/opengl/PolyTexShaderVert.glsl
rename to core/src/processing/opengl/TextureVert.glsl
diff --git a/core/todo.txt b/core/todo.txt
index 09935803f..fbde4b12c 100644
--- a/core/todo.txt
+++ b/core/todo.txt
@@ -89,6 +89,8 @@ A https://github.com/processing/processing/issues/1562
A Incorrect sampler2D alpha channel from PGraphics.filter(shader)
A https://github.com/processing/processing/issues/1557
X http://code.google.com/p/processing/issues/detail?id=1519
+A Mouse data erratic in P2D
+A https://github.com/processing/processing/issues/1626
_ Default filter on PGraphics does nothing (JAVA2D) or causes crash (P2D/P3D)
_ http://code.google.com/p/processing/issues/detail?id=1496
_ https://github.com/processing/processing/issues/1534
diff --git a/todo.txt b/todo.txt
index 88c7b3181..daf6a63b5 100644
--- a/todo.txt
+++ b/todo.txt
@@ -68,6 +68,8 @@ X patch from John Li (jli@circularly.org)
X readlink error when running processing-java
X patch from richard@crash.net.nz
X http://code.google.com/p/processing/issues/detail?id=1578
+o add Iterator as an import?
+X nope, added warning message instead
manindra
M bug that was causing the Debugger to point to wrong break point line numbers
@@ -92,13 +94,11 @@ o if sketch was open, then restart by dragging the .pde to p5.app
https://processing-js.lighthouseapp.com/
-library changes
+library changes (site only?)
_ remove netscape.javascript stuff
_ move minim out to its own contrib section
_ move arduino out to its own library
-_ add Iterator as an import?
-
_ remove sketch.properties when moving back to the default?
_ or can we not do this, because the next mode needs this?
@@ -127,38 +127,41 @@ X http://code.google.com/p/processing/issues/detail?id=1569
X make already installed libraries distinguishable in the list
X https://github.com/processing/processing/issues/1250
X http://code.google.com/p/processing/issues/detail?id=1212
+X work on the design of the list entries themselves
+X add "Installed" indicator? or show the Remove button?
+X using "Add Library" requires restart of Processing before lib recognized
+X https://github.com/processing/processing/issues/1425
+X http://code.google.com/p/processing/issues/detail?id=1387
medium
-_ highlight color seems to be incorrect?
_ Contributed modes should show up in mode menu after installation
+_ waiting for fixed CoffeeScript mode to test this one
_ https://github.com/processing/processing/issues/1504
X http://code.google.com/p/processing/issues/detail?id=1466
-_ using "Add Library" requires restart of Processing before lib recognized
-_ https://github.com/processing/processing/issues/1425
-X http://code.google.com/p/processing/issues/detail?id=1387
_ new libraries not picked up when changing sketchbook location
-_ make sure it can run w/o a network connection
+_ make sure contrib manager can run w/o a network connection
_ or if a bad document comes through, it can recover
_ gracefully recover from proxy problems
_ https://github.com/processing/processing/issues/1601
_ alternating blue/white backgrounds aren't updated after changing filter
-_ just need to call a repaint() after selection change?
-_ move styling to separate constants that are more accessible
-_ work on the design of the list entries themselves
+_ just need to call a repaint() after a filter change?
_ check with Casey about coloring for error messages
_ test on Windows and Linux
-_ add "Installed" indicator? or show the Remove button?
+_ scrolls to bottom of window after updating the list
low
+_ font size for "Downloading" on progress bar is too large
+_ but changing the size breaks the vertical centering
+_ highlight color seems to be incorrect?
_ after installing, the item in the manager list doesn't change color
_ wheel mouse is super jumpy
_ something about unit increment in ContributionListPanel
_ arrow keys up/down move scroll bar, not selection
-_ scrolls to bottom of window on opening
_ excessive CPU usage of PDE after using library manager
_ confirmed to still be a problem with b5/6
_ https://github.com/processing/processing/issues/1074
X http://code.google.com/p/processing/issues/detail?id=1036
+_ move styling to separate constants that are more accessible
2.0 FINAL / new interface