| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7e0a1d6 commit 44387f1
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -509,6 +509,12 @@ public class PGraphicsOpenGL extends PGraphics { | |||
| 509 | 509 | "to render this geometry properly, using default shader instead."; | |
| 510 | 510 | static final String TESSELLATION_ERROR = | |
| 511 | 511 | "Tessellation Error: %1$s"; | |
| 512 | + static final String GL_THREAD_NOT_CURRENT = | ||
| 513 | + "You are trying to draw outside OpenGL's animation thread.\n" + | ||
| 514 | + "Place all drawing commands in the draw() function, or inside\n" + | ||
| 515 | + "your own functions as long as they are called from draw(),\n" + | ||
| 516 | + "but not in event handling functions such as keyPressed()\n" + | ||
| 517 | + "or mousePressed()."; | ||
| 512 | 518 | ||
| 513 | 519 | ////////////////////////////////////////////////////////////// | |
| 514 | 520 | ||
@@ -1455,6 +1461,11 @@ protected boolean pointBuffersContextIsOutdated() { | |||
| 1455 | 1461 | ||
| 1456 | 1462 | @Override | |
| 1457 | 1463 | public void beginDraw() { | |
| 1464 | + if (!pgl.threadIsCurrent()) { | ||
| 1465 | + PGraphics.showWarning(GL_THREAD_NOT_CURRENT); | ||
| 1466 | + return; | ||
| 1467 | + } | ||
| 1468 | + | ||
| 1458 | 1469 | if (primaryGraphics) { | |
| 1459 | 1470 | if (!initialized) { | |
| 1460 | 1471 | initPrimary(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments