#進入Blog,進入網址
#下載三個檔案 [data],[win32] ,glut32.dll
#解壓縮[data] 和[win32] 後,將data資料夾和 glut32.dll放入window資料夾
#開啟Shapes.exe 即可完成點線面
2.課堂作業
開啟GLUT檔
#先輸入茶壺程式
#include <GL/glut.h>
void display()
{
glutSolidTeapot(0.3);
glutSwapBuffers();
glColor3f(1,0,0);
}
int main(int argc,char **argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DEPTH);
glutCreateWindow("hello");
glutDisplayFunc(display);
glutMainLoop();
}
#改變背景
#include <GL/glut.h>
void display()
{
glutSolidTeapot(0.3);
glutSwapBuffers();
glColor3f(1,0,0);
glClear(GL_COLOR_BUFFER_BIT);
glClearColor(1,0,1,0);
}
int main(int argc,char **argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DEPTH);
glutCreateWindow("hello");
glutDisplayFunc(display);
glutMainLoop();
}
#成果








沒有留言:
張貼留言