How to change the width of ellipsoid geometry on a cesium map?

I follow a sketch sketch of a sandcastle Outline Geometry. I wonder if it doesn’t matter if the line width of the ellipse is wider? There are examples of creating a wide polyline using the width attribute, but there seems to be no way to create an OutlineGeometry ellipse object. In the example with sand records, there is a lineWidth parameter at the end, but changes in this do not affect the width of the ellipse contour.

<sandbox>:
// Create the ellipse geometry. To extrude, specify the // height of the geometry with the extrudedHeight option. // The numberOfVerticalLines option can be used to specify // the number of lines connecting the top and bottom of the // ellipse. ellipseOutlineGeometry = new Cesium.EllipseOutlineGeometry({ center : Cesium.Cartesian3.fromDegrees(-95.0, 35.0), semiMinorAxis : 200000.0, semiMajorAxis : 300000.0, extrudedHeight : 150000.0, rotation : Cesium.Math.toRadians(45), numberOfVerticalLines: 10 }); // Create a geometry instance using the ellipse geometry // created above. var extrudedEllipseOutlineInstance = new Cesium.GeometryInstance({ geometry : ellipseOutlineGeometry, attributes : { color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.WHITE) } }); // Add both ellipse outline instances to primitives. primitives.add(new Cesium.Primitive({ geometryInstances : [ellipseOutlineInstance, extrudedEllipseOutlineInstance], appearance : new Cesium.PerInstanceColorAppearance({ flat : true, renderState : { depthTest : { enabled : true }, lineWidth : Math.min(2.0, scene.maximumAliasedLineWidth) //changes here dont seem to affect the actual size? } }) })); 
+5
source share
2 answers

I'm going to assume that you are on Windows (you will find out why in a minute).

The simple answer about why scene.maximumAliasedLineWidth always returns 1 is that the maximum value allowed by your web browser. This is why an error occurs when you use values ​​greater than 1. Of course, this answer only leads to more questions; so here is a more detailed answer.

The WebGL specification states that implementations support a minimum line width of 1; and there is no need to maintain the line width greater than 1. In practice, all OpenGL drivers support values ​​greater than 1; and I'm sure the hardware you use also works. However, all major WebGL implementations on Windows do not actually use OpenGL.

Chrome and Firefox use the library known as ANGLE (almost its own graphics engine) , which implements WebGL on Windows through DirectX. ANGLE is considered a standalone implementation. Since ANGLE prefers to maintain only line width 1 (I will not go into why); this means that both Chrome and Firefox are not able to draw wider lines on Windows (which confuses you to many other developers).

Internet Explorer 11 takes a similar approach, although they do not use ANGLE and instead have their own custom implementation based on DirectX. Worse, although they only claim to maintain a line width of 1; The browser itself always draws thick lines (which look between 3-5 pixels wide). Therefore, in IE it is impossible not to have thick lines.

Implementation on other platforms; whether it’s Android, iOS or Mac OS, there is no such problem. Your source code snippet will draw lines with a thickness of 2 on these platforms and 1 on Windows.

A convenient site for studying the implementation of WebGL used by your browser is http://webglreport.com/ . He can tell you if you use ANGLE, what are your minimum and maximum values ​​for many functions, as well as a lot of other information (which you can only take care of if you are a graphic programmer).

+10
source

I am using Firefox on Windows. I went to http://webglreport.com/ and confirmed these values. But I get polylines (MultiGeometry) with thicker lines without any problems. The problem is only in polygons.

0
source

Source: https://habr.com/ru/post/1200712/


All Articles