Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why JavaFX (3D) on Raspberry Pi doesn't work, although it should?

I think I've read all available solutions about problems with 3D under JFx on RPi and none of the following suits my needs. I had no problems with 2D applications. But when I try to run 3D program, all the 3D elements are gone. After this command:

java -Djavafx.platform=eglfb -Dprism.verbose=true -Dcom.sun.javafx.experimental.embedded.3d=true -Dprism.glDepthSize=24 -Dprism.forceGPU=true -jar Brake_Check.jar

I get this:

Prism pipeline init order: es2 sw 
Using java-based Pisces rasterizer
Using dirty region optimizations
Not using texture mask for primitives
Not forcing power of 2 sizes for textures
Using hardware CLAMP_TO_ZERO mode
Opting in for HiDPI pixel scaling
Prism pipeline name = com.sun.prism.es2.ES2Pipeline
Loading ES2 native library ... prism_es2
    succeeded.
GLFactory using com.sun.prism.es2.X11GLFactory
GraphicsPipeline.createPipeline failed for com.sun.prism.es2.ES2Pipeline
java.lang.UnsatisfiedLinkError: com.sun.prism.es2.X11GLFactory.nInitialize([I)J
    at com.sun.prism.es2.X11GLFactory.nInitialize(Native Method)
    at com.sun.prism.es2.X11GLFactory.initialize(X11GLFactory.java:146)
    at com.sun.prism.es2.ES2Pipeline.<clinit>(ES2Pipeline.java:81)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:187)
    at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91)
    at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
    at java.lang.Thread.run(Thread.java:748)
*** Fallback to Prism SW pipeline
Prism pipeline name = com.sun.prism.sw.SWPipeline
(X) Got class = class com.sun.prism.sw.SWPipeline
Initialized prism pipeline: com.sun.prism.sw.SWPipeline
 vsync: true vpipe: false
lip 19, 2019 3:31:53 AM javafx.scene.paint.Material <init>
WARNING: System can't support ConditionalFeature.SCENE3D
lip 19, 2019 3:31:53 AM javafx.scene.shape.Shape3D <init>
WARNING: System can't support ConditionalFeature.SCENE3D
lip 19, 2019 3:31:53 AM javafx.scene.shape.Shape3D <init>
WARNING: System can't support ConditionalFeature.SCENE3D
lip 19, 2019 3:31:53 AM javafx.scene.shape.Shape3D <init>
WARNING: System can't support ConditionalFeature.SCENE3D
lip 19, 2019 3:31:53 AM javafx.scene.shape.Shape3D <init>
WARNING: System can't support ConditionalFeature.SCENE3D
lip 19, 2019 3:31:53 AM javafx.scene.shape.Shape3D <init>
WARNING: System can't support ConditionalFeature.SCENE3D
lip 19, 2019 3:31:53 AM javafx.scene.PerspectiveCamera <init>
WARNING: System can't support ConditionalFeature.SCENE3D
lip 19, 2019 3:31:53 AM javafx.scene.LightBase <init>
WARNING: System can't support ConditionalFeature.SCENE3D
lip 19, 2019 3:31:54 AM javafx.scene.shape.Mesh <init>
WARNING: System can't support ConditionalFeature.SCENE3D
lip 19, 2019 3:31:54 AM javafx.scene.shape.Shape3D <init>
WARNING: System can't support ConditionalFeature.SCENE3D
lip 19, 2019 3:31:54 AM javafx.scene.paint.Material <init>
WARNING: System can't support ConditionalFeature.SCENE3D
lip 19, 2019 3:31:54 AM javafx.scene.SubScene <init>
WARNING: System can't support ConditionalFeature.SCENE3D
lip 19, 2019 3:31:54 AM javafx.scene.SubScene <init>
WARNING: System can't support antiAliasing

expected image: expected image

actual image: previous image

I've installed armv6hf-sdk-8.60.9

I will appreciate any suggestion.

Edit

After a additional research I've also added OpenJFX: apt-get install openjfx which makes some small improvements in total, but stil there is something missing. Maybe I'll start from beginning. I used tutorial to set JavaFX for my Raspberry, then libprism_es2.so was missing so I've copied and renamed it from /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/lib/arm/libprism_es2_eglfb.so (I've chosen this one, because I thought if I was using -Djavafx.platform=eglfb parametr, it'd be good option to use) and now I've added OpenJFX, what else should be installed there? Do you think that newer version of sdk might be helpful? But on the other hand I'm afraid that my level of knowledge in operating Linux is too basic and instead of progresses there will be disaster 😉 so I'd prefer to stay with version I already have.

Now, at the moment my application looks like that: actual image

the output messages:

Prism pipeline init order: es2 sw 
Using java-based Pisces rasterizer
Using dirty region optimizations
Not using texture mask for primitives
Not forcing power of 2 sizes for textures
Using hardware CLAMP_TO_ZERO mode
Opting in for HiDPI pixel scaling
Prism pipeline name = com.sun.prism.es2.ES2Pipeline
Loading ES2 native library ... prism_es2
    succeeded.
GLFactory using com.sun.prism.es2.X11GLFactory
(X) Got class = class com.sun.prism.es2.ES2Pipeline
Initialized prism pipeline: com.sun.prism.es2.ES2Pipeline
Maximum supported texture size: 8192
Maximum texture size clamped to 4096
Non power of two texture support = true
Maximum number of vertex attributes = 16
Maximum number of uniform vertex components = 16384
Maximum number of uniform fragment components = 16384
Maximum number of varying components = 128
Maximum number of texture units usable in a vertex shader = 32
Maximum number of texture units usable in a fragment shader = 32
Graphics Vendor: VMware, Inc.
       Renderer: Gallium 0.4 on llvmpipe (LLVM 3.9, 128 bits)
        Version: 3.0 Mesa 13.0.6
 vsync: true vpipe: true
ES2ResourceFactory: Prism - createStockShader: Solid_LinearGradient_REFLECT.frag
lip 19, 2019 13:03:04 PM javafx.fxml.FXMLLoader$ValueElement processValue
WARNING: Loading FXML document with JavaFX API of version 9.0.1 by JavaFX runtime of version 8.0.111
ES2ResourceFactory: Prism - createStockShader: FillPgram_Color.frag
ES2ResourceFactory: Prism - createStockShader: Solid_TextureRGB.frag
PPSRenderer: scenario.effect - createShader: Blend_SRC_IN
new alphas
ES2ResourceFactory: Prism - createStockShader: Texture_Color.frag
QuantumRenderer: shutdown

Do you have any more suggestions?

like image 367
Karol K Avatar asked Jul 19 '19 01:07

Karol K


1 Answers

So the main solution to my problem was installing apt-get install openjfx which I already have mentioned before. After that, I don't have use -Djavafx.platform=eglfb anymore too. The next problem that has occurred, was that everything was black. The problem seems to be in light (PointLight) added to the scene. After I've removed it, everything started to look much better but... there are still some defects. There is no shade on the boxes, antiAliasing is not working, and although there is only a simple animation, it's so laggy.

enter image description here

EDIT

quick update. Everything is working fine as it should. I've restored light too in my project. What I've done was changing advanced settings in RPi.

sudo raspi-config then advanced, next GL Driver, next GL (Full KMS) OpenGL desktop driver with full KMS, save and reboot.

Target achieved. enter image description here

like image 157
Karol K Avatar answered Oct 22 '22 08:10

Karol K