pGraphics.beginDraw() RuntimeException: Too many pushFramebuffer calls

why would i get RuntimeException: Too many pushFramebuffer calls when calling

    window.graphics = createGraphics(window.width, window.height, type);
    window.graphics.beginDraw();










java.lang.RuntimeException: Too many pushFramebuffer calls
	at processing.opengl.PGraphicsOpenGL.pushFramebuffer(PGraphicsOpenGL.java:1148)
	at processing.opengl.FrameBuffer.initColorBufferMultisample(FrameBuffer.java:388)
	at processing.opengl.FrameBuffer.allocate(FrameBuffer.java:340)
	at processing.opengl.FrameBuffer.<init>(FrameBuffer.java:137)
	at processing.opengl.PGraphicsOpenGL.initOffscreen(PGraphicsOpenGL.java:6650)
	at processing.opengl.PGraphicsOpenGL.beginOffscreenDraw(PGraphicsOpenGL.java:6682)
	at processing.opengl.PGraphicsOpenGL.beginDraw(PGraphicsOpenGL.java:1461)
	at Processing3Compositor$WindowObject.resizeWindow(Processing3Compositor.java:1160)
	at Processing3Compositor$WindowObject.setup(Processing3Compositor.java:1167)
	at Processing3Compositor$Compositor.setup(Processing3Compositor.java:408)
	at Processing3Compositor.setup(Processing3Compositor.java:69)
	at processing.core.PApplet.handleDraw(PApplet.java:2432)
	at processing.opengl.PSurfaceJOGL$DrawListener.display(PSurfaceJOGL.java:866)
	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:759)
	at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:81)
	at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:452)
	at com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:178)
	at java.util.TimerThread.mainLoop(Timer.java:555)
	at java.util.TimerThread.run(Timer.java:505)

is this in setup() or in draw()?

Do you use

    window.graphics.endDraw();

?

Can you post an mcve?

1 Like

Yes, please do!

For example:

beginRecord() with a PGraphics2D interferes with the background of the main PApplet · Issue #3180 · processing/processing · GitHub

Don’t call createGraphics() inside draw() . That example is creating new OpenGL drawing contexts at 60 frames a second. That’s not a Processing problem, you’re going to crash your machine no matter what language you use.