How to set up FreeGLUT and GLEW in Microsoft Visual Studio

Spread the love

OpenGL (Open Graphic Library) is an API (Application Programming Interface) to render 2D and 3D graphic vectors. The library used for OpenGL program, OpenGL Utility Toolkit (GLUT) is not open source.

There are several alternative to OpenGL Utility Toolkit (GLUT) exists. One of the famous is, FreeGLUT.

In the below tutorial we will set up FreeGLUT and GLEW in Microsoft Visual Studio.

Setting FreeGLUT
  1. If you have not already installed Microsoft Visual Studio, download it from Visual Studio 2015 Community Edition (Free)
  2. Download FreeGLUT from here.
  3. Setting up FreeGLUT
    • Extract FreeGLUT zip file
    • You will find 3 folders. bin, include, lib
    • Inside bin and lib folder, you will find x64 folder which will contain 64bit version of that file
  4. If you are using 64-bit Windows 7 or Windows 8 or Windows 10 with Visual Studio 2015 do the following
    • Header file: Copy GL folder (inside include folder) to C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include
    • 32bit lib file: Copy freeglut file (inside lib folder) to C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib
    • 64bit lib file: Copy freeglut file (inside lib>x64 folder) to C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\amd64
    • 32bit dll file: Copy freeglut.dll file (inside bin folder) to C:\Windows\syswow64
    • 64bit dll file: Copy freeglut.dll file (inside bin>x64 folder) to C:\Windows\System32
  5. If you are using 32-bit Windows with Visual Studio 2015 do the following
    • Header file: Copy GL folder (inside include folder) to C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include
    • 32bit lib file: Copy freeglut file (inside lib folder) to C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib
    • 32bit dll file: Copy freeglut.dll file (inside bin folder) to C:\Windows\System32
READ  How to connect Boonex Dolphin and Vanilla Forums using jsConnect SSO
Setting GLEW

Some of the program rely on GLEW to get extra OpenGL functionality. The OpenGL Extension Wrangler Library (GLEW) is a cross-platform C/C++ library that helps in querying and loading OpenGL extensions

  1. Download GLEW from here
  2. Extract the file. You will see 4 folders. bin, doc, include, lib
  3. In bin and lib folder you will find x64 folder containing 64bit version of that file
  4. For 64-bit windows
    • Header file: Copy GL folder (inside include folder) to C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include
    • 64bit lib file:
      • Copy glew32 and glew32s files (inside lib>Release>x64) to C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\amd64
      • Copy glew32mx and glew32mxs files (inside lib>Release MX>x64) to C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\amd64
    • 32bit lib file:
      • Copy glew32 and glew32s files (inside lib>Release>Win32) to C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib
      • Copy glew32mx and glew32mxs files (inside lib>Release MX>Win32) to C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib
    • 64bit bin file:
      • Copy glew32.dll file (inside bin>Release>x64) to to C:\Windows\System32
      • Copy glew32mx.dll file (inside bin>Release MX>x64) to to C:\Windows\System32
    • 32bit bin file:
      • Copy glew32.dll file (inside bin>Release>Win32) to to C:\Windows\syswow64
      • Copy glew32mx.dll file (inside bin>Release MX>Win32) to to C:\Windows\syswow64
  5. For 32-bit windows
    • Header file: Copy GL folder (inside include folder) to C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include
    • 32bit lib file:
      • Copy glew32 and glew32s files (inside lib>Release>Win32) to C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib
      • Copy glew32mx and glew32mxs files (inside lib>Release MX>Win32) to C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib
    • 32bit bin file:
      • Copy glew32.dll file (inside bin>Release>Win32) to to C:\Windows\System32
      • Copy glew32mx.dll file (inside bin>Release MX>Win32) to to C:\Windows\System32
READ  How to remotely access other computer from anywhere in the world - Part 2

Creating and Running First OpenGL Project

  1. Open Visual Studio
  2. Click on File Menu> New > Project
  3. Select Win32 Console Application
  4. Enter Project Name > Ok
  5. Click Next > Tick on Empty Project > Finish
  6. From the right-hand side Solution Explorer
  7. Right Click on Source File > Add > New Item
  8. Select C++ File (.cpp) > Enter Name > Add
  9. Type your program
  10. Click on Build Menu > Build Solution
  11. If it’s succeeded the proceed to next step else correct the errors
  12. Click on Debug Menu > Start Debugging

Enjoy your first OpenGL project!

 


Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.