Build an OpenGL mesh viewer with glut(1)-Setup development environment

For this project development, we use Glut to build the interface which provide the UI such as window, menu and mouse/key interaction, as a beginner, Glut is good choice, because it is easy to use and do not need spend much time on learning it.

We choose MS Visual studio 2012 express for desktop as the IDE, it can be downloaded from Microsoft. , and the most important is get OpenGL library.

 Install Visual C++ Express 2012

1. Download Visual C++ Express from: http://www.microsoft.com/express/Downloads/

2. Run setup and follow instructions to install Visual C++.

 Install FreeGLUT

1. Download “freeglut 2.8.1 MSVC Package” from http://www.transmissionzero.co.uk/software/freeglut-devel/
2. Extract the compressed file freeglut-MSVC.zip to a folder freeglut
3. Inside freeglut folder:
On 32bit versions of windows
copy all files in include/GL folder to C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include\gl
copy all files in lib folder to C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib
copy freeglut.dll to C:\windows\system32
On 64bit versions of windows:
copy all files in include/GL folder to C:\Program Files(x86)\Microsoft SDKs\Windows\v7.0A\Include\gl
copy all files in lib folder to C:\Program Files(x86)\Microsoft SDKs\Windows\v7.0A\Lib
copy freeglut.dll to C:\windows\SysWOW64

Create Visual C++ project using sample code

1. Download sample code: Glut_demo
2. Click on create new project in Visual Studio
3. Select Win32 Console Application, type name of your project and click on OK
4. On wizard window that shows up, click Application Settings and check Empty Project, click Finish.
5. Select Add Existing Item from Project menu
6. Select all source files in sample code and click add
7. Select Properties from Project menu
8. At the top of the window, change Configuration to All Configuraitons.
9. Select Linker->Input from tree on your left.
10. In Addititonal Dependencies on right pane, add “;freeglut.lib” to the end, if you use glew, also add “;glew32.lib”.
11. Click OK and select Build Solution from Debug menu
12. Run the program by hitting Ctrl+F5, right click on the black window, select “teapot”, a white wireframe teapot will be shown in the black stage like blow

glutdemo

Posted in CG

Leave a Reply

Categories

Related Posts