From 4bb1d9e373ccd00a8c64fcb305d406c9a47d3b2e Mon Sep 17 00:00:00 2001 From: Jakub Valtar Date: Fri, 21 Jul 2017 11:41:53 +0200 Subject: [PATCH] Update shader preprocessing to strip version correctly Previously the whole line was removed, now only the end of the line is removed to handle the case when version is in a comment --- core/src/processing/opengl/PGL.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/processing/opengl/PGL.java b/core/src/processing/opengl/PGL.java index 259ba99f0..4620e9cf2 100644 --- a/core/src/processing/opengl/PGL.java +++ b/core/src/processing/opengl/PGL.java @@ -1989,8 +1989,9 @@ public abstract class PGL { String[] src = new String[src0.length+offset]; for (int i = 0; i < src0.length; i++) { String line = src0[i]; - if (line.contains("#version")) { - line = ""; + int versionIndex = line.indexOf("#version"); + if (versionIndex >= 0) { + line = line.substring(0, versionIndex); } for (int j = 0; j < search.length; j++) { line = search[j].matcher(line).replaceAll(replace[j]);