Mrmoen.com / Matt Moen
Technical Projects, Interests, and Tutorials

OpenGL with Visual C++ 2008 Express Edition

March 30th, 2008 by Matt Moen

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.

New ProjectRun 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.

Linker InputLink 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.

Red Square using OpenGLNow 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.


Posted in Tutorials

9 Responses

  1. dude

    Dude, I love you!

    I thought I never get this visual studio to work but with your tutorial I made it work. Thanks man.

  2. Brandon Moody

    This is great. I really appreciate it. All smiles here.

  3. SpaceForce

    Thanks, it works for both professional and express editions!

  4. Steve Thomas

    If only I’d found your page this morning I wouldn’t have been pulling my hair out all day!

    I have never been so happy to see a red square.

    Thanks!

  5. Ashish

    Simply smoothhhhhhhhhhhh.
    works accurately.

  6. Richard

    Thanks ! Finally I ran my code successfully !

  7. Golask

    Thank you, you explained in a very clear way. Thanks again and good luck

  8. Shashank

    I have been trying to figure out how to do this for last 2 days by myself. And now with 15 mins of search i found this page and it did solve my problem. Thank you so much.

  9. Stephen

    Wow! finally something that works!!! This is awesome. I’ve spent hours trying to get visual C++ to work and no tutorials so far have got anything other than compile errors

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.