added resolution uniform

This commit is contained in:
codeanticode
2016-10-12 16:29:00 -04:00
parent 8ad3c11f93
commit 45062aff5e
+8
View File
@@ -122,6 +122,7 @@ public class PShader implements PConstants {
protected int ppixelsLoc;
protected int ppixelsUnit;
protected int viewportLoc;
protected int resolutionLoc;
// Uniforms only for lines and points
protected int perspectiveLoc;
@@ -1148,6 +1149,7 @@ public class PShader implements PConstants {
projectionMatLoc = getUniformLoc("projectionMatrix");
viewportLoc = getUniformLoc("viewport");
resolutionLoc = getUniformLoc("resolution");
ppixelsLoc = getUniformLoc("ppixels");
normalMatLoc = getUniformLoc("normalMatrix");
@@ -1199,6 +1201,12 @@ public class PShader implements PConstants {
setUniformValue(viewportLoc, x, y, w, h);
}
if (-1 < resolutionLoc) {
float w = currentPG.viewport.get(2);
float h = currentPG.viewport.get(3);
setUniformValue(resolutionLoc, w, h);
}
if (-1 < ppixelsLoc) {
ppixelsUnit = getLastTexUnit() + 1;
setUniformValue(ppixelsLoc, ppixelsUnit);