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).
source share