OpenGL / Mesa3D programming in Visual Studio

Update: You will need to move the various .dll files into your project folder so they are in the path of the application, otherwise you will get missing DLL errors.

I am currently taking the Computer Graphics and Visualisation module at university and it require writing some programs in C using OpenGL / Mesa3D. Unfortunately the guides and tutorials they give on how to do it on Windows are from 1997, so i have decided to update them for 2010.

In this tutorial i am using Mesa3D 7.6.1, Visual Studio 2008. It also works with Visual Studio 2010 Beta 2.

The first step is to either download the Mesa3D Binaries from here or to compile them from source (compiling from source is pretty simple). Then extract the file somewhere sensible.

The second step is to setup a Visual Studio project so we can actually code something.

First create a new ‘Win32 Console Application’:

image

Then choose your options. I’m picking a Empty project for this, but modify the options to what ever your needs are.

image

Click finish then we, and we have our newly created project. Now we need to make a few changes, to include the additional libraries, and header files we require.

image

Open up project properties. Then under ‘Configuration Properties’->‘C/C’++->’General’ you have the ‘Additional Include Directories’ setting, open this up, and add a folder, and navigate to your Mesa3D folder and select the ‘include’ directory.

It has been noted that you need to have at least ONE .c / .cpp / .h file in your project for the C/C++ options to become available.

image

Then go back to project properties, now under ‘Configuration Properties’->‘Linker’->’General’ you have the ‘Additional Library Directories’ setting, open this up, and add a folder, and navigate to your Mesa3D folder and select the ‘lib’ directory.

image

Now you can do your coding as you like. Import code straight from your Linux projects (Use ‘Add Existing Items’) and it should compile fine if you have done everything correctly.

Anyway i hope this helps someone, if you have any comments for potential improvements or problems you are having, then please leave a comment and i will try to help out.

40 thoughts on “OpenGL / Mesa3D programming in Visual Studio

  1. I’m not very familiar with Visual Studio or compiling source on Windows in general. Could you go over how you compiled from source? When I tried to build some .dll files were generated but I see no .lib files.

    Thanks!

    • Hello

      It should just be a matter of getting the latest source code, opening the projects in VS, then just compiling.
      I cannot remeber where the .lib files are created, but just search the build directory to find them.

      Sorry i cannot be more help, but i dont have VS available atm.

Leave a Reply to Wyatt Cancel reply