We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am running a system with a window that is hidden and then can come back. When it is hidden, noLoop() is called, and then loop() is called when restarting. It works fine, but when I switch to using P2D instead of the default renderer, draw stops getting called after restarting. I know that loop() is getting called, but draw is not getting called.
Note: I am removing all the window listeners from the window, maybe a window listener that is specific to the OpenGL version of the window is needed to make draw get called?
Answers
The opengl windows have two window listeners which are getting removed, while the default ones have only one. Don't know if that has anything to do with it.
Edit: It still doesn't work if I remove only one of them, I have tried removing each separately, but this did not fix the error.
Perhaps try out my removeWindowListener() solution: :-/
https://forum.Processing.org/two/discussion/17310/intercept-window-closure-in-p2d-renderer-processing-3#Item_5
It checks out "processing.opengl.PSurfaceJOGL" before removing each WindowListener. *-:)
Selectively removing any listeners isn't fixing this, I have tried each combination of listeners. For some reason, draw stops getting called when the window is closed (it wasn't getting stopped by noLoop()) even if all window listeners are removed.
When the close button is clicked, the window closes, but the program remains running. Even so, draw does not continue getting called. This happens with P2D, but not the default renderer.
I have tried overriding the exit() function, but that doesn't work either. In fact, exit() isn't even getting called.
Finally found the problem. Line 3630 of PApplet.java, it stops the thread from running when the window is closed. I re-wrote the dispose method and was able to stop this from happening, but it does cause an error to occur when the program is finally closed.