2021年3月22日 星期一

MCUCG_Week05

 課程內容:

    1.開啟檔案
    
    2.旋轉軸的不同

    3.先旋轉再移動

    4.先移動再旋轉

    5.畫圖


    6.模擬考系統 -- > 
https://120.125.80.50/GL/
    7.github網址



#include <GL/glut.h>
#include <stdio.h>
float vx[2000],vy[2000];
int N = 0;
void display()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glBegin(GL_LINE_LOOP);
    for(int i = 0;i < N;i++)
    {
        glVertex2f(vx[i],vy[i]);
    }
    glEnd();
    glutSwapBuffers();
}
void mouse(int buttin,int state,int x,int y)
{

}
void motion(int x ,int y)
{
    printf("%d %d\n", x, y);
    vx[N] = (x - 150)/150.0;
    vy[N] = -(y - 150)/150.0;
    N++;
    display();
}
int main(int argc ,char**argv)
{

    glutInit( &argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("Week05 Drawing");

    glutDisplayFunc(display);
    glutMouseFunc(mouse);
    glutMotionFunc(motion);
    glutMainLoop();
}


沒有留言:

張貼留言

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

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