2021年3月29日 星期一

08160324 week06

1.物體旋轉

#include <GL/glut.h>
#include <stdio.h>
float angle=0;
int N=0,vx[3000],vy[3000];
void display()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glPushMatrix();
        glRotatef(angle,0,0,1);//旋轉
        glScalef(0.5,0.1,0.1);//細長
        glColor3f(0.3,0.3,1.0);//藍色
        glutSolidCube(1);//方塊
    glPopMatrix();//還原矩陣
    glutSwapBuffers();//交換兩倍的buffers
}
void keyboard(unsigned char key,int x,int y)
{
}
void motion(int x, int y)
{
    angle++;
    display();
}
int main(int argc, char *argv[])
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("08160324 陳重任");
    glutDisplayFunc(display);
    //glutMouseFunc(mouse);
    glutMotionFunc(motion);
    glutMainLoop();
}





沒有留言:

張貼留言

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

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