java - Setting up a camera in JavaFX for objects in a panel -


i building application javafx ide , java fx scene builder.

the "scene" object defined in class extends application. inside 1 of nested panels of class, load .fxml file.

this other .fxml file, paired java class, contains shape want display.

if add camera scene object, camera applies panels, menus , rest of elements in gui. want camera apply inner panel contains shape, when documentation camera added scene.

this code in application class , first attempt @ adding camera, which, explained before, gives strange results camera applies inside application window:

   public void initrootlayout() {       try {          // load root layout fxml file.          fxmlloader loader = new fxmlloader();          loader.setlocation(mainapp.class.getresource("view/rootlayout.fxml"));          rootlayout = (borderpane) loader.load();           // show scene containing root layout.          scene scene = new scene(rootlayout);          addcameraandlights(scene, null);          primarystage.setscene(scene);          primarystage.show();       } catch (ioexception e) {          e.printstacktrace();       }    } 

use subscene contain 3d shape.

the subscene class container content in scene graph. subscene provides separation of different parts of scene, each of can rendered different camera, depth buffer, or scene anti-aliasing. subscene embedded main scene or sub-scene.

you can set camera on sub scene separate camera applied on root scene.

an example of subscene use provided in answer to:


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -