GLfloat x,z,angle; // Storage for coordinates and angles
GLfloat fStep = (float)PI/4.0f;
GLfloat fHeight = 20.0f;
GLfloat fRadius = 4.0f;
glTranslatef(0, 6.0f, 0);
//brown
glRGB(139,101,8);
// Normals are easy for cylinders
glBegin(GL_QUAD_STRIP);
vNormal[0] = fRadius;
vNormal[1] = fHeight;
vNormal[2] = 0.0f;
ReduceToUnit(vNormal);
glNormal3fv(vNormal);
glVertex3f(fRadius, fHeight/3, 0.0f);
glVertex3f(fRadius, -fHeight/3, 0.0f);
for(angle = fStep; angle < 3.0f*PI; angle += fStep)
{
x = fRadius*fsin(angle);
z = fRadius*fcos(angle);
vNormal[0] = x;
vNormal[1] = fHeight;
vNormal[2] = z;
ReduceToUnit(vNormal);
glNormal3fv(vNormal);
glVertex3f(x, fHeight/3, z );
glVertex3f(x, -fHeight/3, z);
}
glEnd();
// Draw the box at both ends
glPushMatrix();
glTranslatef(0.0f, 2.0, 0.0f);
glRotatef(-90.0f,1.0f,0.0f,0.0f);
glRGB(0,230,0);
auxSolidCone(12.0f,16.0f);
glTranslatef(0.0f, 0.0, 12.0f);
auxSolidCone(6.0f,8.0f);
glPopMatrix();
}
///////////////////