check thread after init

This commit is contained in:
codeanticode
2015-12-12 15:23:11 -05:00
parent d3d050b960
commit 0f24e97185
@@ -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()");