I'm trying to set the background of a SubScene as an image, but when I do, this happens:
This is the code:
public void start(Stage stage) throws Exception {
PerspectiveCamera camera = new PerspectiveCamera(true);
Group model = new Group(new Box(200, 10, 10));
Group course = new Group(model);
BorderPane borderPane = new BorderPane();
Pane pane1 = new Pane(course);
SubScene subScene1 = new SubScene(pane1, 1000, 720);
Group homeCameraXform = new Group();
model.getChildren().add(homeCameraXform);
homeCameraXform.getChildren().add(camera);
subScene1.setCamera(camera);
camera.setNearClip(.1);
camera.setFarClip(10000);
camera.setTranslateZ(-1000);
Xform s = new Xform();
s.getChildren().add(camera);
subScene1.setOnMouseDragged(e -> s.rx.setAngle(s.rx.getAngle()+ 10));
borderPane.setLeft(subScene1);
subScene1.setFill(new ImagePattern(new Image("file.jpg")));
Scene scene = new Scene(borderPane, 1280,720, true);
stage.setScene(scene);
stage.show();
}
For a normal Scene with a depthBuffer, I just needed to do scene.setFill(new ImagePattern(new Image("file"))). When I try setFill(Color.RED) instead of setFill(new ImagePattern(new Image(""))), it works as expected. What else do I have to do to setFill with an ImagePattern?
