Skip to content

Commit 269f626

Browse files
committed
incorporate processing/processing#5881 for FBO fix on Intel HD Graphics 3000 devices
1 parent 8f99438 commit 269f626

4 files changed

Lines changed: 37 additions & 6 deletions

File tree

core/src/processing/opengl/PGL.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,17 @@ public abstract class PGL {
165165
protected boolean usingFrontTex = false;
166166
protected boolean needSepFrontTex = false;
167167

168+
/**
169+
* Defines if FBO Layer is allowed in the given environment.
170+
* Using FBO can cause a fatal error during runtime for
171+
* Intel HD Graphics 3000 chipsets (commonly used on older MacBooks)
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]
176+
*/
177+
protected boolean fboAllowed = true;
178+
168179
// ........................................................
169180

170181
// Texture rendering

core/src/processing/opengl/PSurfaceJOGL.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import java.io.FileInputStream;
3737
import java.io.IOException;
3838
import java.io.InputStream;
39+
import java.lang.reflect.Method;
3940
import java.nio.ByteBuffer;
4041
import java.util.HashMap;
4142
import java.util.Map;
@@ -178,6 +179,22 @@ protected void initDisplay() {
178179

179180
GraphicsConfiguration config = awtDisplayDevice.getDefaultConfiguration();
180181
displayRect = config.getBounds();
182+
183+
/** See explanation at {@link PGL#fboAllowed} in PGL */
184+
if (PApplet.platform == PConstants.MACOS) {
185+
try {
186+
Class<?> cglClass = Class.forName("sun.java2d.opengl.CGLGraphicsConfig");
187+
Method cglMethod = cglClass.getMethod("getContextCapabilities");
188+
Class<?> ctcClass = Class.forName("sun.java2d.pipe.hw.ContextCapabilities");
189+
Method ctcMethod = ctcClass.getMethod("getAdapterId");
190+
Object cglInstance = cglClass.cast(config);
191+
Object ctcInstance = cglMethod.invoke(cglInstance);
192+
Object idInstance = ctcMethod.invoke(ctcInstance);
193+
if (String.valueOf(idInstance).contains("Intel HD Graphics 3000")) {
194+
pgl.fboAllowed = false;
195+
}
196+
} catch (Exception e) { }
197+
}
181198
}
182199

183200

core/todo.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
0270 (3.5.4 or 3.6)
1+
1270 (4.x alpha)
2+
X check for disabling FBO code (fixes Intel HD 3000)
3+
X https://github.com/processing/processing/issues/4104
4+
X https://github.com/processing/processing/pull/5881
5+
6+
27
_ size() issues on Mojave? (3.4 works, 3.5.3 does not)
38
_ https://github.com/processing/processing/issues/5791
49
_ use exit event to set mouseY to 0 on macOS
@@ -11,12 +16,10 @@ _ simple rotateZ() fix
1116
_ https://github.com/processing/processing/pull/5821
1217
_ https://github.com/processing/processing/issues/5770
1318

14-
_ check for disabling FBO code (fixes Intel HD 3000)
15-
_ https://github.com/processing/processing/issues/4104
16-
_ https://github.com/processing/processing/pull/5881
17-
1819

1920
high-ish
21+
_ Update isAccessible() in Table to use JDK 11 reflection methods
22+
_ https://github.com/processing/processing4/issues/3
2023
_ add separator option to loadTable()
2124
_ https://github.com/processing/processing/issues/5068
2225
_ make setting the window icon automatic, based on files in local dirs

todo.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
0270 (4.x)
1+
1270 (4.x alpha)
22
X use ctrl-page up/down for tabs on Windows
33
X https://github.com/processing/processing/issues/5794
44
X fix potential highlighting issue that wasn't selecting portions of text

0 commit comments

Comments
 (0)