I working on a Processing program that runs in to different windows. On holds the controllers, thats the main PApplet, the other one is running some OpenGL and is a subclass of PApplet as well.
Creating an instance of the OpenGL window isn’t too difficult but how do I destroy() it without calling exit() and killing the entire process. I just want to close the second window and free all it’s resources.
I couldn’t find any proper solution.
Calling
PApplet.destroy()does not cause aSystem.exit()call on its own. Closing theFramein which your PApplet runs, however, will. You should be able to callPApplet.destroy()to terminate the mainPAppletanimation thread, and then callframe.setVisible(false)to close the window without triggering aSystem.exit()call.In other words, try: