@@ -170,11 +170,11 @@ public abstract class PGL {
170
170
* Using FBO can cause a fatal error during runtime for
171
171
* Intel HD Graphics 3000 chipsets (commonly used on older MacBooks)
172
172
* <a href="https://github.com/processing/processing/issues/4104">#4104</a>
173
- * The value remains as 'true' unless set false during init .
174
- * TODO There's already code in here to enable/disable the FBO properly,
175
- * this should be making use of that mechanism instead. [fry 191007]
173
+ * Changed to private because needs to be accessed via isFboAllowed() .
174
+ * <a href="https://github.com/processing/processing4/pull/76">#76</a> and
175
+ * <a href="https://github.com/processing/processing4/issues/50">#50</a>
176
176
*/
177
- protected boolean fboAllowed = true ;
177
+ private Boolean fboAllowed = true ;
178
178
179
179
// ........................................................
180
180
@@ -863,7 +863,7 @@ protected void endRender(int windowColor) {
863
863
saveFirstFrame ();
864
864
}
865
865
866
- if (fboAllowed ) {
866
+ if (isFboAllowed () ) {
867
867
if (!clearColor && 0 < sketch .frameCount || !sketch .isLooping ()) {
868
868
enableFBOLayer ();
869
869
if (SINGLE_BUFFERED ) {
@@ -2304,6 +2304,28 @@ protected int getMaxTexUnits() {
2304
2304
}
2305
2305
2306
2306
2307
+ public boolean isFboAllowed () {
2308
+ if (fboAllowed == null ) {
2309
+ if (PApplet .platform == PConstants .MACOS ) {
2310
+ try {
2311
+ String hardware = getString (PGL .RENDERER );
2312
+ if (hardware != null && hardware .contains ("Intel HD Graphics 3000" )) {
2313
+ fboAllowed = false ;
2314
+ return false ;
2315
+ }
2316
+ } catch (RuntimeException e ) {
2317
+ System .err .println ("Could not read renderer name. FBOs disabled. Reason: " + e );
2318
+ // disable for now, but will try again on next isFboAllowed() call
2319
+ return false ;
2320
+ }
2321
+ }
2322
+ // all other scenarios allow for FBOs
2323
+ fboAllowed = true ;
2324
+ }
2325
+ return fboAllowed ;
2326
+ }
2327
+
2328
+
2307
2329
protected static ByteBuffer allocateDirectByteBuffer (int size ) {
2308
2330
int bytes = PApplet .max (MIN_DIRECT_BUFFER_SIZE , size ) * SIZEOF_BYTE ;
2309
2331
return ByteBuffer .allocateDirect (bytes ).order (ByteOrder .nativeOrder ());
0 commit comments