I’m working on a live visualizer program for a band, which is structured like this:
The main Draw() loop creates a thread, wherein whichever animation function is currently running is updated. These animation functions often use one or more PGraphics objects, which are later drawn to the main screen.
Everything was working great for the first version, which was all 2D. Now, I’m working on converting everything over to P3D to get a little fancier.
However, using this exact same setup except with P3D PGraphics objects, the program crashes with the following error:
“You are trying to draw outside OpenGL’s animation thread. Place all drawing commands in the draw() function, or inside your own function as long as they are called from draw(), but not in any event handling functions such as keyPressed() or mousePressed()”
I haven’t changed anything except making the sketch P3D, and making the PGraphics objects P3D. Does anyone out there have any experience with this? If it’s possible, I’d love to keep the current thread() setup for this application rather than restructure the whole thing.