This tutorial is part of a Collection: OpenGL Tutorials
1345
views
02. Setting up in Visual studio 2015
This is just a quick lesson on how to set up your environment in MS Visual Studio 2015.
####Setting up Visual studio environment#### ##GLFW## The first thing we will need a library to create a window and then draw to this window. Because of that you will need to download .[http://www.glfw.org/download.html][GLFW library]. +[https://www.braynzarsoft.net/image/100300][GLFW library] GLFW is a library, written in C, specifically targeted at OpenGL providing the bare necessities required for rendering to the screen. It allows us to create an OpenGL context, define window parameters and handle user input which is all that we need. **1.** On your desktop create a new folder and name it Graphics. In this folder create another three folders, include, lib and dlls. **2.**Unzip you glfw zip to the desktop and search for a folder called include. In this folder you will find another folder called GLFW. Copy it into Graphics -> include. **3.** Next search for a lib-vc2015 (If you have ahy other version of visual studio you can choose other lib folders) and in there you will find a dll file and two lib files. Copy the dll file into Graphics -> dlls, and copy the two libs into the lib folder in the Graphics folder. ##GLEW## Now we will need a library for creating openGL code like creating object buffers, defineing window color and many other things. You can download the GLEW library .[https://sourceforge.net/projects/glew/files/glew/2.0.0/glew-2.0.0-win32.zip/download][here]. **1.** Unzip the glew zip file to the desktop and search for the include folder and in this folder you will find another folder called GL. Copy it into the include folder in the Graphics folder. **2.** In the glew folder go into lib -> release -> win32, and copy the two libs into Graphics -> lib. **3.** In the glew folder go into -> bin -> release -> win32, and copy the dll file into Graphics -> dlls. ##Creating Visual studio project## Create a new project by clicking File -> New -> Project +[https://www.braynzarsoft.net/image/100302][Visual Studio] Select Visual C++, the select Console application and give your project a name and click ok. +[https://www.braynzarsoft.net/image/100301][Visual Studio] ##Linking GLEW and GLFW## In your Solution Explorer right click on your project and then select Properties. +[https://www.braynzarsoft.net/image/100303][Visual Studio] Now a new window should appear. Now go to VC++ Directories -> Include Directories and select Edit. +[https://www.braynzarsoft.net/image/100304][Visual Studio] A new window Will open and now click on the New icon and find the path to Graphics -> include, don't forget to click OK. +[https://www.braynzarsoft.net/image/100305][Visual Studio] Now we have to link the libraries to VS. Go to VC++ Directories -> Library Directories. Do the same as before only now you have to find the path to Graphics -> lib. We are almost done, we just have to do two more things. Go to Linker -> Input -> Additional Dependencies. +[https://www.braynzarsoft.net/image/100306][Visual Studio] Now we have to write in the lib files we want to link. You can copy them here: opengl32.lib glew32.lib glew32s.lib glfw3.lib Everyone of these libs has to be written in a new line. Press OK and then click Apply on the main window. That is it we just have to do one more thing. We need to copy the dlls from Graphics -> dlls to our project folder. If you left the default path setting for saving when creating your project, you should have your project here: C:Users<Your Name>DocumentsVisual Studio 2015ProjectsOpenGL_Tutorial1OpenGL_Tutorial1
Sign in to comment