Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
101 lines (68 sloc) 4.09 KB
layout classes author toc toc_sticky title header excerpt sidebar
single
wide
Abhijeet Singh
true
true
Setup OpenGL with Visual Studio 2017 on Windows 10
image teaser
/assets/images/opengl/opengl-header.png
/assets/images/opengl/opengl-teaser.jpg
Open Graphics Library is a cross-language, cross-platform application programming interface for rendering 2D and 3D vector graphics.
title image image_alt text
OpenGL
/assets/images/opengl/opengl-teaser.jpg
image
Open Graphics Library
title text
Installation
Instructions provided for Windows 10

Introduction

Open Graphics Library is a cross-language, cross-platform application programming interface for rendering 2D and 3D vector graphics. The API is typically used to interact with a graphics processing unit, to achieve hardware-accelerated rendering.


Pre-requisites

To execute your graphics applications written using OpenGL libraries, you can use Visual Studio.

Microsoft Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs, as well as websites, web apps, web services and mobile apps.

Install Visual Studio Community 2017 using the official installer with the required components as shown in the image below.

{: .align-center}


Installation

  1. Download GLUT header, lib, and dll files from OpenGL. (Mentioned on this page)

  2. Paste glut.h in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\{14.16.27023}\include\GL.

    Create the GL folder if not present already. The {version} may differ on your system.

  3. Paste glut.lib in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\{14.16.27023}\lib\x64.

    Paste glut32.lib in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\{14.16.27023}\lib\x86. The {version} may differ on your system.

  4. Paste glut.dll and glut32.dll in C:\Windows\SysWOW64.

    Copy glut32.dll to C:\Windows\System32 also.

  5. Open your Windows Console Application project in Visual Studio, or create a new one:

    File > New > Project
    Visual C++ > Windows Desktop > Windows Console Application

    {: .align-center}

  6. Go to Project > Properties.

    Select All Configuration from Configuration dropdown menu on top left corner.

    Select Configuration Properties > C/C++ > Precompiled headers and change Precompiled Header option's value to Not Using Precompiled Headers.

    Select Configuration Properties > Linker > Input. Now right click on Additional Dependencies found on right panel and click Edit.

    Now type:

    opengl32.lib
    glu32.lib
    glut32.lib
    

    (Note: Each .lib in new line)

  7. That's it. You have successfully installed OpenGL. Go on and run your program.

Same installation instructions apply to freeglut files with the header files in the GL folder, lib in the lib folder, and dll in the System32 folder.


Check your installation

You can check your installation by running a simple C++ OpenGL program to draw points on a 2D canvas.

<script src="https://gist.github.com/cseas/2c6ac3e7802ea883cfe9c2b0b294b5d5.js"></script>

You'll get the following output:

{: .align-center}


Contribute

This website is open source. ♥️
Improve this page

You can’t perform that action at this time.