2021年3月22日 星期一

非凡尊貴的王冠 想要擁有 想要擁入手中week05

畫圖
#include <GL/glut.h>
#include <stdio.h> ///TODO
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();

} ///TODO 印出來

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...