We’ve decided to do a bit of a ‘spring clean’ in the OpenGL tutorials department. We swapped from Visual Studio 2013 to Visual Studio 2015, updated to the newest versions of FreeGLUT, GLEW, and SOIL2, and we’ll be giving you a swift walkthrough to get the old code up and running in OpenGL 4.5 core. Alternatively, grab our up-to-date version from GitHub.
Installing Visual Studio 2015 Community
Microsoft’s Visual Studio 2015 comes in a variety of flavours. If you want to get the free version then community is probably what you’re looking for. If you’re a student at university you might be able to grab the enterprise edition for free using your academic portal. Either of these versions will be compatible with the tutorials.
Proceed with the installation suitable for your machine, I went for the 32 Enterprise version.
Getting latest version of FreeGLUT
FreeGLUT is now at version 3.0.0 so this is what we’ll be relying on. Download it from here. Once downloaded, build it using CMake (with appropriate settings for the latest Visual Studio compiler and architecture).
The newly built folder should contain a lib >> Debug folder which holds freeglut.lib or freeglutd.lib (depending on what settings you ticked in CMake). In addition to this folder, it should also contain a bin>>Debug where freeglut.dll resides.
These files should be added to their corresponding locations in the current project:
Getting latest version of GLEW
The latest version of GLEW is 1.13.0. Download the one appropriate for your machine, I’ve went for the 32 bit Windows binary. Once you unzip the archive, you should locate glew32.lib, glew32.dll, and the glew headers. These will be copied over to the corresponding tutorial folders, as seen below:
Getting latest version of SOIL2
The previous version of the tutorials was relying on SOIL for loading textures. Unfortunately, SOIL still makes use of currently deprecated OpenGL functionality, and therefore we’ve decided that it’s better to replace the original SOIL with SOIL2.
The new version, SOIL2, is based on Sean Barrett’s stb_image. And you’ll require premake4 in order to build the Visual Studio project for SOIL2. Once you’ve downloaded both SOIL2 and premake4, make sure to run premake4 where the premake4.lua script resides using a terminal:
Load SOIL2.sln in Visual Studio 2015, and build the solution files. After everything has built, put soil2-debug.lib, and the soil headers inside the project Dependencies, as seen before with GLEW and FreeGLUT.
Putting everything together
For a last step, open the in2GPU_tutorials_chapter_2.sln inside Visual Studio 2015, and add the .lib for SOIL2, GLEW, and FreeGLUT in the BasicEngine project. Once that is done, every project we will use to test the newly added engine functionality will link against BasicEngine.lib, as shown below:
In addition to upgrading to the newest versions of the libraries described above, we’ve also changed a few things in order to make sure everything is compatible with OpenGL 4.5 core. These changes include the following:
- C++ Chrono now relies only on steady_clock, not on system_clock;
- GL_QUADS has been replaced with GL_TRIANGLES, and the code has been modified accordingly;
- Deprecated calls to mip map generation have been removed;
- Calls for enabling/disabling culling have been added in each test.
You can grab the code containing all of these changes from our GitHub repository. I would like to thank our users for all the suggestions and fixes made throughout the past months. Hopefully, we’ve managed to address all the issues you’ve encountered.