2020年3月10日 星期二

Week02 /*windows資料夾

做出上禮拜的GLUT,接下來要自己打程式碼惹

主函式內: 
glutInit(&a,b);//讀入參數

glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
//啟動3D顯示能力

glutCreateWindow("Week02");//叫一個視窗,名為week02

glutDisplayFunc(display);//呼叫函式畫圖

glutMainLoop();//主要迴圈,畫面卡在這
display函式內:
  glColor3f(0.5,1.0,0.2);//畫圖前才有用,f是指float
//glcolor3ub(0,255,255); unsigned bytes 範圍是0~255

   glutSolidTeapot(0.3);//實心茶壺

   glutSwapBuffers();//交換兩倍 buffer s

到這裡3D圖學下載windows.zip、data.zip、glut32.dll,將壓縮檔解壓縮,data、glut32.dll複製貼至windows資料夾。
我用好了,直接下載就行windows資料夾
glBegin(GL_POLYGON);
    glColor3f(1,0,0); glVertex2f(1,0);//三角形頂點
    glColor3f(0,1,0); glVertex2f(-1,1);
    glColor3f(0,0,1); glVertex2f(-1,-1);

glEnd();
glutSwapBuffers();
glBegin(GL_POLYGON);>改成>glBegin(GL_LINE_LOOP);

沒有留言:

張貼留言