How to set line width in GLSL shaders?

Hi there,

I’ve had some luck with assigning floats to the gl_PointSize variable, but I haven’t figured anything out for changing the width of my the line_strip primitive that I’m producing. Can anyone help me find out if there’s something like gl_LineWidth = .5 or something? I’ve tried that but it crashes my glsl MAT. Thanks!

There is no way to do this unfortunately. The only way to create dynamic lines is with a geometry shader, but that’s a very manual process. It’s what the Line MAT uses.

Whoa I read your reply a few days ago and totally forgot to send something back. Sorry!

So in order to change the width of the lines I would need to use a geometry shader that produces 4 vertices offset some amount for each vertex that’s part of the original line?

I’m also having some issues with controlling the point size which I’m pretty sure gl_PointSize should have direct control over, but I don’t know if this is related…

Right, you’d take in a line primitive and output a triangle strip that’s the width of the line you want. It’s not a great workflow, but the only way unless you get into manually rasterizing your lines in the pixel shader.
gl_PointSize should work if you are rendering point sprites

Oh! I finally found the option “render as point sprites” that I was missing before. Thanks for your help!