Using Glut and Opengl With Visual Studio
Using Glut and Opengl With Visual Studio
First
go
to
http://www.microsoft.com/express/download/#webInstall
and
download
the
Visual
C++
Express
Edition
using
the
web
downloader
(click
on
the
download
button
in
the
yellow
box).
This
should
take
some
time
to
download
and
install
(approx
90
megs),
so
be
patient.
YOU
SHOULD
BE
USING
VS2008
EXPRESS
EDITION
OR
THE
UNIVERSITY
OF
PITTSBURGH
VS2005
INSTALLATION,
IF
YOU
ARE
USING
AN
EARLIER
VERSION
YOU
WILL
HAVE
TO
DOWNLOAD
AND
INSTALL
THE
WINDOWS
PLATFORM
SDK
(MICROSOFT
WINDOWS
SDK)
TO
OBTAIN
THE
NECESSARY
OPENGL
LIBRARIES
AND
HEADER
FILES
TO
CONTINUE.
VS2008
AND
THE
FULL
INSTALLATION
OF
VS2005
INCLUDES
THESE
FILES
AND
OBTAINING
THEM
IS
NOT
NECESSARY.
Once
visual
studio
has
finished
installing,
you
must
either
obtain
a
copy
the
GLUT
binaries
or
compile
GLUT
for
your
own
machine.
Both
the
binaries
and
the
source
for
GLUT
can
be
found
at
http://www.xmission.com/~nate/glut.html
.
I
recommend
downloading
the
binaries
for
all
32bit
installations
of
windows
2000/XP/Vista.
Anyone
using
a
64
bit
version
of
one
of
these
operating
systems
will
have
to
compile
Glut
for
their
computer
(See
below
for
instructions
on
compiling
Glut
for
your
computer).
Once
you
have
either
downloaded
the
binaries
or
compiled
the
necessary
files
for
your
computer,
place
the
files
as
follows
glut32.dll
to
"Windows\System”
glut32.lib
to
"Program
Files\Microsoft
Visual
Studio
9.0\VC\lib"
glut.h
to
"Program
Files\Microsoft
Visual
Studio
9.0\VC\include\GL"
(note:
you
will
need
to
create
the
GL
directory)
Once
this
is
done,
you
are
ready
to
start
using
VS2008
Express
to
write
and
compile
your
OpenGL
/
Glut
programs.
Begin
by
opening
Visual
C++
2008
from
the
Start
/
Windows
menu.
Once
the
interface
has
opened
choose
file
>
new
>
project
from
the
file
menu.
On
the
new
project
dialog
box,
choose
to
create
a
Win32
Console
Application
under
the
Win32
Selection
of
the
Visual
C++
project
type.
Give
your
project
a
name
by
typing
a
name
in
the
Enter
Name:
box.
Make
sure
that
"Create
new
Solution"
is
Selection
in
the
solution
options
and
hit
OK.
On
the
next
dialog
box,
click
on
the
"Application
Settings"
text
under
the
"Overview"
text
in
the
panel
on
the
left
hand
side
of
the
window.
Under
"Additional
Options"
on
the
right
hand
panel,
uncheck
"Precompiles
Header"
and
check
"Empty
Project".
Now
Hit
finish.
Now
your
project
is
created.
In
order
to
get
the
assignment
code
into
your
new
project
there
are
several
options
you
may
choose
to
use.
First,
you
may
add
a
new
code
file
by
right
clicing
on
"Source
Files"
and
choosing
"Add
New
Item".
In
the
"Add
New
Item"
dialog
box,
choose
the
"Code"
option
under
Visual
C++
on
the
left
and
choose
C++
File
on
the
right.
In
the
name
section
at
the
bottom
of
the
window,
name
your
code
file
and
append
a
".c"
to
the
end
of
your
name.
Now
hit
add.
You
can
now
copy
and
paste
the
assignment
code
into
this
file.
In
order
to
add
the
existing
code
file,
you
should
first
place
the
code
file
into
your
project
directory
(N.b.
this
is
mainly
to
keep
your
files
organized.
You
can
add
a
file
from
any
location
on
your
local
drives
although
it
is
recommended
that
you
place
it
in
your
project
directory
first).
The
default
project
location
is
"My
Documents\Visual
Studio
2008\Project\ProjectName\ProjectName".
Copy
the
assignment
code
file
into
this
directory.
Now,
in
the
Visual
Studio
Environment,
right
click
on
the
source
folder
and
choose
"existing
document"
from
the
"add"
option.
The
default
location
of
this
box
is
the
project
directory,
so
if
you
moved
your
file
into
this
directory,
click
on
it
and
then
click
add.
Otherwise,
locate
your
file
first
using
the
file
browser
and
then
click
on
it
and
choose
to
add
to
your
project.
N.B.
IN
VISUAL
STUDIO,
MAKE
SURE
THAT
YOUR
INCLUDE
STATEMENT
FOR
GLUT.H
IS
AFTER
YOUR
INCLUDE
STATEMENT
FOR
STDLIB.H.
GLUT.H
REDEFINES
ONE
OF
THE
CODE
SEGMENTS
FOUND
IN
STDLIB.H
AND
IF
GLUT.H
IS
PLACED
FIRST
YOU
WILL
GET
AND
LINKING
ERROR
AND
BE
UNABLE
TO
COMPILE
YOUR
PROJECT.