2021年5月24日 星期一

賣女孩的小火柴Week14

 

void timer(int t)
{
    glClearColor(1,0,0,0);
    display();
}

glutWireSphere(0.3,12,30);



int diff=2;
void timer(int t)///鬧鐘響了,timer叫了
{
    glutTimerFunc(30,timer,t+1);
    angle+=diff;
    if(angle>180) diff=-diff;
    if(angle<0) diff=-diff;
    display();
}

void drawArm1(){
    glPushMatrix();
        glScalef(1,0.5,0.5);
        glColor3f(1,0,0);glutSolidCube(0.3);
    glPopMatrix();
}
void display()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glPushMatrix();
     glColor3f(1,1,1);glutSolidCube(0.4);
     glPushMatrix();
        glTranslatef(-0.2,+0.2,0);
        glRotatef(angle,0,0,1);
        drawArm1();
    glPopMatrix();
    glPopMatrix();
    glutSwapBuffers();
}







沒有留言:

張貼留言

Week18期末作業(橘貓的跳舞熊熊)

 期末作業(橘貓的跳舞熊熊) 影片: https://youtu.be/R89tptMaQZw 程式碼: #include <opencv/highgui.h> #include <opencv/cv.h> #include <GL/glut.h...