Till KTH:s startsida Till KTH:s startsida

OpenGL and Visual Studio

The following explains how to get started with Visual Studio 2010 and OpenGL. This is written from memory and may contain errors. If you find any errors, please report them to a TA, and we'll correct it.

  1. Create an empty C++ project in Visual Studio
    • File->New->Project...->Visual C++->General->Empty Project
  2. Locate the project directory where all project files go
    • Usually located under My Documents\Visual Studio 2010\Projects\<project name>\<project name>\
  3. Copy all the code, .dll, and .lib files provided for this assignment to this directory.
  4. Go back to Visual Studio and run the project (F5).
    • If the files don't show up in Visual Studio, then you may need to add them. This is done by right clicking on the project and selecting Add->Existing items. Select the GL folder and all .h and .cpp files in the project directory, and click add.
    • If you get compile errors, this is likely because it can't find <GL/glut.h>
    • A quick way to remedy this is to use relative paths ("") instead of include paths (<>). Relative paths are relative to the place where the project files go, so if you copied the files verbatim to the project directory, you can simply replace <GL/glut.h> with "GL/glut.h" in all .h and .cpp files.
    • Another possible issue is the "#ifdef WIN32". This is used to include windows.h if you compile the code on a Windows system. If the "#include <windows.h>" has faded colours, then it is not included. To include this file, either change "WIN32" to "_WIN32", or remove the "#ifdef" and "#endif" lines around the include statement.

Victor Wåhlström skapade sidan 4 april 2011

kommenterade 5 april 2011

Hi,

Im wondering which code version handling system we should use for this assignment?

Thanks!

kommenterade 5 april 2011

Hi,

KTH provides access to your own SVN (Subversion) repository. You can manage your repository at https://svn.csc.kth.se/admin/

In order to commit or checkout code from the repository, you need an SVN client. On Windows, you can use TortoiseSVN (should be installed on the computers in the computer lab). When properly installed, TortoiseSVN should show up in Windows Explorer's context menu (right click menu).

If you want integrated support in Visual Studio, you can install an extension, such as AnkhSVN. This has to be downloaded and installed, so I don't think you can use it on the school computers at this time. If you use Visual Studio 2010 on your own computer, this can be installed via Tools->Extension Manager->Online Gallery (search for "svn").

Linux and Mac should have a CLI-based (text) SVN client. If you're using Eclipse, there are two integration plugins you can use; Subclipse and Subversive. Either one should work, though I haven't used them in a while, so I can't comment on their current state.

/end wall-of-text

kommenterade 5 april 2011

Great answer. Thanks!

kommenterade 15 april 2011

Hej!

Jag undrar varför får jag sådana kommentare när jag kompilarar i OpenGL

'solsystem.exe': Loaded 'C:\Windows\SysWOW64\wintrust.dll', Cannot find or open the PDB file

är det något som måste åtgärdas?

Tack på förhand

Evgenia

kommenterade 15 april 2011

Hej,

nej det är inget som måste åtgärdas. Det är bara Visual Studio som listar system dll filer som det inte finns någon debug information för.

kommenterade 26 april 2011

Tja,

Finns det någon möjlighet att få hjälp med OpenGL IRL? Kommer det inte finnas några mer labbtillfällen?

kommenterade 26 april 2011

Hej,

Nästa OpenGL labbtillfälle är schemalagt torsdag 28/4, 9.15-11