<s>
The	O
OpenGL	B-Library
Utility	I-Library
Toolkit	I-Library
(	O
GLUT	O
)	O
is	O
a	O
library	B-Library
of	O
utilities	O
for	O
OpenGL	B-Application
programs	O
,	O
which	O
primarily	O
perform	O
system-level	O
I/O	B-General_Concept
with	O
the	O
host	O
operating	B-General_Concept
system	I-General_Concept
.	O
</s>
<s>
Functions	O
performed	O
include	O
window	O
definition	O
,	O
window	O
control	O
,	O
and	O
monitoring	O
of	O
keyboard	B-Device
and	O
mouse	B-Device
input	I-Device
.	O
</s>
<s>
GLUT	O
was	O
written	O
by	O
Mark	O
J	O
.	O
Kilgard	O
,	O
author	O
of	O
OpenGL	B-Application
Programming	O
for	O
the	O
X	B-Operating_System
Window	I-Operating_System
System	I-Operating_System
and	O
The	O
Cg	O
Tutorial	O
:	O
The	O
Definitive	O
Guide	O
to	O
Programmable	O
Real-Time	O
Graphics	O
,	O
while	O
he	O
was	O
working	O
for	O
Silicon	O
Graphics	O
Inc	O
.	O
</s>
<s>
The	O
two	O
aims	O
of	O
GLUT	O
are	O
to	O
allow	O
the	O
creation	O
of	O
rather	O
portable	O
code	O
between	O
operating	B-General_Concept
systems	I-General_Concept
(	O
GLUT	O
is	O
cross-platform	B-Operating_System
)	O
and	O
to	O
make	O
learning	O
OpenGL	B-Application
easier	O
.	O
</s>
<s>
Getting	O
started	O
with	O
OpenGL	B-Application
programming	O
while	O
using	O
GLUT	O
often	O
takes	O
only	O
a	O
few	O
lines	O
of	O
code	O
and	O
does	O
not	O
require	O
knowledge	O
of	O
operating	B-General_Concept
system	I-General_Concept
–	O
specific	O
windowing	O
APIs	B-Application
.	O
</s>
<s>
The	O
original	O
GLUT	O
library	B-Library
by	O
Mark	O
Kilgard	O
supports	O
the	O
X	B-Operating_System
Window	I-Operating_System
System	I-Operating_System
(	O
GLX	B-Device
)	O
and	O
was	O
ported	O
to	O
Microsoft	B-Application
Windows	I-Application
(	O
WGL	B-Library
)	O
by	O
Nate	O
Robins	O
.	O
</s>
<s>
Additionally	O
,	O
macOS	B-Application
ships	O
with	O
a	O
GLUT	O
framework	O
that	O
supports	O
its	O
own	O
NSGL/CGL	O
.	O
</s>
<s>
Kilgard	O
's	O
GLUT	O
library	B-Library
is	O
no	O
longer	O
maintained	O
,	O
and	O
its	O
license	O
did	O
not	O
permit	O
the	O
redistribution	O
of	O
modified	O
versions	O
of	O
the	O
library	B-Library
.	O
</s>
<s>
This	O
spurred	O
the	O
need	O
for	O
free	B-Application
software	I-Application
or	O
open	B-Application
source	I-Application
reimplementations	O
of	O
the	O
API	B-Application
from	O
scratch	O
.	O
</s>
<s>
The	O
first	O
such	O
library	B-Library
was	O
FreeGLUT	B-Application
,	O
which	O
aims	O
to	O
be	O
a	O
reasonably	O
close	O
reproduction	O
,	O
though	O
introducing	O
a	O
small	O
number	O
of	O
new	O
functions	O
to	O
deal	O
with	O
GLUT	O
's	O
limitations	O
.	O
</s>
<s>
OpenGLUT	B-Application
,	O
a	O
fork	B-Application
of	O
FreeGLUT	B-Application
,	O
adds	O
a	O
number	O
of	O
new	O
features	O
to	O
the	O
original	O
API	B-Application
,	O
but	O
work	O
on	O
it	O
ceased	O
in	O
May	O
2005	O
.	O
</s>
<s>
Mark	O
Kilgard	O
has	O
a	O
GitHub	B-Application
repository	O
for	O
GLUT	O
.	O
</s>
<s>
Some	O
free	B-Application
software	I-Application
or	O
open	B-Application
source	I-Application
reimplementations	O
also	O
include	O
fixes	O
.	O
</s>
<s>
Some	O
of	O
the	O
more	O
notable	O
limitations	O
of	O
the	O
original	O
GLUT	O
library	B-Library
include	O
:	O
</s>
<s>
The	O
library	B-Library
requires	O
programmers	O
to	O
call	O
glutMainLoop( )	O
,	O
a	O
function	O
which	O
never	O
returns	O
.	O
</s>
<s>
This	O
makes	O
it	O
hard	O
for	O
programmers	O
to	O
integrate	O
GLUT	O
into	O
a	O
program	O
or	O
library	B-Library
which	O
wishes	O
to	O
have	O
control	O
of	O
its	O
own	O
event	O
loop	O
.	O
</s>
<s>
A	O
common	O
patch	O
to	O
fix	O
this	O
is	O
to	O
introduce	O
a	O
new	O
function	O
,	O
called	O
glutCheckLoop( )	O
(	O
macOS	B-Application
)	O
or	O
glutMainLoopEvent( )	O
(	O
FreeGLUT/OpenGLUT	O
)	O
,	O
which	O
runs	O
only	O
a	O
single	O
iteration	O
of	O
the	O
GLUT	O
event	O
loop	O
.	O
</s>
<s>
Another	O
common	O
workaround	O
is	O
to	O
run	O
GLUT	O
's	O
event	O
loop	O
in	O
a	O
separate	O
thread	B-Operating_System
,	O
although	O
this	O
may	O
vary	O
by	O
operating	B-General_Concept
system	I-General_Concept
,	O
and	O
also	O
may	O
introduce	O
synchronization	O
issues	O
or	O
other	O
problems	O
:	O
for	O
example	O
,	O
the	O
macOS	B-Application
GLUT	O
implementation	O
requires	O
that	O
glutMainLoop( )	O
be	O
run	O
in	O
the	O
main	O
thread	B-Operating_System
.	O
</s>
<s>
FreeGLUT	B-Application
fixes	O
this	O
by	O
introducing	O
a	O
new	O
function	O
,	O
glutLeaveMainLoop( )	O
.	O
</s>
<s>
The	O
library	B-Library
terminates	O
the	O
process	O
when	O
the	O
window	O
is	O
closed	O
;	O
for	O
some	O
applications	O
this	O
may	O
not	O
be	O
desired	O
.	O
</s>
<s>
Since	O
it	O
is	O
no	O
longer	O
maintained	O
(	O
essentially	O
replaced	O
by	O
the	O
open	B-Application
source	I-Application
FreeGLUT	B-Application
)	O
the	O
above	O
design	O
issues	O
are	O
still	O
not	O
resolved	O
in	O
the	O
original	O
GLUT	O
.	O
</s>
