JDK-8303865 : Use appropriate state management to enable drawing of both 3D and 2D primitives
Type:Enhancement
Component:javafx
Sub-Component:graphics
Affected Version:internal
Priority:P3
Status:Resolved
Resolution:Fixed
OS:os_x
CPU:generic
Submitted:2023-03-09
Updated:2023-06-15
Resolved:2023-03-09
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.
Right now when we draw both 2D and 3D primitives, whatever is drawn last is shown.
Debug and fix this issue so that we can draw both 2D and 3D primitives together
Comments
Changeset: 87834825
Author: Jayathirth D V <jdv@openjdk.org>
Committer: aghaisas <ajitgh@gmail.com>
Date: 2023-03-09 15:49:50 +0000
URL: https://git.openjdk.org/jfx-sandbox/commit/87834825f513cec85daf207110c75a7df9ec42f6
09-03-2023
Sample program to draw both 2D and 3D primitives:
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.Rectangle;
import javafx.stage.Stage;
public class MixedPrimitives 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));
Rectangle rect = new Rectangle(0, 0, 250, 250);
rect.setFill(Color.rgb(200, 200, 0));
Group root = new Group();
root.getChildren().add(rect);
root.getChildren().add(testBox);
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);
}
}