mirror of
https://github.com/processing/processing4.git
synced 2026-02-03 21:59:20 +01:00
completed new implementation of image cache handling
This commit is contained in:
@@ -5389,6 +5389,18 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
return tex;
|
||||
}
|
||||
|
||||
|
||||
public void initCache(PImage img) {
|
||||
Texture tex = (Texture)img.getCache(pgPrimary);
|
||||
if (tex == null) {
|
||||
tex = addTexture(img);
|
||||
} else {
|
||||
if (tex.contextIsOutdated()) {
|
||||
tex = addTexture(img);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This utility method creates a texture for the provided image, and adds it
|
||||
@@ -5424,7 +5436,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
img.setCache(pgPrimary, tex);
|
||||
return tex;
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected Texture addTexture(PImage img, Texture.Parameters params) {
|
||||
Texture tex = new Texture(img.parent, img.width, img.height, params);
|
||||
|
||||
Reference in New Issue
Block a user