1.打開codeblock>file>new>project>OpenGL專案
2.google找freeglut下載Download freeglut 2.8.1-1 for MinGW並解壓縮>打開freeglut資料夾
找lib複製libfreeglut.a改成libglut32.a>開啟codeblock建立新project(GLUTproject)
>把路徑C:\Users\USER\Desktop\freeglut貼上完成
3.寫程式
#include <GL/glut.h>
void display()
{
glFlush();
}
int main (int argc, char **argv)
{
glutInit(&argc,argv);
glutCreateWindow("02160022翁子喻");
glutMainLoop();
}
4.出現實體茶壺程式與執行結果
#include <GL/glut.h>
void display()
{
glutSolidTeapot(0.3);
glFlush();
}
int main (int argc, char **argv)
{
glutInit(&argc,argv);
glutCreateWindow("02160022翁子喻");
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
沒有留言:
張貼留言