1.主題:點.線.面.顏色
2.實作:第一個新手寫出
3.漏題:期中考題
4.回家做
TODO:到http://www.cmlab.csie.ntu.edu.tw/~jsyeh/3dcg10/
下載:windows.zip-解-下載/windows/Shape.exe
data.zip-下載/windows/data/模型
glut32.dll-下載/windows/glut32.dll
以下圖片都是今天的結果
跟上周一樣先上網找freeglut下載freeglut-MinGW在解壓縮再進去lib複製libfreeglut貼到同樣的頁面再改名為libglut32再進去codeblocks的openGL點開裡面,先把程式隱藏再打
#include <GL/glut.h>
void display(){
glutSolidTeapot(0.3);
glutSwapBuffers();
}
int main(int argc,char**argv){
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
glutCreateWindow("06160396-Week03");
glutDisplayFunc(display);
glutMainLoop();
}
就會出現以下的圖片
然後如果要變色就在原本的程式當中加入 glColor3f(1.00,0.00,0.00);
就會發現水壺變成紅色
程式如下
#include <GL/glut.h>
void display(){
glutSolidTeapot(0.3);
glutSwapBuffers();
}
int main(int argc,char**argv){
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
glutCreateWindow("0");
glColor3f(1.00,0.00,0.00);
glutDisplayFunc(display);
glutMainLoop();
}
圖片如下
沒有留言:
張貼留言