Line Width


I find a function called "lineWidth". However, I cannot set the line width using this function. Since I think the drawn line is thin, I want to make it thick. Is there any method to make the line thick?

You should check the gl.get for getting the max line width (I forget what the token is for that request) - I bet it’s returning a max width of one pixel - which it’s allowed to do according to the spec. The reason being that under Windows, browsers often use the “ANGLE” code which runs WebGL on top of the native Direct3D library rather than the OpenGL implementation. Direct3D doesn’t support any kind of line width control - hence, to be compliant, it almost certainly reports back a max line width of 1.0.

All of which is very wonderful in theory - but in practice, you still don’t have fatter lines.

In the end, you’ve pretty much gotta draw them as polygons - which is a pain in the ass to get right…and slow as all hell in JavaScript.

In an ideal world, the ANGLE driver would convert lines to polygons for you…but even that is vastly more difficult than you might think because your vertex shader code might do something to screw up the line width.

Basically, you’re screwed!