1

As stated in three.js docs:

Due to limitations in the ANGLE layer, with the WebGL renderer on Windows platforms linewidth will always be 1 regardless of the set value.

Wide lines also don't work in some browsers that don't use ANGLE, such as IE11

enter image description here

and this question discusses workarounds.

But is there a way to detect if the browser supports wide lines?

Community
  • 1
  • 1
marcin
  • 3,351
  • 1
  • 29
  • 33
  • 1
    Check also [this related question](http://stackoverflow.com/q/11638883/1697459), you might find something useful there too. – Wilt Jul 13 '16 at 11:47

2 Answers2

5

Yes, there is a parameter for that: ALIASED_LINE_WIDTH_RANGE. When queried, it returns a range on possible values for a line width:

gl.getParameter(gl.ALIASED_LINE_WIDTH_RANGE) // returns [1, 1] on my machine, for example
Kirill Dmitrenko
  • 3,474
  • 23
  • 31
  • Thanks. For completeness, in three.js it'd need to be after `var gl = renderer.context;` – marcin Jul 12 '16 at 18:40
  • 1
    of interest: view-source:https://www.khronos.org/registry/webgl/sdk/tests/conformance/limits/gl-line-width.html – gaitat Jul 12 '16 at 19:35
1

FYI:

While you can call gl.getParameter(gl.ALIASED_LINE_WIDTH_RANGE) and it returns an array with the min and max widths for lines, pretty much 1.0 is all that is supported. This is not just because of ANGLE.

OpenGL itself has not supported lines larger than 1.0 since version 3.1. From the spec.

E.2.1 Deprecated ... Features

  • Wide lines - LineWidth values greater than 1.0 will generate an INVALID_VALUE error.

Note this is in the core profile of OpenGL. You can use a "compatibility profile" and still get wide lines and all the other old cruft. Unfortunately to implement WebGL2 required using the "core" profile which means pretty much all of WebGL only supports lines of width 1.0.

gman
  • 100,619
  • 31
  • 269
  • 393