(Article) OpenGL with Visual C++ 2008 Express Edition

OpenGL with Visual C++ 2008 Express Edition

 

OpenGL is a popular cross-platform library for 2-D and 3-D graphics programming. OpenGL comes with implementations on most operating systems and many compilers, including Visual C++ 2008 Express Edition, a modern, free IDE and compiler from Microsoft. Once VC++ 2008 is installed you simply need to create a new project and link to the correct libraries and headers to start using OpenGL.

 

Run Visual C++ and create a new project:

  • Under the File menu select New → Project (Ctrl+Shift+N).

  • Select Win32 Project, enter a Name, and click OK.

  • In the Wizard click Next, then check the box next to Empty Project, and click Finish.

 

Add a new source file for the project:

  • Under the Project menu select Add New Item (Ctrl+Shift+A).

  • Select C++ File (.cpp), enter a Name, and click OK.

 

Link to the OpenGL libraries:

  • Under the Project menu select Project Properties (Alt+F7) at the bottom.

  • Select Configuration Properties → Linker → Input from the navigation panel on the left.

  • Select All Configurations from the Configuration drop-down box at the top of the dialog. This ensures you are changing the settings for both the Debug and Release configurations.

  • Type “opengl32.lib glu32.lib” in Additional Dependencies and click OK.

 

Now that your project is set up to use OpenGL you can start coding. Download opengl.cpp to begin with a basic Win32/OpenGL demonstration that compiles on VC++ 2008.

 

If everything is correct you should see a red square when running the code. Credit for this code goes mostly to examples from MSDN and NeHe.

 

To learn more about OpenGL programming there are several great online resources including NeHe Productions, OpenGL API Documentation, and GameDev.net.

 

Courtesy:- www.mrmoen.com

Google