如何在 JavaFX 中将 GUI 覆盖在 3D 场景上? [英] How to overlay GUI over 3D scene in JavaFX?

查看:37
本文介绍了如何在 JavaFX 中将 GUI 覆盖在 3D 场景上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 JavaFX 中有一个 3D 场景,需要在 3D 场景上覆盖 GUI.我曾尝试向场景中添加按钮和文本,但它们总是作为 3D 对象出现在 3d 视图中.我环顾四周,还没有找到如何去做.唯一的解决方法是创建一个全新的窗口并将设置放在那里,但在这种情况下这不是一个选项.感谢帮助!!

像这样或这个

解决方案

您正在寻找的最佳解决方案是 SubScene,一个内置的 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:

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

这篇关于如何在 JavaFX 中将 GUI 覆盖在 3D 场景上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆