Skip to content

Commit c0f67a6

Browse files
committed
android sync
1 parent 43769b5 commit c0f67a6

File tree

1 file changed

+16
-24
lines changed

1 file changed

+16
-24
lines changed

core/src/processing/opengl/PGraphicsOpenGL.java

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5282,22 +5282,11 @@ protected void backgroundImpl(PImage image) {
52825282
protected void backgroundImpl() {
52835283
flush();
52845284

5285-
pgl.depthMask(true);
5286-
pgl.clearDepth(1);
5287-
pgl.clear(PGL.DEPTH_BUFFER_BIT);
5288-
if (hints[DISABLE_DEPTH_MASK]) {
5289-
pgl.depthMask(false);
5290-
} else {
5291-
pgl.depthMask(true);
5285+
if (!hints[DISABLE_DEPTH_MASK]) {
5286+
pgl.clearDepth(1);
5287+
pgl.clear(PGL.DEPTH_BUFFER_BIT);
52925288
}
52935289

5294-
// Code to use instead in order to fix
5295-
// https://github.com/processing/processing/issues/2296
5296-
// if (!hints[DISABLE_DEPTH_MASK]) {
5297-
// pgl.clearDepth(1);
5298-
// pgl.clear(PGL.DEPTH_BUFFER_BIT);
5299-
// }
5300-
53015290
pgl.clearColor(backgroundR, backgroundG, backgroundB, backgroundA);
53025291
pgl.clear(PGL.COLOR_BUFFER_BIT);
53035292
if (0 < parent.frameCount) {
@@ -6381,14 +6370,13 @@ protected void beginOffscreenDraw() {
63816370

63826371

63836372
protected void endOffscreenDraw() {
6384-
// Set alpha channel to opaque in order to match behavior of JAVA2D:
6385-
// https://github.com/processing/processing/issues/1844
6386-
// but still not working as expected. Some strange artifacts with multismapled
6387-
// surfaces (see second code example in the issue above).
6388-
// pgl.colorMask(false, false, false, true);
6389-
// pgl.clearColor(0, 0, 0, 1);
6390-
// pgl.clear(PGL.COLOR_BUFFER_BIT);
6391-
// pgl.colorMask(true, true, true, true);
6373+
if (backgroundA == 1) {
6374+
// Set alpha channel to opaque in order to match behavior of JAVA2D:
6375+
pgl.colorMask(false, false, false, true);
6376+
pgl.clearColor(0, 0, 0, backgroundA);
6377+
pgl.clear(PGL.COLOR_BUFFER_BIT);
6378+
pgl.colorMask(true, true, true, true);
6379+
}
63926380

63936381
if (offscreenMultisample) {
63946382
multisampleFramebuffer.copyColor(offscreenFramebuffer);
@@ -6454,7 +6442,12 @@ protected void setDrawDefaults() {
64546442

64556443
// To avoid having garbage in the screen after a resize,
64566444
// in the case background is not called in draw().
6457-
background(backgroundColor);
6445+
if (primarySurface) {
6446+
background(backgroundColor);
6447+
} else {
6448+
// offscreen surfaces are transparent by default.
6449+
background(0x00 << 24 | (backgroundColor & 0xFFFFFF));
6450+
}
64586451

64596452
// Sets the default projection and camera (initializes modelview).
64606453
// If the user has setup up their own projection, they'll need
@@ -11916,7 +11909,6 @@ public void begin(int type) {
1191611909
vertFirst = cache.vertexCount[cacheIndex];
1191711910
vertOffset = cache.vertexOffset[cacheIndex];
1191811911
vertCount = 0;
11919-
System.out.println(vertFirst + " " + vertOffset);
1192011912

1192111913
if (type == PGL.TRIANGLE_FAN) primitive = TRIANGLE_FAN;
1192211914
else if (type == PGL.TRIANGLE_STRIP) primitive = TRIANGLE_STRIP;

0 commit comments

Comments
 (0)