diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index 29335067d..954385a1e 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -6470,15 +6470,11 @@ public class PGraphicsOpenGL extends PGraphics { protected class BaseShader extends PShader { - protected int projmodelviewMatrixLoc; + protected int transformMatrixLoc; protected int modelviewMatrixLoc; protected int projectionMatrixLoc; - protected int pframeSamplerLoc; - protected int resolutionLoc; + protected int bufferSamplerLoc; protected int viewportLoc; - protected int mouseLoc; - protected int pmouseLoc; - protected int timeLoc; public BaseShader(PApplet parent) { super(parent); @@ -6494,22 +6490,16 @@ public class PGraphicsOpenGL extends PGraphics { @Override public void loadUniforms() { - projmodelviewMatrixLoc = getUniformLoc("projmodelviewMatrix"); + transformMatrixLoc = getUniformLoc("transform"); modelviewMatrixLoc = getUniformLoc("modelviewMatrix"); projectionMatrixLoc = getUniformLoc("projectionMatrix"); - - resolutionLoc = getUniformLoc("resolution"); viewportLoc = getUniformLoc("viewport"); - mouseLoc = getUniformLoc("mouse"); - pmouseLoc = getUniformLoc("pmouse"); - timeLoc = getUniformLoc("time"); - - pframeSamplerLoc = getUniformLoc("pframeSampler"); + bufferSamplerLoc = getUniformLoc("buffer"); } @Override public void unbind() { - if (-1 < pframeSamplerLoc) { + if (-1 < bufferSamplerLoc) { pgl.needFBOLayer(); pgl.activeTexture(PGL.TEXTURE0 + lastTexUnit); pgCurrent.unbindBackTexture(); @@ -6522,9 +6512,9 @@ public class PGraphicsOpenGL extends PGraphics { } protected void setCommonUniforms() { - if (-1 < projmodelviewMatrixLoc) { + if (-1 < transformMatrixLoc) { pgCurrent.updateGLProjmodelview(); - setUniformMatrix(projmodelviewMatrixLoc, pgCurrent.glProjmodelview); + setUniformMatrix(transformMatrixLoc, pgCurrent.glProjmodelview); } if (-1 < modelviewMatrixLoc) { @@ -6537,12 +6527,6 @@ public class PGraphicsOpenGL extends PGraphics { setUniformMatrix(projectionMatrixLoc, pgCurrent.glProjection); } - if (1 < resolutionLoc) { - float w = pgCurrent.width; - float h = pgCurrent.height; - setUniformValue(resolutionLoc, w, h); - } - if (-1 < viewportLoc) { float x = pgCurrent.viewport.get(0); float y = pgCurrent.viewport.get(1); @@ -6551,25 +6535,8 @@ public class PGraphicsOpenGL extends PGraphics { setUniformValue(viewportLoc, x, y, w, h); } - if (-1 < mouseLoc) { - float mx = pgCurrent.parent.mouseX; - float my = pgCurrent.parent.height - pgCurrent.parent.mouseY; - setUniformValue(mouseLoc, mx, my); - } - - if (-1 < pmouseLoc) { - float pmx = pgCurrent.parent.pmouseX; - float pmy = pgCurrent.parent.height - pgCurrent.parent.pmouseY; - setUniformValue(pmouseLoc, pmx, pmy); - } - - if (-1 < timeLoc) { - float sec = pgCurrent.parent.millis() / 1000.0f; - setUniformValue(timeLoc, sec); - } - - if (-1 < pframeSamplerLoc) { - setUniformValue(pframeSamplerLoc, lastTexUnit); + if (-1 < bufferSamplerLoc) { + setUniformValue(bufferSamplerLoc, lastTexUnit); pgl.activeTexture(PGL.TEXTURE0 + lastTexUnit); pgCurrent.bindBackTexture(); } diff --git a/core/src/processing/opengl/PolyColorShaderVert.glsl b/core/src/processing/opengl/PolyColorShaderVert.glsl index 95c266a76..42c916216 100644 --- a/core/src/processing/opengl/PolyColorShaderVert.glsl +++ b/core/src/processing/opengl/PolyColorShaderVert.glsl @@ -18,7 +18,7 @@ Boston, MA 02111-1307 USA */ -uniform mat4 projmodelviewMatrix; +uniform mat4 transform; attribute vec4 inVertex; attribute vec4 inColor; @@ -26,7 +26,7 @@ attribute vec4 inColor; varying vec4 vertColor; void main() { - gl_Position = projmodelviewMatrix * inVertex; + gl_Position = transform * inVertex; vertColor = inColor; } \ No newline at end of file diff --git a/core/src/processing/opengl/PolyLightShaderVert.glsl b/core/src/processing/opengl/PolyLightShaderVert.glsl index b271b020a..fd181210a 100644 --- a/core/src/processing/opengl/PolyLightShaderVert.glsl +++ b/core/src/processing/opengl/PolyLightShaderVert.glsl @@ -19,7 +19,7 @@ */ uniform mat4 modelviewMatrix; -uniform mat4 projmodelviewMatrix; +uniform mat4 transform; uniform mat3 normalMatrix; uniform int lightCount; @@ -73,7 +73,7 @@ float blinnPhongFactor(vec3 lightDir, vec3 vertPos, vec3 vecNormal, float shine) void main() { // Vertex in clip coordinates - gl_Position = projmodelviewMatrix * inVertex; + gl_Position = transform * inVertex; // Vertex in eye coordinates vec3 ecVertex = vec3(modelviewMatrix * inVertex); diff --git a/core/src/processing/opengl/PolyTexShaderVert.glsl b/core/src/processing/opengl/PolyTexShaderVert.glsl index bc257dda7..d34b69fe5 100644 --- a/core/src/processing/opengl/PolyTexShaderVert.glsl +++ b/core/src/processing/opengl/PolyTexShaderVert.glsl @@ -18,7 +18,7 @@ Boston, MA 02111-1307 USA */ -uniform mat4 projmodelviewMatrix; +uniform mat4 transform; uniform mat4 texcoordMatrix; attribute vec4 inVertex; @@ -29,7 +29,7 @@ varying vec4 vertColor; varying vec4 vertTexcoord; void main() { - gl_Position = projmodelviewMatrix * inVertex; + gl_Position = transform * inVertex; vertColor = inColor; vertTexcoord = texcoordMatrix * vec4(inTexcoord, 1.0, 1.0); diff --git a/core/src/processing/opengl/PolyTexlightShaderVert.glsl b/core/src/processing/opengl/PolyTexlightShaderVert.glsl index 7ce8cf92f..ce12288b6 100644 --- a/core/src/processing/opengl/PolyTexlightShaderVert.glsl +++ b/core/src/processing/opengl/PolyTexlightShaderVert.glsl @@ -19,7 +19,7 @@ */ uniform mat4 modelviewMatrix; -uniform mat4 projmodelviewMatrix; +uniform mat4 transform; uniform mat3 normalMatrix; uniform mat4 texcoordMatrix;