Jiggered

08-23-2012, 12:08 PM

I'm having trouble with my gl_quad_strip loop which draws a cylinder, It draws the cylinder just fine, with the right height and radius.

The problem I am having is that it the angle of it is completely wrong, its rotated around and I'm struggling to fix it.

glBegin(GL_QUAD_STRIP);

for (int i = 0; i <= number_of_sides; i++) {

float angle = i*((1.0/number_of_sides) * (2*PI));

glNormal3d(cos(angle),sin(angle),0);

glVertex3d( radius*cos(angle), radius*sin(angle), height);

glVertex3d( radius*cos(angle), radius*sin(angle), 0);

}

glEnd();

The problem I am having is that it the angle of it is completely wrong, its rotated around and I'm struggling to fix it.

glBegin(GL_QUAD_STRIP);

for (int i = 0; i <= number_of_sides; i++) {

float angle = i*((1.0/number_of_sides) * (2*PI));

glNormal3d(cos(angle),sin(angle),0);

glVertex3d( radius*cos(angle), radius*sin(angle), height);

glVertex3d( radius*cos(angle), radius*sin(angle), 0);

}

glEnd();