我误解了子场景的概念,因为它们都显示完全独立的控件。使用以下结构可以叠加 3D 文本...
代码示例:
//Add 2D content here
AnchorPane globalRoot = new AnchorPane();
globalRoot.getChildren().add(new Label("Hello World"));
Scene scene = new Scene(globalRoot, 1024, 768, true);
SubScene sub = new
SubScene(root3D,1024,768,false,SceneAntialiasing.BALANCED);
sub.setCamera(camera);
globalRoot.getChildren().add(sub);
//Add all 3D content to the root3D node
primaryStage.setScene(scene);
primaryStage.show();
Run Code Online (Sandbox Code Playgroud)