2016年3月21日 星期一

week04

選出覺得做最好的5個作品










課堂作業:

打開GLUT檔案

打上程式碼

程式碼如下:

#include <GL/glut.h>
#include <stdio.h>
void mouse(int button, int state,int x,int y)
{
    if(state==GLUT_DOWN)
        printf("  glVertex2f( (%d-150)/150.0, -(%d-150)/150.0 ); \n",x,y);
}
void display()
{
    glClearColor(150/255.0,170/255.0,55/255.0,1);
    glClear(GL_COLOR_BUFFER_BIT);
    glColor3ub(175,193,81);

    glutSwapBuffers();
}

int main(int argc, char **argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("GLUT Shapes");
    glutDisplayFunc(display);
    glutMouseFunc(mouse);
    glutMainLoop();
}

按下build執行後

會有個綠色的視窗
在視窗上面點自己想要的圖形
小黑窗會依照自己點的位置跑出資料

複製小黑窗內的資料 
在視窗上按右鍵
在選擇編輯  
最後再按標記

框起所有資料
按Enter執行:

就會跑出你案過的痕跡的圖案 !!

沒有留言:

張貼留言