You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After using surface.setSize() to resize window outside setup() invoking save() causes NullPointerException. Also, image of the window frame is saved under chosen filename but it has 0 bytes and .tif extension after .jpg or .png. This only happens when non-default renderer is enabled - P2D, P3D or OPENGL.
Code to replicate:
void setup() {
size(500, 500, P3D); //can also be P2D or OPENGL
}
void draw() {
background(255);
surface.setSize(400, 400);
save("test.png"); //NPE thrown here
exit();
}
Stacktrace:
java.lang.NullPointerExceptionjava.lang.NullPointerException at
java.desktop/java.awt.image.BufferedImage.setRGB(BufferedImage.java:1058) at
processing.awt.ShimAWT.saveImageIO(ShimAWT.java:374) at processing.awt.ShimAWT.saveImage(ShimAWT.java:334) at
processing.core.PImage.saveImpl(PImage.java:3349) at
processing.opengl.PGraphicsOpenGL.saveImpl(PGraphicsOpenGL.java:764) at processing.core.PImage.save(PImage.java:3308) at
processing.core.PGraphics.save(PGraphics.java:8584) at processing.core.PApplet.save(PApplet.java:3978) at
szie_surfaceresize.draw(szie_surfaceresize.java:26) at processing.core.PApplet.handleDraw(PApplet.java:2458) at
processing.opengl.PSurfaceJOGL$DrawListener.display(PSurfaceJOGL.java:950) at
jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:692) at
jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:674) at
jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:443) at
jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1293) at
jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147) at
com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:768) at
com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:81) at
com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:453) at
com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:178) at
java.base/java.util.TimerThread.mainLoop(Timer.java:556) at
java.base/java.util.TimerThread.run(Timer.java:506)java.io.IOException: image save failed. at
processing.awt.ShimAWT.saveImageIO(ShimAWT.java:420) at processing.awt.ShimAWT.saveImage(ShimAWT.java:334) at
processing.core.PImage.saveImpl(PImage.java:3349) at
processing.opengl.PGraphicsOpenGL.saveImpl(PGraphicsOpenGL.java:764) at processing.core.PImage.save(PImage.java:3308) at
processing.core.PGraphics.save(PGraphics.java:8584) at processing.core.PApplet.save(PApplet.java:3978) at
szie_surfaceresize.draw(szie_surfaceresize.java:26) at processing.core.PApplet.handleDraw(PApplet.java:2458) at
processing.opengl.PSurfaceJOGL$DrawListener.display(PSurfaceJOGL.java:950) at
jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:692) at
jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:674) at
jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:443) at
jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1293) at
jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147) at
com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:768) at
com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:81) at
com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:453) at
com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:178) at
java.base/java.util.TimerThread.mainLoop(Timer.java:556) at
java.base/java.util.TimerThread.run(Timer.java:506)NullPointerException
Your Environment
Processing version: Processing4 built up to commit e96622d
Operating System and OS version: Windows 10 build 19042.685
The text was updated successfully, but these errors were encountered:
This issue has been automatically locked. To avoid confusion with reports that have already been resolved, closed issues are automatically locked 30 days after the last comment. Please open a new issue for related bugs.
Created by: PixelCatalyst
Description
After using
surface.setSize()
to resize window outsidesetup()
invokingsave()
causesNullPointerException
. Also, image of the window frame is saved under chosen filename but it has 0 bytes and.tif
extension after.jpg
or.png
. This only happens when non-default renderer is enabled - P2D, P3D or OPENGL.Code to replicate:
Stacktrace:
Your Environment
The text was updated successfully, but these errors were encountered: