PDA

View Full Version : How to draw a pipe?



razorclaw2010
11-12-2012, 05:28 AM
Hello,
I have question how can I draw pipe in opengl? I am using C++ and glut, I found something like this but i dont understand the code:

int ACC=48;
float a,p,q;
int i;

glBegin(GL_QUAD_STRIP);
for (i=0;i<=ACC;i++)
{
a = i*PI*2/ACC;
p = cos(a);
q = sin(a);
glNormal3f(p, q, 0.4);
glVertex3f(0.7*p, 0.7*q, 0.8);
glNormal3f(0.0, 0.0, 1.0);
glVertex3f(0.7*p, 0.7*q, 10);
}
glEnd();

Generaly I want to draw a spring but not with gl_Line_Stripe becouse i must to put material on it:(