OpenGL line weight

I have successfully created a spiral with GL_LINE_STRIP

. Now I'm wondering if it's possible to make the line thicker. A google search made me understand two options. I can make triangles to make a quad ... Or just use it somehow glLineWitdh

? I just want the simplest way to do this, so it supports the next Im going to do. Which should color certain line segments.

Using OpenGL ES 2.0

+3


source to share


1 answer


glLineWidth()

is obviously easier if it suits your needs. However, there is one big caveat in ES 2.0: the maximum width supported by a particular device can be 1.0. This means that devices can be ES 2.0 compliant without wideband support.

You can get the range of strings supported:

GLfloat lineWidthRange[2];
glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, lineWidthRange);

      



lineWidthRange[1]

will be the maximum supported line width. Based on specification table 6.18, the minimum allowable value for this limit is 1.

Based on this, the drawing geometry (triangles) that give the actual width to your lines is the only approach that is guaranteed to work on all devices.

+5


source







All Articles