not sure if this is a new problem since the upgrade to processing 4, but images around 2mb or larger consistently dont work because the render window stretches far off screen and causes the following error message:
java.lang.NullPointerException: Cannot invoke "java.awt.image.VolatileImage.validate(java.awt.GraphicsConfiguration)" because "this.backBuffers[...]" is null
at java.desktop/java.awt.Component$BltBufferStrategy.revalidate(Component.java:4552)
at java.desktop/java.awt.Component$BltBufferStrategy.revalidate(Component.java:4529)
at java.desktop/java.awt.Component$BltBufferStrategy.getDrawGraphics(Component.java:4449)
at processing.awt.PSurfaceAWT.render(PSurfaceAWT.java:242)
at processing.awt.PSurfaceAWT$9.callDraw(PSurfaceAWT.java:1389)
at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:356)
NullPointerException
I'm not experienced enough to fully write the code myself but using chat GPT i was able to solve this by replacing parts of void setup() and void draw() with the following code. since its AI assisted it may have some redundancies or errors, but none the less it solved the errors i was getting.
void setup() {
img = loadImage(imgFileName + "." + fileType);
// stable preview window
size(800, 800, JAVA2D);
// optional: show the original image once
imageMode(CORNER);
}
void draw() {
if (frameCount <= loops) {
// loop through columns
println("Sorting Columns");
while (column < img.width-1) {
img.loadPixels();
sortColumn();
column++;
img.updatePixels();
}
// loop through rows
println("Sorting Rows");
while (row < img.height-1) {
img.loadPixels();
sortRow();
row++;
img.updatePixels();
}
}
float scale = min(
width / (float) img.width,
height / (float) img.height
);
image(
img,
0, 0,
img.width * scale,
img.height * scale
);
not sure if this is a new problem since the upgrade to processing 4, but images around 2mb or larger consistently dont work because the render window stretches far off screen and causes the following error message:
java.lang.NullPointerException: Cannot invoke "java.awt.image.VolatileImage.validate(java.awt.GraphicsConfiguration)" because "this.backBuffers[...]" is null
at java.desktop/java.awt.Component$BltBufferStrategy.revalidate(Component.java:4552)
at java.desktop/java.awt.Component$BltBufferStrategy.revalidate(Component.java:4529)
at java.desktop/java.awt.Component$BltBufferStrategy.getDrawGraphics(Component.java:4449)
at processing.awt.PSurfaceAWT.render(PSurfaceAWT.java:242)
at processing.awt.PSurfaceAWT$9.callDraw(PSurfaceAWT.java:1389)
at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:356)
NullPointerException
I'm not experienced enough to fully write the code myself but using chat GPT i was able to solve this by replacing parts of void setup() and void draw() with the following code. since its AI assisted it may have some redundancies or errors, but none the less it solved the errors i was getting.
void setup() {
img = loadImage(imgFileName + "." + fileType);
// stable preview window
size(800, 800, JAVA2D);
// optional: show the original image once
imageMode(CORNER);
}
void draw() {
if (frameCount <= loops) {
}
float scale = min(
width / (float) img.width,
height / (float) img.height
);
image(
img,
0, 0,
img.width * scale,
img.height * scale
);