Search code examples
openglglslopengl-3

Set line width in OpenGL 3 / GLSL 130


I'm using a scene where wireframes are shown and where I want to set the width of the used lines to 2.

When I search for this problem, I only stumble upon glLineWidth()-function which seems to belong to old OpenGL 1.x

So: how can I set the width of wireframe lines when OpenGL3 / GLSL 130 is used?


Solution

  • Line width was never removed from OpenGL. It was deprecated, but in 3.1, when most of the deprecated features were removed, line width was not among them. So there's no reason you shouldn't be able to use it in OpenGL 3.1+ core profile.

    Just don't create a "forward compatibility context", and you should be fine. Now yes, MacOS's OpenGL support doesn't let you create a 3.1+ context unless you declare it to be forward compatible. But MacOS deprecated OpenGL as a whole, so how long the API will be supported on that platform is unclear.