2014年2月27日 星期四

Week 02 葉正聖老師示範


Q: 在 Windows 8 下面無法用老師教的 Dev C++ 配 glut_3.7.6_.DevPak的方法, 請問要怎麼寫 GLUT程式?
A: 改使用 Code::Blocks 配合 freeglut 的方法 (相對算很簡單的作法哦!)

1. 下載 Code::Blocks 
1.1. (到 http://www.codeblocks.org/downloads/binaries 裡面去找 CodeBlocks-13.12mingw-setup.exe)
1.2. 下載 http://prdownload.berlios.de/codeblocks/codeblocks-13.12mingw-setup.exe 並安裝
(解釋: 這個版本裡面有 MinGW 的 gcc 編譯器,能用來寫程式編譯用, 後面的freeglut也是選用MingGW的版本哦)

2. 下載 freeglut
2.1. (到 http://www.transmissionzero.co.uk/software/freeglut-devel/ 裡面去找 freeglut 2.8.1 MinGW Package)
2.2. 下載 http://files.transmissionzero.co.uk/software/development/GLUT/freeglut-MinGW.zip 並解壓縮到 C:\freeglut 裡
2.3. 將剛剛 C:\freeglut\lib\libfreeglut.a 複製成 C:\freeglut\lib\libglut32.a (這一步很巧妙/很特別,把 freeglut當 GLUT來用)

3. 在 Code::Blocks 裡面新增 GLUT專案
3.1. Code::Blocks 中, File-New-Project, 選 GLUT專案
3.2. 在GLUT精靈的協助下, 填寫Project名、設定目錄(新開個資料吧)、然後把前面 freeglut 的 C:\freeglut 這個目錄取代 
3.3. 接下來享受運用 GLUT 寫 3D 程式的樂趣吧!







沒有留言:

張貼留言