2014年5月2日 星期五

01160554


void display()
{
glEnable(GL_DEPTH_TEST);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(angleX, 0,1,0);
glutWireTeapot(0.3);
 

glPushMatrix();//右肩
glTranslatef(0.5, 0, 0);
glutSolidSphere(0.2, 30, 30);
glPushMatrix();
glRotatef(angle2, 0, 0, 1);
glTranslatef(0.2, 0, 0);
glScalef(0.4, 0.2, 0.2);
glutSolidCube(1);
glPopMatrix();
glPopMatrix();

glPushMatrix();//左肩
glTranslatef(-0.5, 0, 0);
glutSolidSphere(0.2, 30, 30);
glPushMatrix();
glRotatef(angle2, 0, 0, 1);
glTranslatef(-0.2, 0, 0);
glScalef(0.4, 0.2, 0.2);
glutSolidCube(1);
glPopMatrix();
glPopMatrix();

//here
glPushMatrix();
glTranslatef(0.2, -0.3, 0);
glRotatef(angle3, 0, 0, 1);
glTranslatef(0, -0.25, 0);
glPushMatrix();
glScalef(0.2, 0.5, 0.2);
glutSolidCube(1);
glPopMatrix();
glPopMatrix();

glPushMatrix();
glTranslatef(0, 0.5, 0);
glutSolidSphere(0.2, 30, 30);
glPopMatrix();

glPopMatrix();
glutSwapBuffers();
}

沒有留言:

張貼留言