简体   繁体   中英

How to overlay GUI over 3D scene in JavaFX?

I have a 3D scene in JavaFX and need to overlay GUI over the 3D scene. I have tried adding buttons and text to the scene but they always appear in the 3d view as 3D objects. I have looked around and haven't found how to do it. The only workaround would be creating a whole new window and putting the settings there but that isn't an option in this case. Thanks for the help!!

Something like this 在此输入图像描述 Or this 在此输入图像描述

The best solution for what you are looking for is the SubScene , a built-in JavaFX container :

The SubScene class is the container for content in a scene graph. SubScene provides separation of different parts of a scene, each of which can be rendered with a different camera, depth buffer, or scene anti-aliasing. A SubScene is embedded into the main scene or another sub-scene.

If you have a look at the 3DViewer project, you'll find it is like the pictures you have posted:

3DViewer

You can find a small sample of how to add a subScene to a regular scene in this question .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM