step1:從網址下載: sorce , date , win32 ,glut32.dll ( jsyeh.org/3dcg10 )
step2:點擊 shape.exe

作業 02
#include<GL/glut.h> //標頭檔
void display()
{
glColor3f(1,0,0);//顏色
glutSolidTeapot(0.3);//大小
glutSwapBuffers();
}
int main(int argc,char**argv)
{
glutInit(&argc, argv); //引入程式
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH); //雙視窗
glutCreateWindow("hello 3D"); //視窗名稱
glutDisplayFunc(display); //展示
glutMainLoop();
}
作業 03
#include<GL/glut.h>
void display()
{
glClearColor(1,1,0,0);//黃背景
glClear(GL_COLOR_BUFFER_BIT);//清背景
glColor3f(1,0,0);//紅色
glutSolidTeapot(0.3);//茶壺
glutSwapBuffers();
}
int main( int argc,char *argv[])
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("hello openGL");
glutDisplayFunc(display);
glutMainLoop();
return 0;
}


沒有留言:
張貼留言