Practical 7
Practical 7 is for us to learn how to create quadratic ojects such as cylinders and disk and also to creat lighting.
These are the shapes i came up with
Cylinder
Cylinder with lighting
Disk
Sample code for the cylinder:
glPushMatrix();
glTranslatef(0, 0, -20);
cylinder = gluNewQuadric();
glColor3ub(255,0,0);
gluCylinder(cylinder,5,5,30,32,32);//bigger
gluQuadricDrawStyle(cylinder, GLU_FILL);
glPushMatrix();
glTranslatef(0, 0, -20);
glColor3ub(0,0,255);
gluCylinder(cylinder,8,8,20,32,32);//bigger
gluQuadricDrawStyle(cylinder, GLU_FILL);
glPopMatrix();
glPushMatrix();
glTranslatef(0, 0, 20);
glColor3ub(0,255,0);
gluCylinder(cylinder,2,2,40,32,32);//bigger
gluQuadricDrawStyle(cylinder, GLU_FILL);
glPopMatrix();
glPopMatrix();
No comments:
Post a Comment