The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
We have default Red color for all the 3D primitives drawn using Metal in JavaFX. Add support to pass and use diffuse color while rendering 3D primitives.
Comments
Changeset: 18d05951
Author: Jayathirth D V <jdv@openjdk.org>
Committer: aghaisas <ajitgh@gmail.com>
Date: 2023-03-06 17:52:54 +0000
URL: https://git.openjdk.org/jfx-sandbox/commit/18d059512d051e1f77347395cbb43ecff6510496
06-03-2023
Sample program to verify color support:
import javafx.application.Application;
import javafx.geometry.Point3D;
import javafx.scene.Group;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.paint.PhongMaterial;
import javafx.scene.shape.Box;
import javafx.scene.shape.Cylinder;
import javafx.stage.Stage;
public class ColorSupport_3D extends Application {
final int SCENE_WIDTH = 600;
final int SCENE_HEIGHT = 600;
public Parent createContent() throws Exception {
int denom = 4;
Box testBox = new Box(SCENE_WIDTH/denom, SCENE_HEIGHT/denom, SCENE_WIDTH/denom);
testBox.setLayoutX(SCENE_HEIGHT/2 + 100);
testBox.setLayoutY(SCENE_HEIGHT/2);
testBox.setRotationAxis(new Point3D(1,1,1));
testBox.setRotate(45);
testBox.setMaterial(new PhongMaterial(Color.MAGENTA));
Cylinder testCylinder = new Cylinder(100.0, 200.0);
testCylinder.setLayoutX(SCENE_WIDTH/4);
testCylinder.setLayoutY(SCENE_HEIGHT/2);
testCylinder.setRotationAxis(new Point3D(1,1,1));
testCylinder.setRotate(45);
testCylinder.setMaterial(new PhongMaterial(Color.BLUE));
Group root = new Group();
root.getChildren().add(testBox);
root.getChildren().add(testCylinder);
return root;
}
@Override
public void start(Stage primaryStage) throws Exception {
Scene scene = new Scene(createContent(), SCENE_WIDTH, SCENE_HEIGHT);
primaryStage.setScene(scene);
primaryStage.show();
}
/**
* Java main for when running without JavaFX launcher
*/
public static void main(String[] args) {
launch(args);
}
}