Skip to content

Commit e558427

Browse files
committed
sync latest fix from desktop gl
1 parent d2269f3 commit e558427

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

core/src/processing/opengl/PGraphicsOpenGL.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6250,11 +6250,15 @@ protected PImage wrapTexture(Texture tex) {
62506250

62516251
protected void updateTexture(PImage img, Texture tex) {
62526252
if (tex != null) {
6253-
int x = img.getModifiedX1();
6254-
int y = img.getModifiedY1();
6255-
int w = img.getModifiedX2() - x;
6256-
int h = img.getModifiedY2() - y;
6257-
tex.set(img.pixels, x, y, w, h, img.format);
6253+
if (img.isModified()) {
6254+
int x = img.getModifiedX1();
6255+
int y = img.getModifiedY1();
6256+
int w = img.getModifiedX2() - x;
6257+
int h = img.getModifiedY2() - y;
6258+
tex.set(img.pixels, x, y, w, h, img.format);
6259+
} else if (img.isLoaded()) {
6260+
tex.set(img.pixels, 0, 0, img.width, img.height, img.format);
6261+
}
62586262
}
62596263
img.setModified(false);
62606264
img.setLoaded(false);

core/src/processing/opengl/Texture.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,7 @@ public void set(int[] pixels, int x, int y, int w, int h, int format) {
329329
return;
330330
}
331331

332-
if (pixels.length == 0) {
333-
// Nothing to do (means that w == h == 0) but not an erroneous situation
332+
if (pixels.length == 0 || w == 0 || h == 0) {
334333
return;
335334
}
336335

@@ -1267,7 +1266,7 @@ protected void copyTexture(Texture tex, int x, int y, int w, int h,
12671266
pg.setFramebuffer(tempFbo);
12681267
// Clear the color buffer to make sure that the alpha channel is set to
12691268
// full transparency
1270-
pgl.clearColor(1, 1, 1, 1);
1269+
pgl.clearColor(0, 0, 0, 0);
12711270
pgl.clear(PGL.COLOR_BUFFER_BIT);
12721271
if (scale) {
12731272
// Rendering tex into "this", and scaling the source rectangle

0 commit comments

Comments
 (0)