2017年3月13日 星期一

Week03




一   滑鼠函示   

    ///glutMouseFunc(mouse);       
    ///glutMotionFunc(motion);        




二    滑鼠作標   ///glutMouseFunc(mouse);


void mouse(int button, int state, int x, int y)
{
    printf("%d %d %d %d\n",button,state,x,y);
}






三   點選變色





四   滑鼠脫一變色 ///glutMotionFunc(motion);





五   化緣


程式碼

void display()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glBegin(GL_POLYGON);    ///可以更改為線
        for(float angle=0; angle<3.1415962*2; angle+=0.001)
        {
            glVertex2f( cos(angle),sin(angle));  ///調整角度        }
    glEnd();
    glutSwapBuffers();
}


沒有留言:

張貼留言