line thickness
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
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
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
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
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
You'll probably need to enable alpha blending as well
glEnable(GL_BLEND);glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement