|
OPENGL - GETTING STARTED WITH VC++ IDE ON WINDOWS
Notes on where to download and how to setup the OpenGL and GLUT development libraries on Windows. Also explains step by step, how to set up the Makefiles and build the sample programs with Visual C++ IDE. Microsoft OpenGL Development libraries VisualC++ for 98/NT and comes with the Microsft implementation of OpenGL ..\lib\opengl32.lib ..\lib\glu32.lib ..\lib\glaux.lib ..\include\GL\gL.h ..\include\GL\glaux.h ..\include\GL\glu.h ..\windows\system\glu32.dll ..\windows\system\opengl32.dll [ in NT machines at ..\winnt\system32\ ] Allows you to either write OpenGL application where you open a window using Windows SDK calls. Or use the auxillary library [ glaux.h and the redbook samples ] to initialise the window and handle input. Silicon Graphics OpenGL Development libraries You can also download the Silicon Graphics implementation of OpenGL from http://www.opengl.org/Downloads/DevDownloads.html Available as Installshield insallable image. ..\oglsdk\lib\glu.lib ..\oglsdk\lib\opengl.lib ..\oglsdk\include\gl.h ..\oglsdk\include\glu.h ..\windows\system\glu.dll ..\windows\system\opengl.dll [ in NT machines at ..\winnt\system32\ ] Using OpenGL and Windows SDK (without using GLUT or MFC) sphere.c is a sample code distributed as part of the Silicon Graphics OpenGL insatllation for windows. This program sets up a window using SDK and uses OpenGL to render a rotating sphere. Here is the code sphere.c [ available in the Silicon Graphics insatllation samples ] Building the WindowsSDK/OpenGL sample program in VC++ (1) Fire up Visual Studio (2) Craete a new project a Skeleton empty Win32 application frame work File -> New -> Project -> Win32 Application -> An Empty Application [ Craetes the .dsp and .dsw files for the project ] (3) Copy sphere.c in to the newly created project directory (4) add sphere.c to the Source Files of the FileView tree of the project. (5) Project -> Settings -> Link In the Object library modules: add opengl32.lib [ if using Microsft OGL ] or opengl.lib [ if using SGI OpenGL ] (6)sphere.c uses a timer function timeGetTime() which rquires winmm.lib to be linked. The default Win32 skeleton does not link to winmm.lib. So please add winmm.lib also to the link line before adding opengl32.lib. (7)Now you are ready to build, Go F5 .... Downloading GLUT [ OpenGL UTility libraries ] http://reality.sgi.com/mjk_asd/glut3/glut3.html#windows You can either download the fullsource and sample code [ glut37.zip 3681 kilobytes ] and build it on your machine [ how to build using Visual Studio described below ] Or if you want just the GLUT header file, the .LIB, and .DLL files all pre-compiled for Intel platforms, you can simply download the glutdlls37beta.zip file (149 kilobytes). dll's also available at http://www.opengl.org/Downloads/Downloads.html GLUT 3.7 is available for download at Winzipped file glut37.zip unzips the complete source tree with makefiles for windows/SGI/LInux and other platforms Building glut using VisualC++ compilers system (1) Read the "README.win" (2) Change "glutwin32.mak" property from read-only to writable (3) Change the paths to point to the correct directory where your opengl libraries are installed you can either choose the microsoft implemetaion path or shi path. Also select Win98/WinNT This was my glutwin32.mak for Windows98 VisualC++ 6.0 Standard edition using the Microsft OpenGL libs. [ The changes I made are marked #<<<< #>>>>> ] Running "glutmake.bat" Since its a MSDOS-Batch file you have to open the DOS shell and run it from the DOS-PROMPT. As you can see glutmake.bat uses nmake to build. nmake is part of the VisualC++ compiler system You will have to set the correct environment paths for using the VisualC++ compiler system outside the Visual Studio IDE. so before running glutmake.bat run vcvars32.bat [ found at ..\bin in your Visual Studio installation ] to set the environment variables. Instead typing the whole path you can copy vcvars32.bat to the directory where glutmake.bat resides and run it. NOTE: While running vcvars32.bat You might get an error saying "Out of Environment space". This can be fixed by seting the DOS Shell properties. Right click the Titlebar of the DOS Window and select properties from the pulldown menu. Go to Memory tab sheet. Set the Initial environment to 2048. [ This will be set to auto by default ] now it vcvars32.bat should run fine. Now go ahead and run glutmake.bat which will build all the glut libraries. All the glut samples will be built using glutmake.bat Building GLUT sample file double.c using VC++ IDE double.c is a simpe double buffered example in ..\glut-3.7\progs\redbook\ directory. (1) Fire up Visual Studio (2) Craete a new project a Skeleton empty Win32 Console application frame work File -> New -> Project -> Win32 Console Application -> An Empty Application (3) Copy double.c in to the newly created project directory, If read only make the file writable. (4) Project -> Settings -> Link In the Object library modules: add opengl32.lib and glut32.lib to the link line. (5)Tools -> Options -> Directories -> Include files & Library filesadd the path to the glut include files and library files. ( look where glut.h and glut32.lib are stored ) [ usually at ..\GLUT-3.7\INCLUDE\ ..\GLUT-3.7\LIB\GLUT\ ] (6) Ready to build . Go F5 ... NOTE: THIS WAS WRITTEN CIRCA 1999 , PLEASE GO TO THE MENTIONED URL's ABOVE TO GET THE LATEST LIBRARIES, AND FOLLOW THE INSTRUCTIONS. ALSO PLEASE EMAIL ME IF ANY INFORMATION IS WRONG OR OBSOLETE NOW. |
| Wednesday, 26-May-2004 09:43:49 PDT | kishan at hackorama dot com |


