These need preprocessing too

This commit is contained in:
Jakub Valtar
2015-08-15 21:00:20 -04:00
parent 5910f49970
commit db6ab44cbe
2 changed files with 19 additions and 10 deletions

View File

@@ -1065,8 +1065,10 @@ public abstract class PGL {
PGL ppgl = primaryPGL ? this : pg.getPrimaryPGL();
if (!ppgl.loadedTex2DShader || ppgl.tex2DShaderContext != ppgl.glContext) {
String vertSource = PApplet.join(texVertShaderSource, "\n");
String fragSource = PApplet.join(tex2DFragShaderSource, "\n");
String[] preprocVertSrc = preprocessVertexSource(texVertShaderSource, getGLSLVersion());
String vertSource = PApplet.join(preprocVertSrc, "\n");
String[] preprocFragSrc = preprocessFragmentSource(tex2DFragShaderSource, getGLSLVersion());
String fragSource = PApplet.join(preprocFragSrc, "\n");
ppgl.tex2DVertShader = createShader(VERTEX_SHADER, vertSource);
ppgl.tex2DFragShader = createShader(FRAGMENT_SHADER, fragSource);
if (0 < ppgl.tex2DVertShader && 0 < ppgl.tex2DFragShader) {
@@ -1195,8 +1197,10 @@ public abstract class PGL {
PGL ppgl = primaryPGL ? this : pg.getPrimaryPGL();
if (!ppgl.loadedTexRectShader || ppgl.texRectShaderContext != ppgl.glContext) {
String vertSource = PApplet.join(texVertShaderSource, "\n");
String fragSource = PApplet.join(texRectFragShaderSource, "\n");
String[] preprocVertSrc = preprocessVertexSource(texVertShaderSource, getGLSLVersion());
String vertSource = PApplet.join(preprocVertSrc, "\n");
String[] preprocFragSrc = preprocessFragmentSource(texRectFragShaderSource, getGLSLVersion());
String fragSource = PApplet.join(preprocFragSrc, "\n");
ppgl.texRectVertShader = createShader(VERTEX_SHADER, vertSource);
ppgl.texRectFragShader = createShader(FRAGMENT_SHADER, fragSource);
if (0 < ppgl.texRectVertShader && 0 < ppgl.texRectFragShader) {
@@ -1616,6 +1620,11 @@ public abstract class PGL {
}
protected int getGLSLVersion() {
return 120;
}
protected String[] loadVertexShader(String filename) {
return pg.parent.loadStrings(filename);
}