# line thickness

This topic is 5459 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

How can I change the thickness of a line? I know that I can use glPointSize() for points, but I can't find one for lines. Tera_Dragon

##### Share on other sites
Use glLineWidth().

##### Share on other sites
Hi,

Yes, just use...

//make line width 2.0 for example. I'm pretty sure the default is 1.0;
glLineWidth(2.0f);

Note: From the Spec
<quote>
Not all widths can be supported when line antialiasing is enabled. If an unsupported width is requested, the nearest supported width is used. Only width 1.0 is guaranteed to be supported; others depend on the implementation. The range of supported widths and the size difference between supported widths within the range can be queried by calling glGet with arguments GL_LINE_WIDTH_RANGE and GL_LINE_WIDTH_GRANULARITY.
</quote>

Hope that gets you going...

J

##### Share on other sites
haha, how simple. Thank you.

No, prob

J

##### Share on other sites
This has nothing to do with the width of the line, but is to do with the antialiasing. When I set it with the following line (taken from nehe):
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
Nothin is different about the line. I rememberwhat Jehsup had just posted, and so set the line to width one again, but still the line looks bad (no difference) when it is diagonal. I am setting itcorrectly, or is there a better way of doing it?
Tera_Dragon

##### Share on other sites
Make sure you enable GL_LINE_SMOOTH

No difference.

##### Share on other sites
You'll probably need to enable alpha blending as well
glEnable(GL_BLEND);glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 13
• 14
• 40
• 63