-
Bug
-
Resolution: Not an Issue
-
P4
-
8u45
-
x86
-
windows_8
FULL PRODUCT VERSION :
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b15)
Java HotSpot(TM) Client VM (build 25.45-b02, mixed mode, sharing)
JDK the same version
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.3.9600] Windows 8.1 x64
Microsoft Windows [Version 6.1.1000] Windows 7 x64
A DESCRIPTION OF THE PROBLEM :
I tried to make a software that shows the different lights in JavaFX 3D.
I've created a Scene which holds 3D SubScenes. The SubScenes have all the same Sphere. Additionally I've created two light instances, one PointLight and one AmbientLight.
Then you tried to make a Scene with 3 SubScenes to show the default light, PointLight and an AmbientLight. There was no problem till this step. But then I tried to add one SubScene more with the two lights added to one SubScene.
After I got 4 SubScenes I realized, that the first 3 SubScenes not showing the setted lights, the all show the default light. Only the fourth shows the Sphere with two lights added (Point and Ambient).
Link to my stackflow question: http://stackoverflow.com/q/31175585/4170073
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Build the code and run.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Four SubScene's showing the correct light: Default; Point; Ambient; (Point, Ambient)
ACTUAL -
Four SubScene's where three of it showing the default light and one with both lights added.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.*;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.scene.paint.PhongMaterial;
import javafx.scene.shape.*;
import javafx.stage.Stage;
public class Shapes3DViewer extends Application {
PhongMaterial material;
@Override
public void start(Stage stage) {
material = new PhongMaterial();
material.setDiffuseColor(Color.FIREBRICK);
material.setSpecularColor(Color.YELLOW);
PointLight pointLight = new PointLight(Color.WHITE);
pointLight.setTranslateX(100);
pointLight.setTranslateY(100);
pointLight.setTranslateZ(-300);
pointLight.setRotate(90);
AmbientLight ambient = new AmbientLight();
Group g1 = createSphereGroup(100, "Default light");
Group g2 = createSphereGroup(100, "Point light");
Group g3 = createSphereGroup(100, "Ambient light");
Group g4 = createSphereGroup(100, "Ambient & Point light");
g2.getChildren().add(pointLight);
g3.getChildren().add(ambient);
g4.getChildren().addAll(pointLight, ambient);
SubScene s1 = createSubScene(g1, 400, 400);
SubScene s2 = createSubScene(g2, 400, 400);
SubScene s3 = createSubScene(g3, 400, 400);
SubScene s4 = createSubScene(g4, 400, 400);
HBox root = new HBox();
root.getChildren().addAll(s1, s2, s3, s4);
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
private Group createSphereGroup(double radius, String text) {
Sphere c = new Sphere(radius);
c.setMaterial(material);
c.setDrawMode(DrawMode.FILL);
c.setTranslateX(radius * 1.33);
c.setTranslateY(radius * 2);
Label lbl = new Label(text);
lbl.setStyle("-fx-text-fill: red;-fx-font-size: 18pt;");
return new Group(c, lbl);
}
private SubScene createSubScene(Group group, double width, double height) {
SubScene s = new SubScene(group, width, height);
s.setCamera(new PerspectiveCamera());
s.setFill(Color.color(.1, .1, .1));
return s;
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Create own light-instances for the fourth case.
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b15)
Java HotSpot(TM) Client VM (build 25.45-b02, mixed mode, sharing)
JDK the same version
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.3.9600] Windows 8.1 x64
Microsoft Windows [Version 6.1.1000] Windows 7 x64
A DESCRIPTION OF THE PROBLEM :
I tried to make a software that shows the different lights in JavaFX 3D.
I've created a Scene which holds 3D SubScenes. The SubScenes have all the same Sphere. Additionally I've created two light instances, one PointLight and one AmbientLight.
Then you tried to make a Scene with 3 SubScenes to show the default light, PointLight and an AmbientLight. There was no problem till this step. But then I tried to add one SubScene more with the two lights added to one SubScene.
After I got 4 SubScenes I realized, that the first 3 SubScenes not showing the setted lights, the all show the default light. Only the fourth shows the Sphere with two lights added (Point and Ambient).
Link to my stackflow question: http://stackoverflow.com/q/31175585/4170073
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Build the code and run.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Four SubScene's showing the correct light: Default; Point; Ambient; (Point, Ambient)
ACTUAL -
Four SubScene's where three of it showing the default light and one with both lights added.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.*;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.scene.paint.PhongMaterial;
import javafx.scene.shape.*;
import javafx.stage.Stage;
public class Shapes3DViewer extends Application {
PhongMaterial material;
@Override
public void start(Stage stage) {
material = new PhongMaterial();
material.setDiffuseColor(Color.FIREBRICK);
material.setSpecularColor(Color.YELLOW);
PointLight pointLight = new PointLight(Color.WHITE);
pointLight.setTranslateX(100);
pointLight.setTranslateY(100);
pointLight.setTranslateZ(-300);
pointLight.setRotate(90);
AmbientLight ambient = new AmbientLight();
Group g1 = createSphereGroup(100, "Default light");
Group g2 = createSphereGroup(100, "Point light");
Group g3 = createSphereGroup(100, "Ambient light");
Group g4 = createSphereGroup(100, "Ambient & Point light");
g2.getChildren().add(pointLight);
g3.getChildren().add(ambient);
g4.getChildren().addAll(pointLight, ambient);
SubScene s1 = createSubScene(g1, 400, 400);
SubScene s2 = createSubScene(g2, 400, 400);
SubScene s3 = createSubScene(g3, 400, 400);
SubScene s4 = createSubScene(g4, 400, 400);
HBox root = new HBox();
root.getChildren().addAll(s1, s2, s3, s4);
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
private Group createSphereGroup(double radius, String text) {
Sphere c = new Sphere(radius);
c.setMaterial(material);
c.setDrawMode(DrawMode.FILL);
c.setTranslateX(radius * 1.33);
c.setTranslateY(radius * 2);
Label lbl = new Label(text);
lbl.setStyle("-fx-text-fill: red;-fx-font-size: 18pt;");
return new Group(c, lbl);
}
private SubScene createSubScene(Group group, double width, double height) {
SubScene s = new SubScene(group, width, height);
s.setCamera(new PerspectiveCamera());
s.setFill(Color.color(.1, .1, .1));
return s;
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Create own light-instances for the fourth case.