1

I would like to change the linewidth of any mesh with DrawMode.LINE, but I don't know if it is possible.

I added some code for reference.

@Override
public void start(Stage primaryStage) throws Exception{
    PerspectiveCamera camera= new PerspectiveCamera(true);
    Group root = new Group();
    Scene scene = new Scene(root, 1024, 768, true);

    primaryStage.setScene(scene);
    primaryStage.show();

    scene.setFill(Color.BLACK);
    camera.setFarClip(10000);
    camera.setTranslateZ(-10);
    scene.setCamera(camera);

    Box box  = new Box();
    box.setDrawMode(DrawMode.LINE);
    root.getChildren().addAll(camera,box);
}


public static void main(String[] args) {
    launch(args);
}
  • I don't think so. There is not API to set the width of the wireframe lines. The only way I can think of, is to try to fudge it by, for instance, rendering the 3D scene at half size, then scaling it up by a factor of. for example 2, to double the width of the lines. I'm not sure if that would work either. – jewelsea Dec 27 '19 at 11:00

1 Answers1

2

It is not possible. The DrawMode is passed down to the native renderer whose default wireframe is a width 1 line. For the Direct3D pipeline, see Outline and Fill State. Even if you use the line drawing support library it will tell you that:

The library uses native hardware line drawing support (if available in the device) only if:

  • Line width is 1.
  • No line pattern is enabled.

Line widths that are different than 1 cannot be drawn with line primitives, but have to be drawn with triangles instead:

The line drawing library emulates lines using texture triangles

In other words, a width of 1 is special because it has specific hardware support.

user1803551
  • 12,965
  • 5
  • 47
  • 74