如何在 JavaFX 中禁用或绕过硬件图形加速(Prism)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18754803/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 10:45:46  来源:igfitidea点击:

How to disable or bypass Hardware Graphics Acceleration(Prism) in JavaFX

javaopengljavafx

提问by Lalith J.

OS: OSX Mountain Lion.

操作系统:OSX 山狮。

System: Virtual BOX 4.2.6.

系统:Virtual BOX 4.2.6。

Java: 1.7.0.40-ea-b34

Java:1.7.0.40-ea-b34

I want to disable hardware acceleration for my JAVAFX app because there is no HW acceleration on my system (mac). So when there is no HW acceleration I am getting fatal error on executing my JAVAFX App. The error related to "Prism Engine pipeline" and it happen when java trying to execute openGL native libs. So i want to disable the prism.

我想为我的 JAVAFX 应用程序禁用硬件加速,因为我的系统 (mac) 上没有硬件加速。所以当没有硬件加速时,我在执行我的 JAVAFX 应用程序时遇到致命错误。与“棱镜引擎管道”相关的错误,它发生在 java 尝试执行 openGL 本机库时。所以我想禁用棱镜。

I see there is some vm args that control prism behavior like.. Dprism.forceGPU=true;

我看到有一些 vm args 控制棱镜行为,如.. Dprism.forceGPU=true;

Is there anything like above to disable prism or openGL requesting?

有没有像上面那样禁用棱镜或 openGL 请求?

The Fatal error (openGl related codes)

致命错误(openGl 相关代码)

Stack: [0x000000016c8f9000,0x000000016c9f9000], sp=0x000000016c9f7f40, free space=1019k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libobjc.A.dylib+0x639f] objc_msgSend_fixup+0x5f
C [AppKit+0x28134c] -[NSOpenGLContext initWithFormat:shareContext:]+0xac
C [libprism-es2.dylib+0x4e9f] createContext+0x1b3
C [libprism-es2.dylib+0x4729] Java_com_sun_prism_es2_gl_mac_MacGLFactory_nInitialize+0xa2
j com.sun.prism.es2.gl.mac.MacGLFactory.nInitialize([I)J+0
j com.sun.prism.es2.gl.mac.MacGLFactory.initialize(Ljava/lang/Class;Lcom/sun/prism/es2/gl/GLPixelFormat$Attributes;)Z+73
j com.sun.prism.es2.ES2Pipeline.<clinit>()V+54 

采纳答案by zenbeni

Look at this forum: https://forums.oracle.com/message/11018975

看这个论坛:https: //forums.oracle.com/message/11018975

Add this to your java execution:

将此添加到您的 java 执行中:

-Dprism.order=j2d

That should do the trick.

这应该够了吧。

回答by Petr

The j2d graphics pipeline is kind of deprecated in JavaFX 8, so it's better to use the software pipeline: -Dprism.order=sw. To verify that you are actually using it you could switch on logging: -Dprism.verbose=true

JavaFX 8 中不推荐使用 j2d 图形管道,因此最好使用软件管道:-Dprism.order=sw. 要验证您是否确实在使用它,您可以打开日志记录:-Dprism.verbose=true