code::blocks 與GLUT 程式開發 Ming-Te Chi Department of Computer Science National Chengchi University 2016
Outline Code blocks下載及安裝 Glut bin file下載及配置 創立一個glut範例程式
Code::Blocks下載 下載網址 http://www.codeblocks.org/
點選Download
點選 ”Download the binary release”
請依所使用之OS作下載 (在此僅以windows 系統做示範教學) 兩個選一個安裝即可
安裝Code Blocks 若選 codeblocks-16.01mingw-nosetup.zip 直接解壓縮即可,跳過這些步驟
依造內定
選擇安裝位置 PC教室的系統還原
執行Code Blocks
Glut bin file下載及配置 下載網址 http://www.xmission.com/~nate/glut.html
Do the following! After you download and open the GLUT bin zip file Copy glut32.dll to c:\windows\system32 or c:\windows\SysWOW64 (win 64) Copy glut32.lib to C:\Program Files (x86)\CodeBlocks\MinGW\lib Copy glut.h to C:\Program Files (x86)\CodeBlocks\MinGW\include\GL These are default locations, your paths may be different. But basically, you place the .lib and .h files in the location of your compiler (in this case mingw). The .dll file goes in the windows system directory. *在此放置 .lib .h檔案時必須依照code blocks所安裝的路徑,若code blocks安裝於D:\program files\Code Blocks則就必須放置於D:\program files\mingw\lib依此類推 綠色區替換成你安裝codeblocks的目錄
創立一個glut範例程式 File -> New -> Project
選擇GLUT 為project命名
指定路徑至MinGW 直接按下Finish
add at line 14: #include <windows.h>
按下 (F9) to Build and run 試著按下“+”、 “ –”,並觀察其執行狀況與code的撰寫方式
參考教學網址: http://wiki.codeblocks.org/index.php/Using_FreeGlut_with_Code::Blocks http://www.cs.nccu.edu.tw/~mtchi/course/cg16/codeblocks-16.01mingw-nosetup.zip http://www.sci.brooklyn.cuny.edu/~goetz/codeblocks/glut/ Mac使用glut可參考 http://web.eecs.umich.edu/~sugih/courses/eecs487/glut-howto/#mac