GLUT 程式開發
description
Transcript of GLUT 程式開發
![Page 1: GLUT 程式開發](https://reader035.fdocuments.net/reader035/viewer/2022081417/56813b97550346895da4cc2e/html5/thumbnails/1.jpg)
GLUT 程式開發GLUT 程式開發Ming-Te Chi
Department of Computer Science National Chengchi University
![Page 2: GLUT 程式開發](https://reader035.fdocuments.net/reader035/viewer/2022081417/56813b97550346895da4cc2e/html5/thumbnails/2.jpg)
OutlineOutline
Code blocks 下載及安裝Glut bin file 下載及配置創立一個 glut 範例程式
![Page 3: GLUT 程式開發](https://reader035.fdocuments.net/reader035/viewer/2022081417/56813b97550346895da4cc2e/html5/thumbnails/3.jpg)
Code::Blocks 下載Code::Blocks 下載下載網址– http://www.codeblocks.org/
![Page 4: GLUT 程式開發](https://reader035.fdocuments.net/reader035/viewer/2022081417/56813b97550346895da4cc2e/html5/thumbnails/4.jpg)
點選 Download
![Page 5: GLUT 程式開發](https://reader035.fdocuments.net/reader035/viewer/2022081417/56813b97550346895da4cc2e/html5/thumbnails/5.jpg)
點選 ” Download the binary release”
![Page 6: GLUT 程式開發](https://reader035.fdocuments.net/reader035/viewer/2022081417/56813b97550346895da4cc2e/html5/thumbnails/6.jpg)
請依照所適用之 OS 作下載( 在此僅以 windows 系統做示範教學 )
請依照所適用之 OS 作下載( 在此僅以 windows 系統做示範教學 )
兩者選一點擊下載
![Page 7: GLUT 程式開發](https://reader035.fdocuments.net/reader035/viewer/2022081417/56813b97550346895da4cc2e/html5/thumbnails/7.jpg)
安裝 Code Blocks
![Page 8: GLUT 程式開發](https://reader035.fdocuments.net/reader035/viewer/2022081417/56813b97550346895da4cc2e/html5/thumbnails/8.jpg)
依照內定
![Page 9: GLUT 程式開發](https://reader035.fdocuments.net/reader035/viewer/2022081417/56813b97550346895da4cc2e/html5/thumbnails/9.jpg)
選擇安裝位置
![Page 10: GLUT 程式開發](https://reader035.fdocuments.net/reader035/viewer/2022081417/56813b97550346895da4cc2e/html5/thumbnails/10.jpg)
執行 Code Blocks執行 Code Blocks
![Page 11: GLUT 程式開發](https://reader035.fdocuments.net/reader035/viewer/2022081417/56813b97550346895da4cc2e/html5/thumbnails/11.jpg)
Glut bin file 下載及配置Glut bin file 下載及配置下載網址
– http://www.xmission.com/~nate/glut.html
![Page 12: GLUT 程式開發](https://reader035.fdocuments.net/reader035/viewer/2022081417/56813b97550346895da4cc2e/html5/thumbnails/12.jpg)
Install glutInstall glut
After you download and open the GLUT bin zip file
Do the following!Copy glut32.dll to c:\windows\system32 or c:\windows\SysWOW64 (win 64)Copy glut32.lib to c:\program files\CodeBlocks\mingw\libCopy glut.h to c:\program files\CodeBlocks\mingw\include\
GL
![Page 13: GLUT 程式開發](https://reader035.fdocuments.net/reader035/viewer/2022081417/56813b97550346895da4cc2e/html5/thumbnails/13.jpg)
Freeglut( 另一個 glut 選擇 )Freeglut( 另一個 glut 選擇 )
http://files.transmissionzero.co.uk/software/development/GLUT/freeglut-MinGW.zip
Copy freeglut.dll to c:\windows\system32 or c:\windows\SysWOW64 (win
64)Copy libfreeglut.a to c:\program files\CodeBlocks\mingw\libCopy freeglut.h, freeglut_std.h, and freeglut_ext.h to c:\program files\CodeBlocks\mingw\include\GL
![Page 14: GLUT 程式開發](https://reader035.fdocuments.net/reader035/viewer/2022081417/56813b97550346895da4cc2e/html5/thumbnails/14.jpg)
建立一個 glut template建立一個 glut templateFile -> New -> Project
![Page 15: GLUT 程式開發](https://reader035.fdocuments.net/reader035/viewer/2022081417/56813b97550346895da4cc2e/html5/thumbnails/15.jpg)
• 選擇 GLUT • 為 project 命名
![Page 16: GLUT 程式開發](https://reader035.fdocuments.net/reader035/viewer/2022081417/56813b97550346895da4cc2e/html5/thumbnails/16.jpg)
• 指定路徑至 MinGW • 直接按下 Finish
![Page 17: GLUT 程式開發](https://reader035.fdocuments.net/reader035/viewer/2022081417/56813b97550346895da4cc2e/html5/thumbnails/17.jpg)
Troubleshooting in windowsTroubleshooting in windows
add at line 18: #include <windows.h>
![Page 18: GLUT 程式開發](https://reader035.fdocuments.net/reader035/viewer/2022081417/56813b97550346895da4cc2e/html5/thumbnails/18.jpg)
按下 (F9) to Build and run 則會出現以下執行畫面
![Page 19: GLUT 程式開發](https://reader035.fdocuments.net/reader035/viewer/2022081417/56813b97550346895da4cc2e/html5/thumbnails/19.jpg)
static void key(unsigned char key, int x, int y){ case '+': slices++; stacks++; case '-': if (slices>3 && stacks>3) { slices--; stacks--; }} //The number of geometry stacks and slices can be adjusted using the ‘+’ and ‘-’ keys.
![Page 20: GLUT 程式開發](https://reader035.fdocuments.net/reader035/viewer/2022081417/56813b97550346895da4cc2e/html5/thumbnails/20.jpg)
如果放對位置,但仍找不到 glut.h如果放對位置,但仍找不到 glut.h
請依下面流程,檢查路徑是否有你預期的一樣
![Page 21: GLUT 程式開發](https://reader035.fdocuments.net/reader035/viewer/2022081417/56813b97550346895da4cc2e/html5/thumbnails/21.jpg)
參考教學網址 :– http://www.sci.brooklyn.cuny.edu/~goetz/codeblocks/
glut/