picrate 0.2.0-java → 0.3.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +8 -5
- data/Rakefile +10 -2
- data/docs/_posts/2018-06-26-auto_install_picrate.md +15 -0
- data/lib/export.txt +8 -0
- data/lib/picrate/app.rb +4 -4
- data/lib/picrate/version.rb +1 -1
- data/picrate.gemspec +1 -1
- data/pom.rb +1 -1
- data/pom.xml +1 -1
- data/src/main/java/processing/awt/PGraphicsJava2D.java +16 -85
- data/src/main/java/processing/awt/PShapeJava2D.java +9 -33
- data/src/main/java/processing/awt/PSurfaceAWT.java +76 -169
- data/src/main/java/processing/core/PApplet.java +14019 -15963
- data/src/main/java/processing/core/PConstants.java +475 -981
- data/src/main/java/processing/core/PFont.java +50 -202
- data/src/main/java/processing/core/PGraphics.java +7330 -8477
- data/src/main/java/processing/core/PImage.java +42 -212
- data/src/main/java/processing/core/PMatrix.java +21 -160
- data/src/main/java/processing/core/PMatrix2D.java +18 -178
- data/src/main/java/processing/core/PMatrix3D.java +48 -324
- data/src/main/java/processing/core/PShape.java +294 -1181
- data/src/main/java/processing/core/PShapeOBJ.java +16 -91
- data/src/main/java/processing/core/PShapeSVG.java +53 -253
- data/src/main/java/processing/core/PStyle.java +34 -179
- data/src/main/java/processing/core/PSurface.java +13 -94
- data/src/main/java/processing/core/PSurfaceNone.java +35 -140
- data/src/main/java/processing/core/PVector.java +10 -87
- data/src/main/java/processing/event/Event.java +86 -69
- data/src/main/java/processing/event/MouseEvent.java +102 -102
- data/src/main/java/processing/opengl/PGL.java +23 -16
- data/src/main/java/processing/opengl/PGraphicsOpenGL.java +13 -10
- data/src/main/java/processing/opengl/PJOGL.java +32 -12
- data/src/main/java/processing/opengl/shaders/LightVert-brcm.glsl +154 -0
- data/src/main/java/processing/opengl/shaders/LightVert-vc4.glsl +2 -2
- data/src/main/java/processing/opengl/shaders/TexLightVert-brcm.glsl +160 -0
- data/src/main/java/processing/opengl/shaders/TexLightVert-vc4.glsl +2 -2
- metadata +7 -3
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
2
2
|
|
3
|
-
|
3
|
+
/*
|
4
4
|
Part of the Processing project - http://processing.org
|
5
5
|
|
6
6
|
Copyright (c) 2012 The Processing Foundation
|
@@ -18,132 +18,132 @@
|
|
18
18
|
Public License along with this library; if not, write to the
|
19
19
|
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
20
20
|
Boston, MA 02111-1307 USA
|
21
|
-
|
21
|
+
*/
|
22
|
+
|
22
23
|
package processing.event;
|
23
24
|
|
24
25
|
//import processing.core.PConstants;
|
25
|
-
public class MouseEvent extends Event {
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
27
|
+
|
28
|
+
public class MouseEvent extends Event {
|
29
|
+
static public final int PRESS = 1;
|
30
|
+
static public final int RELEASE = 2;
|
31
|
+
static public final int CLICK = 3;
|
32
|
+
static public final int DRAG = 4;
|
33
|
+
static public final int MOVE = 5;
|
34
|
+
static public final int ENTER = 6;
|
35
|
+
static public final int EXIT = 7;
|
36
|
+
static public final int WHEEL = 8;
|
37
|
+
|
38
|
+
protected int x, y;
|
39
|
+
protected int button;
|
38
40
|
// protected int clickCount;
|
39
41
|
// protected float amount;
|
40
|
-
|
42
|
+
protected int count;
|
43
|
+
|
41
44
|
|
42
45
|
// public MouseEvent(int x, int y) {
|
43
46
|
// this(null,
|
44
47
|
// System.currentTimeMillis(), PRESSED, 0,
|
45
48
|
// x, y, PConstants.LEFT, 1);
|
46
49
|
// }
|
47
|
-
public MouseEvent(Object nativeObject,
|
48
|
-
long millis, int action, int modifiers,
|
49
|
-
int x, int y, int button, int count) { //float amount) { //int clickCount) {
|
50
|
-
super(nativeObject, millis, action, modifiers);
|
51
|
-
this.flavor = MOUSE;
|
52
|
-
this.x = x;
|
53
|
-
this.y = y;
|
54
|
-
this.button = button;
|
55
|
-
//this.clickCount = clickCount;
|
56
|
-
//this.amount = amount;
|
57
|
-
this.count = count;
|
58
|
-
}
|
59
50
|
|
60
|
-
public int getX() {
|
61
|
-
return x;
|
62
|
-
}
|
63
51
|
|
64
|
-
|
65
|
-
|
66
|
-
|
52
|
+
public MouseEvent(Object nativeObject,
|
53
|
+
long millis, int action, int modifiers,
|
54
|
+
int x, int y, int button, int count) { //float amount) { //int clickCount) {
|
55
|
+
super(nativeObject, millis, action, modifiers);
|
56
|
+
this.flavor = MOUSE;
|
57
|
+
this.x = x;
|
58
|
+
this.y = y;
|
59
|
+
this.button = button;
|
60
|
+
//this.clickCount = clickCount;
|
61
|
+
//this.amount = amount;
|
62
|
+
this.count = count;
|
63
|
+
}
|
64
|
+
|
65
|
+
|
66
|
+
public int getX() {
|
67
|
+
return x;
|
68
|
+
}
|
69
|
+
|
70
|
+
|
71
|
+
public int getY() {
|
72
|
+
return y;
|
73
|
+
}
|
74
|
+
|
75
|
+
|
76
|
+
/** Which button was pressed, either LEFT, CENTER, or RIGHT. */
|
77
|
+
public int getButton() {
|
78
|
+
return button;
|
79
|
+
}
|
67
80
|
|
68
|
-
/**
|
69
|
-
* Which button was pressed, either LEFT, CENTER, or RIGHT.
|
70
|
-
*
|
71
|
-
* @return
|
72
|
-
*/
|
73
|
-
public int getButton() {
|
74
|
-
return button;
|
75
|
-
}
|
76
81
|
|
77
82
|
// public void setButton(int button) {
|
78
83
|
// this.button = button;
|
79
84
|
// }
|
80
|
-
/**
|
81
|
-
* Do not use, getCount() is the correct method.
|
82
|
-
*
|
83
|
-
* @return
|
84
|
-
*/
|
85
|
-
@Deprecated
|
86
|
-
public int getClickCount() {
|
87
|
-
//return (int) amount; //clickCount;
|
88
|
-
return count;
|
89
|
-
}
|
90
85
|
|
91
|
-
/**
|
92
|
-
* Do not use, getCount() is the correct method.
|
93
|
-
*
|
94
|
-
* @return
|
95
|
-
*/
|
96
|
-
@Deprecated
|
97
|
-
public float getAmount() {
|
98
|
-
//return amount;
|
99
|
-
return count;
|
100
|
-
}
|
101
86
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
87
|
+
/** Do not use, getCount() is the correct method. */
|
88
|
+
@Deprecated
|
89
|
+
public int getClickCount() {
|
90
|
+
//return (int) amount; //clickCount;
|
91
|
+
return count;
|
92
|
+
}
|
93
|
+
|
94
|
+
|
95
|
+
/** Do not use, getCount() is the correct method. */
|
96
|
+
@Deprecated
|
97
|
+
public float getAmount() {
|
98
|
+
//return amount;
|
99
|
+
return count;
|
100
|
+
}
|
101
|
+
|
102
|
+
|
103
|
+
/**
|
104
|
+
* Number of clicks for mouse button events, or the number of steps (positive
|
105
|
+
* or negative depending on direction) for a mouse wheel event.
|
106
|
+
* Wheel events follow Java (see <a href="http://docs.oracle.com/javase/6/docs/api/java/awt/event/MouseWheelEvent.html#getWheelRotation()">here</a>), so
|
107
|
+
* getAmount() will return "negative values if the mouse wheel was rotated
|
108
|
+
* up or away from the user" and positive values in the other direction.
|
109
|
+
* On Mac OS X, this will be reversed when "natural" scrolling is enabled
|
110
|
+
* in System Preferences &rarr Mouse.
|
111
|
+
*/
|
112
|
+
public int getCount() {
|
113
|
+
return count;
|
114
|
+
}
|
115
|
+
|
117
116
|
|
118
117
|
// public void setClickCount(int clickCount) {
|
119
118
|
// this.clickCount = clickCount;
|
120
119
|
// }
|
121
|
-
private String actionString() {
|
122
|
-
switch (action) {
|
123
|
-
default:
|
124
|
-
return "UNKNOWN";
|
125
|
-
case CLICK:
|
126
|
-
return "CLICK";
|
127
|
-
case DRAG:
|
128
|
-
return "DRAG";
|
129
|
-
case ENTER:
|
130
|
-
return "ENTER";
|
131
|
-
case EXIT:
|
132
|
-
return "EXIT";
|
133
|
-
case MOVE:
|
134
|
-
return "MOVE";
|
135
|
-
case PRESS:
|
136
|
-
return "PRESS";
|
137
|
-
case RELEASE:
|
138
|
-
return "RELEASE";
|
139
|
-
case WHEEL:
|
140
|
-
return "WHEEL";
|
141
|
-
}
|
142
|
-
}
|
143
120
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
121
|
+
private String actionString() {
|
122
|
+
switch (action) {
|
123
|
+
default:
|
124
|
+
return "UNKNOWN";
|
125
|
+
case CLICK:
|
126
|
+
return "CLICK";
|
127
|
+
case DRAG:
|
128
|
+
return "DRAG";
|
129
|
+
case ENTER:
|
130
|
+
return "ENTER";
|
131
|
+
case EXIT:
|
132
|
+
return "EXIT";
|
133
|
+
case MOVE:
|
134
|
+
return "MOVE";
|
135
|
+
case PRESS:
|
136
|
+
return "PRESS";
|
137
|
+
case RELEASE:
|
138
|
+
return "RELEASE";
|
139
|
+
case WHEEL:
|
140
|
+
return "WHEEL";
|
148
141
|
}
|
142
|
+
}
|
143
|
+
|
144
|
+
@Override
|
145
|
+
public String toString() {
|
146
|
+
return String.format("<MouseEvent %s@%d,%d count:%d button:%d>",
|
147
|
+
actionString(), x, y, count, button);
|
148
|
+
}
|
149
149
|
}
|
@@ -1287,9 +1287,9 @@ public abstract class PGL {
|
|
1287
1287
|
PGL ppgl = primaryPGL ? this : graphics.getPrimaryPGL();
|
1288
1288
|
|
1289
1289
|
if (!ppgl.loadedTex2DShader || ppgl.tex2DShaderContext != ppgl.glContext) {
|
1290
|
-
String[] preprocVertSrc = preprocessVertexSource(texVertShaderSource, getGLSLVersion());
|
1290
|
+
String[] preprocVertSrc = preprocessVertexSource(texVertShaderSource, getGLSLVersion(), getGLSLVersionSuffix());
|
1291
1291
|
String vertSource = PApplet.join(preprocVertSrc, "\n");
|
1292
|
-
String[] preprocFragSrc = preprocessFragmentSource(tex2DFragShaderSource, getGLSLVersion());
|
1292
|
+
String[] preprocFragSrc = preprocessFragmentSource(tex2DFragShaderSource, getGLSLVersion(), getGLSLVersionSuffix());
|
1293
1293
|
String fragSource = PApplet.join(preprocFragSrc, "\n");
|
1294
1294
|
ppgl.tex2DVertShader = createShader(VERTEX_SHADER, vertSource);
|
1295
1295
|
ppgl.tex2DFragShader = createShader(FRAGMENT_SHADER, fragSource);
|
@@ -1419,9 +1419,9 @@ public abstract class PGL {
|
|
1419
1419
|
PGL ppgl = primaryPGL ? this : graphics.getPrimaryPGL();
|
1420
1420
|
|
1421
1421
|
if (!ppgl.loadedTexRectShader || ppgl.texRectShaderContext != ppgl.glContext) {
|
1422
|
-
String[] preprocVertSrc = preprocessVertexSource(texVertShaderSource, getGLSLVersion());
|
1422
|
+
String[] preprocVertSrc = preprocessVertexSource(texVertShaderSource, getGLSLVersion(), getGLSLVersionSuffix());
|
1423
1423
|
String vertSource = PApplet.join(preprocVertSrc, "\n");
|
1424
|
-
String[] preprocFragSrc = preprocessFragmentSource(texRectFragShaderSource, getGLSLVersion());
|
1424
|
+
String[] preprocFragSrc = preprocessFragmentSource(texRectFragShaderSource, getGLSLVersion(), getGLSLVersionSuffix());
|
1425
1425
|
String fragSource = PApplet.join(preprocFragSrc, "\n");
|
1426
1426
|
ppgl.texRectVertShader = createShader(VERTEX_SHADER, vertSource);
|
1427
1427
|
ppgl.texRectFragShader = createShader(FRAGMENT_SHADER, fragSource);
|
@@ -1848,6 +1848,7 @@ public abstract class PGL {
|
|
1848
1848
|
|
1849
1849
|
|
1850
1850
|
abstract protected int getGLSLVersion();
|
1851
|
+
abstract protected String getGLSLVersionSuffix();
|
1851
1852
|
|
1852
1853
|
|
1853
1854
|
protected String[] loadVertexShader(String filename) {
|
@@ -1880,28 +1881,29 @@ public abstract class PGL {
|
|
1880
1881
|
}
|
1881
1882
|
|
1882
1883
|
|
1883
|
-
protected String[] loadVertexShader(String filename, int version) {
|
1884
|
+
protected String[] loadVertexShader(String filename, int version, String versionSuffix) {
|
1884
1885
|
return loadVertexShader(filename);
|
1885
1886
|
}
|
1886
1887
|
|
1887
1888
|
|
1888
|
-
protected String[] loadFragmentShader(String filename, int version) {
|
1889
|
+
protected String[] loadFragmentShader(String filename, int version, String versionSuffix) {
|
1889
1890
|
return loadFragmentShader(filename);
|
1890
1891
|
}
|
1891
1892
|
|
1892
1893
|
|
1893
|
-
protected String[] loadFragmentShader(URL url, int version) {
|
1894
|
+
protected String[] loadFragmentShader(URL url, int version, String versionSuffix) {
|
1894
1895
|
return loadFragmentShader(url);
|
1895
1896
|
}
|
1896
1897
|
|
1897
1898
|
|
1898
|
-
protected String[] loadVertexShader(URL url, int version) {
|
1899
|
+
protected String[] loadVertexShader(URL url, int version, String versionSuffix) {
|
1899
1900
|
return loadVertexShader(url);
|
1900
1901
|
}
|
1901
1902
|
|
1902
1903
|
|
1903
1904
|
protected static String[] preprocessFragmentSource(String[] fragSrc0,
|
1904
|
-
int version
|
1905
|
+
int version,
|
1906
|
+
String versionSuffix) {
|
1905
1907
|
if (containsVersionDirective(fragSrc0)) {
|
1906
1908
|
// The user knows what she or he is doing
|
1907
1909
|
return fragSrc0;
|
@@ -1915,7 +1917,7 @@ public abstract class PGL {
|
|
1915
1917
|
int offset = 1;
|
1916
1918
|
|
1917
1919
|
fragSrc = preprocessShaderSource(fragSrc0, search, replace, offset);
|
1918
|
-
fragSrc[0] = "#version " + version;
|
1920
|
+
fragSrc[0] = "#version " + version + versionSuffix;
|
1919
1921
|
} else {
|
1920
1922
|
// We need to replace 'texture' uniform by 'texMap' uniform and
|
1921
1923
|
// 'textureXXX()' functions by 'texture()' functions. Order of these
|
@@ -1932,15 +1934,20 @@ public abstract class PGL {
|
|
1932
1934
|
int offset = 2;
|
1933
1935
|
|
1934
1936
|
fragSrc = preprocessShaderSource(fragSrc0, search, replace, offset);
|
1935
|
-
fragSrc[0] = "#version " + version;
|
1936
|
-
|
1937
|
+
fragSrc[0] = "#version " + version + versionSuffix;
|
1938
|
+
if (" es".equals(versionSuffix)) {
|
1939
|
+
fragSrc[1] = "out mediump vec4 _fragColor;";
|
1940
|
+
} else {
|
1941
|
+
fragSrc[1] = "out vec4 _fragColor;";
|
1942
|
+
}
|
1937
1943
|
}
|
1938
1944
|
|
1939
1945
|
return fragSrc;
|
1940
1946
|
}
|
1941
1947
|
|
1942
1948
|
protected static String[] preprocessVertexSource(String[] vertSrc0,
|
1943
|
-
int version
|
1949
|
+
int version,
|
1950
|
+
String versionSuffix) {
|
1944
1951
|
if (containsVersionDirective(vertSrc0)) {
|
1945
1952
|
// The user knows what she or he is doing
|
1946
1953
|
return vertSrc0;
|
@@ -1954,7 +1961,7 @@ public abstract class PGL {
|
|
1954
1961
|
int offset = 1;
|
1955
1962
|
|
1956
1963
|
vertSrc = preprocessShaderSource(vertSrc0, search, replace, offset);
|
1957
|
-
vertSrc[0] = "#version " + version;
|
1964
|
+
vertSrc[0] = "#version " + version + versionSuffix;
|
1958
1965
|
} else {
|
1959
1966
|
// We need to replace 'texture' uniform by 'texMap' uniform and
|
1960
1967
|
// 'textureXXX()' functions by 'texture()' functions. Order of these
|
@@ -1971,7 +1978,7 @@ public abstract class PGL {
|
|
1971
1978
|
int offset = 1;
|
1972
1979
|
|
1973
1980
|
vertSrc = preprocessShaderSource(vertSrc0, search, replace, offset);
|
1974
|
-
vertSrc[0] = "#version " + version;
|
1981
|
+
vertSrc[0] = "#version " + version + versionSuffix;
|
1975
1982
|
}
|
1976
1983
|
|
1977
1984
|
return vertSrc;
|
@@ -2225,7 +2232,7 @@ public abstract class PGL {
|
|
2225
2232
|
|
2226
2233
|
protected boolean hasAnisoSamplingSupport() {
|
2227
2234
|
int major = getGLVersion()[0];
|
2228
|
-
if (major < 3) {
|
2235
|
+
if (isES() || major < 3) {
|
2229
2236
|
String ext = getString(EXTENSIONS);
|
2230
2237
|
return -1 < ext.indexOf("_texture_filter_anisotropic");
|
2231
2238
|
} else {
|
@@ -1561,13 +1561,14 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
1561
1561
|
}
|
1562
1562
|
pgl.depthFunc(PGL.LEQUAL);
|
1563
1563
|
|
1564
|
-
if (
|
1565
|
-
//
|
1566
|
-
// ignore for now
|
1564
|
+
if (pgl.isES()) {
|
1565
|
+
// neither GL_MULTISAMPLE nor GL_POLYGON_SMOOTH are part of GLES2 or GLES3
|
1567
1566
|
} else if (smooth < 1) {
|
1568
1567
|
pgl.disable(PGL.MULTISAMPLE);
|
1569
1568
|
} else if (1 <= smooth) {
|
1570
1569
|
pgl.enable(PGL.MULTISAMPLE);
|
1570
|
+
}
|
1571
|
+
if (!pgl.isES()) {
|
1571
1572
|
pgl.disable(PGL.POLYGON_SMOOTH);
|
1572
1573
|
}
|
1573
1574
|
|
@@ -6775,16 +6776,14 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
6775
6776
|
// quality = temp;
|
6776
6777
|
// }
|
6777
6778
|
}
|
6778
|
-
if (
|
6779
|
-
//
|
6780
|
-
// ignore for now
|
6779
|
+
if (pgl.isES()) {
|
6780
|
+
// neither GL_MULTISAMPLE nor GL_POLYGON_SMOOTH are part of GLES2 or GLES3
|
6781
6781
|
} else if (smooth < 1) {
|
6782
6782
|
pgl.disable(PGL.MULTISAMPLE);
|
6783
6783
|
} else if (1 <= smooth) {
|
6784
6784
|
pgl.enable(PGL.MULTISAMPLE);
|
6785
6785
|
}
|
6786
|
-
|
6787
|
-
if (false == OPENGL_RENDERER.equals("VideoCore IV HW")) {
|
6786
|
+
if (!pgl.isES()) {
|
6788
6787
|
pgl.disable(PGL.POLYGON_SMOOTH);
|
6789
6788
|
}
|
6790
6789
|
|
@@ -6895,8 +6894,12 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
6895
6894
|
|
6896
6895
|
// overwrite the default shaders with vendor specific versions
|
6897
6896
|
// if needed
|
6898
|
-
if (OPENGL_RENDERER.equals("VideoCore IV HW")
|
6899
|
-
|
6897
|
+
if (OPENGL_RENDERER.equals("VideoCore IV HW")) { // Broadcom's binary driver for Raspberry Pi
|
6898
|
+
defLightShaderVertURL =
|
6899
|
+
PGraphicsOpenGL.class.getResource("/processing/opengl/shaders/LightVert-brcm.glsl");
|
6900
|
+
defTexlightShaderVertURL =
|
6901
|
+
PGraphicsOpenGL.class.getResource("/processing/opengl/shaders/TexLightVert-brcm.glsl");
|
6902
|
+
} else if (OPENGL_RENDERER.contains("VC4")) { // Mesa driver for same hardware
|
6900
6903
|
defLightShaderVertURL =
|
6901
6904
|
PGraphicsOpenGL.class.getResource("/processing/opengl/shaders/LightVert-vc4.glsl");
|
6902
6905
|
defTexlightShaderVertURL =
|
@@ -509,50 +509,59 @@ public class PJOGL extends PGL {
|
|
509
509
|
return vn.getMajor() * 100 + vn.getMinor();
|
510
510
|
}
|
511
511
|
|
512
|
+
protected String getGLSLVersionSuffix() {
|
513
|
+
VersionNumber vn = context.getGLSLVersionNumber();
|
514
|
+
if (context.isGLESProfile() && 1 < vn.getMajor()) {
|
515
|
+
return " es";
|
516
|
+
} else {
|
517
|
+
return "";
|
518
|
+
}
|
519
|
+
}
|
520
|
+
|
512
521
|
|
513
522
|
@Override
|
514
523
|
protected String[] loadVertexShader(String filename) {
|
515
|
-
return loadVertexShader(filename, getGLSLVersion());
|
524
|
+
return loadVertexShader(filename, getGLSLVersion(), getGLSLVersionSuffix());
|
516
525
|
}
|
517
526
|
|
518
527
|
|
519
528
|
@Override
|
520
529
|
protected String[] loadFragmentShader(String filename) {
|
521
|
-
return loadFragmentShader(filename, getGLSLVersion());
|
530
|
+
return loadFragmentShader(filename, getGLSLVersion(), getGLSLVersionSuffix());
|
522
531
|
}
|
523
532
|
|
524
533
|
|
525
534
|
@Override
|
526
535
|
protected String[] loadVertexShader(URL url) {
|
527
|
-
return loadVertexShader(url, getGLSLVersion());
|
536
|
+
return loadVertexShader(url, getGLSLVersion(), getGLSLVersionSuffix());
|
528
537
|
}
|
529
538
|
|
530
539
|
|
531
540
|
@Override
|
532
541
|
protected String[] loadFragmentShader(URL url) {
|
533
|
-
return loadFragmentShader(url, getGLSLVersion());
|
542
|
+
return loadFragmentShader(url, getGLSLVersion(), getGLSLVersionSuffix());
|
534
543
|
}
|
535
544
|
|
536
545
|
|
537
546
|
@Override
|
538
|
-
protected String[] loadFragmentShader(String filename, int version) {
|
547
|
+
protected String[] loadFragmentShader(String filename, int version, String versionSuffix) {
|
539
548
|
String[] fragSrc0 = sketch.loadStrings(filename);
|
540
|
-
return preprocessFragmentSource(fragSrc0, version);
|
549
|
+
return preprocessFragmentSource(fragSrc0, version, versionSuffix);
|
541
550
|
}
|
542
551
|
|
543
552
|
|
544
553
|
@Override
|
545
|
-
protected String[] loadVertexShader(String filename, int version) {
|
554
|
+
protected String[] loadVertexShader(String filename, int version, String versionSuffix) {
|
546
555
|
String[] vertSrc0 = sketch.loadStrings(filename);
|
547
|
-
return preprocessVertexSource(vertSrc0, version);
|
556
|
+
return preprocessVertexSource(vertSrc0, version, versionSuffix);
|
548
557
|
}
|
549
558
|
|
550
559
|
|
551
560
|
@Override
|
552
|
-
protected String[] loadFragmentShader(URL url, int version) {
|
561
|
+
protected String[] loadFragmentShader(URL url, int version, String versionSuffix) {
|
553
562
|
try {
|
554
563
|
String[] fragSrc0 = PApplet.loadStrings(url.openStream());
|
555
|
-
return preprocessFragmentSource(fragSrc0, version);
|
564
|
+
return preprocessFragmentSource(fragSrc0, version, versionSuffix);
|
556
565
|
} catch (IOException e) {
|
557
566
|
PGraphics.showException("Cannot load fragment shader " + url.getFile());
|
558
567
|
}
|
@@ -561,10 +570,10 @@ public class PJOGL extends PGL {
|
|
561
570
|
|
562
571
|
|
563
572
|
@Override
|
564
|
-
protected String[] loadVertexShader(URL url, int version) {
|
573
|
+
protected String[] loadVertexShader(URL url, int version, String versionSuffix) {
|
565
574
|
try {
|
566
575
|
String[] vertSrc0 = PApplet.loadStrings(url.openStream());
|
567
|
-
return preprocessVertexSource(vertSrc0, version);
|
576
|
+
return preprocessVertexSource(vertSrc0, version, versionSuffix);
|
568
577
|
} catch (IOException e) {
|
569
578
|
PGraphics.showException("Cannot load vertex shader " + url.getFile());
|
570
579
|
}
|
@@ -1926,6 +1935,8 @@ public class PJOGL extends PGL {
|
|
1926
1935
|
gl2x.glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
|
1927
1936
|
} else if (gl3 != null) {
|
1928
1937
|
gl3.glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
|
1938
|
+
} else if (gl3es3 != null) {
|
1939
|
+
gl3es3.glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
|
1929
1940
|
} else {
|
1930
1941
|
throw new RuntimeException(String.format(MISSING_GLFUNC_ERROR, "glBlitFramebuffer()"));
|
1931
1942
|
}
|
@@ -1937,6 +1948,8 @@ public class PJOGL extends PGL {
|
|
1937
1948
|
gl2x.glRenderbufferStorageMultisample(target, samples, format, width, height);
|
1938
1949
|
} else if (gl3 != null) {
|
1939
1950
|
gl3.glRenderbufferStorageMultisample(target, samples, format, width, height);
|
1951
|
+
} else if (gl3es3 != null) {
|
1952
|
+
gl3es3.glRenderbufferStorageMultisample(target, samples, format, width, height);
|
1940
1953
|
} else {
|
1941
1954
|
throw new RuntimeException(String.format(MISSING_GLFUNC_ERROR, "glRenderbufferStorageMultisample()"));
|
1942
1955
|
}
|
@@ -1948,6 +1961,8 @@ public class PJOGL extends PGL {
|
|
1948
1961
|
gl2x.glReadBuffer(buf);
|
1949
1962
|
} else if (gl3 != null) {
|
1950
1963
|
gl3.glReadBuffer(buf);
|
1964
|
+
} else if (gl3es3 != null) {
|
1965
|
+
gl3es3.glReadBuffer(buf);
|
1951
1966
|
} else {
|
1952
1967
|
throw new RuntimeException(String.format(MISSING_GLFUNC_ERROR, "glReadBuffer()"));
|
1953
1968
|
}
|
@@ -1959,6 +1974,11 @@ public class PJOGL extends PGL {
|
|
1959
1974
|
gl2x.glDrawBuffer(buf);
|
1960
1975
|
} else if (gl3 != null) {
|
1961
1976
|
gl3.glDrawBuffer(buf);
|
1977
|
+
} else if (gl3es3 != null) {
|
1978
|
+
IntBuffer intBuffer = IntBuffer.allocate(1);
|
1979
|
+
intBuffer.put(buf);
|
1980
|
+
intBuffer.rewind();
|
1981
|
+
gl3es3.glDrawBuffers(1, intBuffer);
|
1962
1982
|
} else {
|
1963
1983
|
throw new RuntimeException(String.format(MISSING_GLFUNC_ERROR, "glDrawBuffer()"));
|
1964
1984
|
}
|