1. 至 https://jsyeh.org/3dcg10
下載data.zip windows.zip glut32.dll 3個檔案
2. windows.zip =解壓 >> 下載\windows\Shapes.exe
data.zip =解壓 >> 下載\windows\data\模型
glut32.dll =複製 >> 下載\windows\glut32.dll
3. 跑 Shapes.exe
左可按右鍵選單: 大頂點、很多顏色
右可按右鍵選單: POINT....POLYGON
=========================================================================
- GLUT專案茶壺
moodle下載freeglut.zip >> 解壓縮至桌面 >> freeglut資料夾 >> lib >> 將libfreeglut.a複製貼上 >> 重新命名libglut32.a (此步驟才能讓codeblocks跑)
codeblocks 17.12 >> file >> new >> project >>選GLUT >> 存桌面 >> next >> 設定GULT目錄(如圖) >> 跑程式
將程式碼都刪掉 >>
#include <GL/glut.h>
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glColor3f(1,1,0);
glutSolidTeapot(0.3);
glutSwapBuffers();
}
int main(int argc,char** argv){
glutInit( &argc,argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("第2週的程式");
glutDisplayFunc(display);
glutMainLoop();
}
- 彩色三角形
#include <GL/glut.h>
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glColor3f(1,1,0);
///glutSolidTeapot(0.3);
glBegin(GL_POLYGON);
glColor3f(1,0,0);
glVertex2f(-1,-1);
glColor3f(0,1,0);
glVertex2f(+1,-1);
glColor3f(0,0,1);
glVertex2f(0,+1);
glEnd();
glutSwapBuffers();
}
int main(int argc,char** argv){
glutInit( &argc,argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("第2週的程式");
glutDisplayFunc(display);
glutMainLoop();
}
沒有留言:
張貼留言