Skip to main content
GameDev.net gamedev.net
🔒 Locked

line thickness

Started by Tera_Dragon Oct 5, 2004 at 4:15 PM 7 replies 500+ views
Original Post
Tera_Dragon
Tera_Dragon
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
____________________________________________________________Programmers Resource Central
uavfun
uavfun
Use glLineWidth().
Jehsup
Jehsup
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

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.


Hope that gets you going...

J



Jehsup
Jehsup
No, prob

J
Tera_Dragon
Tera_Dragon
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
____________________________________________________________Programmers Resource Central
uavfun
uavfun
Make sure you enable GL_LINE_SMOOTH
uavfun
uavfun
You'll probably need to enable alpha blending as well
glEnable(GL_BLEND);glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.