How do I change the width of a single
line, without changing all line widths. Im drawing my lines “on the fly” in a for loop, not using vertex arrays.
Peace.
How do I change the width of a single
line, without changing all line widths. Im drawing my lines “on the fly” in a for loop, not using vertex arrays.
Peace.
[This message has been edited by iss (edited 04-14-2001).]
Line width cannot be changed inside a Begin/End.
Actually, thanx.
GLfloat thickness;
for(int i=0;i<n-1;++i)
{
if(ThisIsTheLine[i]) //your truth function for vertex i->i+1
thickness=5.0;
else
thickness=1.0;
glLineWidth(thickness);
glBegin(GL_LINES);
glVertex3f(x[i],y[i],z[i]);
glVertex3f(x[i+1],y[i+1],z[i+1]);
glEnd();
}
glLineWidth(1.f);//reset
[This message has been edited by iss (edited 04-14-2001).]
Transcend think of OpenGL as a state machine. You set a state and it stays that way until you change it again. Such is linewidth … if you set the linewidth, all lines will be drawn at that width until you change it again. To change the width of a single line, set the linewidth you want, draw the line, then set it back to it’s previous width (as demonstrated in the code above).