Table of Contents
The SGL library is relatively simple to install on all the major platforms: Microsoft Windows, Apple macOS, and Linux.
C++ development under
Visual Studio 2017 includes the OpenGL library, but it lacks
GLUT.
The GLUT library is available from
http://www.xmission.com/~nate/glut.html.
The zip file downloadable from this site contains the Windows
binaries. The SGL library is available from
https://github.com/halterman/SGL.
After downloading and unpacking the GLUT files and downloading the
SGL headers, you must place them in a location accessible to your C++
projects. One place to put them is in C:\SGL
.
The following procedure creates one possible organization for the
SGL files:
Create C:\SGL\include\GL
Copy glut.h
,
sgl.h
, and
sgl.hpp
into
C:\SGL\include\GL
.
Create C:\SGL\include\lib
Copy glut32.lib
into
C:\SGL\include\lib
.
Copy glut32.dll
into
C:\Windows
(you need administrator
privileges for this step).
Rather then adding glut32.dll
to the C:\Windows
directory, you also may copy the glut32.dll
file to the same location as
your .cpp
source code in each and every
Visual Studio project in which you use the SGL.
When executing the program under Visual Studio,
the environment automatically will load the DLL. If you instead place the DLL
in the C:\Windows
folder, this copying is unnecessary.
When creating a new project in Visual Studio 2017, adjust the project properties as follows:
In the VC++ Directories section:
Add
c:\SGL\include
to the
Include Directories section, and
Add
c:\SGL\lib
to the
Library Directories section, and
In the Linker section, under Input add
glut32.lib
.
It is possible to compile SGL applications from the command line
using Visual C++. To do so, use the Developer Command
Prompt for Visual Studio (open the
Start
menu and type dev
to
find it). To simplify the build process, create the following batch
file named sglcc.bat
:
cl /W4 /EHsc /nologo /std:c++17 %* /IC:\SGL\include \ /link /LIBPATH:c:\SGL\lib glut32.lib copy c:\SGL\bin\glut32.dll .
To build an SGL application named
myapp.cpp
, type
sglcc myapp.cpp
Copyright ©2019 Richard L. Halterman | Version 0.9.5 | February 17, 2019 |