diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index 5619ca220..74fa72b07 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -1461,11 +1461,6 @@ public class PGraphicsOpenGL extends PGraphics { @Override public void beginDraw() { - if (!pgl.threadIsCurrent()) { - PGraphics.showWarning(GL_THREAD_NOT_CURRENT); - return; - } - if (primaryGraphics) { if (!initialized) { initPrimary(); @@ -1476,6 +1471,11 @@ public class PGraphicsOpenGL extends PGraphics { getPrimaryPG().setCurrentPG(this); } + if (!pgl.threadIsCurrent()) { + PGraphics.showWarning(GL_THREAD_NOT_CURRENT); + return; + } + // This has to go after the surface initialization, otherwise offscreen // surfaces will have a null gl object. report("top beginDraw()");