JDK-8301597 : Support rendering of multiple 3D primitives
Type:Sub-task
Component:javafx
Sub-Component:graphics
Affected Version:internal
Priority:P3
Status:Resolved
Resolution:Fixed
OS:os_x
CPU:generic
Submitted:2023-02-01
Updated:2023-02-01
Resolved:2023-02-01
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.
With 3D PoC https://bugs.openjdk.org/browse/JDK-8295485, we can draw only one 3D primitive at a time.
If we draw more than one 3D primitive only the last drawn 3D primitive is shown.
Comments
In PoC we are creating RenderPassDescriptor in renderMeshView() and we clear color everytime and use MTLLoadActionClear, which basically overrides previously drawn Mesh.
We need set 3D states in setDeviceParametersFor3D() call and reuse it for multiple renderMeshView() calls.
setDeviceParametersFor3D() is called only once for multiple renderMeshView() calls.
01-02-2023
Sample program to verify multiple 3D primitive draw:
import javafx.application.Application;
import javafx.geometry.Point3D;
import javafx.scene.Group;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.shape.Box;
import javafx.scene.shape.Cylinder;
import javafx.stage.Stage;
public class Multiple_Primitive extends Application {
final int SCENE_WIDTH = 600;
final int SCENE_HEIGHT = 600;
public Parent createContent() throws Exception {
Box testBox = new Box(SCENE_WIDTH/4, SCENE_HEIGHT/4, SCENE_WIDTH/4);
testBox.setLayoutX(SCENE_HEIGHT/2);
testBox.setLayoutY(SCENE_HEIGHT/2);
Cylinder testCylinder = new Cylinder(100.0, 200.0);
testCylinder.setLayoutX(SCENE_WIDTH/4);
testCylinder.setLayoutY(SCENE_HEIGHT/2);
testBox.setRotationAxis(new Point3D(1,1,1));
testBox.setRotate(45);
testCylinder.setRotationAxis(new Point3D(1,1,1));
testCylinder.setRotate(45);
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);
}
}
01-02-2023
Changeset: 26716381
Author: Jayathirth D V <jdv@openjdk.org>
Date: 2023-02-01 17:24:11 +0530
URL: https://github.com/openjdk/jfx-sandbox/commit/26716381e1665fb7fba0ee5bb7e3fad350f76320
01-02-2023
Pushed as https://github.com/openjdk/jfx-sandbox/commit/26716381e1665fb7fba0ee5bb7e3fad350f76320