How do I make just single lines in opengl?
I thought of making a sort wired plane with lines. like this (psuedo code):
for(0;i<=20;i++)
{
glBegin(GL_<???> ); //lines?
glVertex3f(0, i, 0);
glEnd();
}
Or how to do it? thanks.
How do I make just single lines in opengl?
I thought of making a sort wired plane with lines. like this (psuedo code):
for(0;i<=20;i++)
{
glBegin(GL_<???> ); //lines?
glVertex3f(0, i, 0);
glEnd();
}
Or how to do it? thanks.
Lines are made up of 2 vertex points so something like the following would be more like it…
to draw a single line…
glBegin(GL_LINES);
glVertex3f(x1,y1,z1); glVertex3f(x2,y2,z2);
glEnd();
to draw multiple lines…
glBegin(GL_LINES);
for (i=0;i<maxi;i++)
{
glVertex3f(x1[i],y1[i],z1[i]);
glVertex3f(x2[i],y2[i],z2[i]);
}
glEnd();
Hope that helps you in some way
Tina
Use GL_LINE_LOOP if you want to make wireframe polygons.