filter shaders don't need to use the texture uniform, fixes #2204

This commit is contained in:
codeanticode
2013-11-06 09:00:20 -05:00
parent 7c5e3044ae
commit 09de1306e5
3 changed files with 15 additions and 10 deletions
@@ -180,12 +180,6 @@ public class PGraphics2D extends PGraphicsOpenGL {
popProjection();
}
// @Override
// public void resetMatrix() {
// super.resetMatrix();
// defaultCamera();
// }
//////////////////////////////////////////////////////////////
@@ -79,7 +79,7 @@ public class PGraphicsOpenGL extends PGraphics {
static final String MISSING_UV_TEXCOORDS_ERROR =
"No uv texture coordinates supplied with vertex() call";
static final String INVALID_FILTER_SHADER_ERROR =
"Your shader needs to be of TEXTURE type to be used as a filter";
"Your shader cannot be used as a filter because is of type POINT or LINES";
static final String INCONSISTENT_SHADER_TYPES =
"The vertex and fragment shaders have different types";
static final String WRONG_SHADER_TYPE_ERROR =
@@ -5546,7 +5546,7 @@ public class PGraphicsOpenGL extends PGraphics {
@Override
public void filter(PShader shader) {
if (!shader.isPolyShader() || !shader.supportsTexturing()) {
if (!shader.isPolyShader()) {
PGraphics.showWarning(INVALID_FILTER_SHADER_ERROR);
return;
}
+13 -2
View File
@@ -108,6 +108,9 @@ public class PShader implements PConstants {
protected IntBuffer intBuffer;
protected FloatBuffer floatBuffer;
protected boolean loadedAttributes = false;
protected boolean loadedUniforms = false;
// Uniforms common to all shader types
protected int transformMatLoc;
protected int modelviewMatLoc;
@@ -1048,30 +1051,37 @@ public class PShader implements PConstants {
//
// Processing specific
protected int getType() {
return type;
}
protected void setType(int type) {
this.type = type;
}
protected boolean hasType() {
return POINT <= type && type <= TEXLIGHT;
}
protected boolean isPointShader() {
return type == POINT;
}
protected boolean isLineShader() {
return type == LINE;
}
protected boolean isPolyShader() {
return POLY <= type && type <= TEXLIGHT;
}
protected boolean checkPolyType(int type) {
if (getType() == PShader.POLY) return true;
@@ -1091,15 +1101,17 @@ public class PShader implements PConstants {
return true;
}
protected int getLastTexUnit() {
return texUnits == null ? -1 : texUnits.size() - 1;
}
protected void setRenderer(PGraphicsOpenGL pg) {
this.pg = pg;
}
boolean loadedAttributes = false;
protected void loadAttributes() {
if (loadedAttributes) return;
@@ -1126,7 +1138,6 @@ public class PShader implements PConstants {
}
boolean loadedUniforms = false;
protected void loadUniforms() {
if (loadedUniforms) return;
transformMatLoc = getUniformLoc("transform");