2017電腦圖學
2017 / 2 / 21
1. 介紹 Why圖學、OpenGL
2. 座位、FB、Blog作品
3. 第一個OpenGL程式
4. 第一個GLUT程式
5. 親手打造10行程式
hw1-
Step:開啟codeblocks -> file -> new -> " Project " (專案)
hw2-
OpenGL 專案
Step:開啟codeblocks -> file -> new -> Project -> OpenGL project
hw3-
GLUT 專案
Step:開啟codeblocks -> file -> new -> Project -> GLUT project
hw4-
由剛才的GLUT專案,把main.cpp的程式碼減少來畫出茶壺。
程式碼:
#include <GL/glut.h>
static void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glutSolidTeapot(0.3); // 畫茶壺
glutSwapBuffers();
}
}
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("GLUT Shapes");
glutDisplayFunc(display);
glutMainLoop();
glutMainLoop();
return EXIT_SUCCESS;
}
}
沒有留言:
張貼留言