fixes loadPixels() regression in opengl renderer

This commit is contained in:
codeanticode
2014-05-05 14:33:22 -04:00
parent b8d4b62158
commit c7c99b80a0
2 changed files with 10 additions and 7 deletions
@@ -6250,11 +6250,15 @@ public class PGraphicsOpenGL extends PGraphics {
protected void updateTexture(PImage img, Texture tex) {
if (tex != null) {
int x = img.getModifiedX1();
int y = img.getModifiedY1();
int w = img.getModifiedX2() - x;
int h = img.getModifiedY2() - y;
tex.set(img.pixels, x, y, w, h, img.format);
if (img.isModified()) {
int x = img.getModifiedX1();
int y = img.getModifiedY1();
int w = img.getModifiedX2() - x;
int h = img.getModifiedY2() - y;
tex.set(img.pixels, x, y, w, h, img.format);
} else if (img.isLoaded()) {
tex.set(img.pixels, 0, 0, img.width, img.height, img.format);
}
}
img.setModified(false);
img.setLoaded(false);
+1 -2
View File
@@ -329,8 +329,7 @@ public class Texture implements PConstants {
return;
}
if (pixels.length == 0) {
// Nothing to do (means that w == h == 0) but not an erroneous situation
if (pixels.length == 0 || w == 0 || h == 0) {
return;
}