www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: Jakes on January 31, 2020, 10:17:47 am

Title: Polylines transparency issue
Post by: Jakes on January 31, 2020, 10:17:47 am
Hello, I've been working around with Polylines and it seems that the method Polyline.setPercentage(float) is not working properly or might be something I am missing. For any value other than 1 the line turns fully invisible.

Is this an issue?
Title: Re: Polylines transparency issue
Post by: EgonOlsen on January 31, 2020, 10:38:46 am
I don't think so. setPercentage(<float>) isn't about transparency, it's about how much (in terms of length) is visible of the polyline. But because it can't cut a line segment in half, it can only make full segments visible or invisible. That means that a Polyline that consists of a single line segment, will only be visible at 100%.

For transparency, there's actually the setTransparencyMode() method to enable it and the color attribute of a Polyline to set the desired value.
Title: Re: Polylines transparency issue
Post by: EgonOlsen on January 31, 2020, 10:39:57 am
Like so:

Code: [Select]
Polyline pl=new Polyline(line, new Color(255,255,255,100));
pl.setWidth(10);
pl.setTransparencyMode(Object3D.TRANSPARENCY_MODE_DEFAULT);
Title: Re: Polylines transparency issue
Post by: Jakes on January 31, 2020, 01:49:46 pm
Ah ok, so it uses the alpha channel of the color for the transparency. Thanks