OpenGL Utility Toolkit
   HOME

TheInfoList



OR:

The OpenGL Utility Toolkit (GLUT) is a
library A library is a collection of Book, books, and possibly other Document, materials and Media (communication), media, that is accessible for use by its members and members of allied institutions. Libraries provide physical (hard copies) or electron ...
of utilities for
OpenGL OpenGL (Open Graphics Library) is a Language-independent specification, cross-language, cross-platform application programming interface (API) for rendering 2D computer graphics, 2D and 3D computer graphics, 3D vector graphics. The API is typic ...
programs, which primarily perform system-level I/O with the host
operating system An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ...
. Functions performed include window definition, window control, and monitoring of
keyboard Keyboard may refer to: Text input * Keyboard, part of a typewriter * Computer keyboard ** Keyboard layout, the software control of computer keyboards and their mapping ** Keyboard technology, computer keyboard hardware and firmware Music * Mus ...
and
mouse A mouse (: mice) is a small rodent. Characteristically, mice are known to have a pointed snout, small rounded ears, a body-length scaly tail, and a high breeding rate. The best known mouse species is the common house mouse (''Mus musculus'' ...
input. Routines for drawing a number of geometric primitives (both in solid and wireframe mode) are also provided, including
cubes A cube or regular hexahedron is a three-dimensional space, three-dimensional solid object in geometry, which is bounded by six congruent square (geometry), square faces, a type of polyhedron. It has twelve congruent edges and eight vertices. It i ...
,
sphere A sphere (from Ancient Greek, Greek , ) is a surface (mathematics), surface analogous to the circle, a curve. In solid geometry, a sphere is the Locus (mathematics), set of points that are all at the same distance from a given point in three ...
s and the Utah teapot. GLUT also has some limited support for creating pop-up menus. GLUT was written by Mark J. Kilgard, author of ''OpenGL Programming for the X Window System'' and ''The Cg Tutorial: The Definitive Guide to Programmable Real-Time Graphics'', while he was working for
Silicon Graphics Silicon Graphics, Inc. (stylized as SiliconGraphics before 1999, later rebranded SGI, historically known as Silicon Graphics Computer Systems or SGCS) was an American high-performance computing manufacturer, producing computer hardware and soft ...
Inc. The two aims of GLUT are to allow the creation of rather portable code between operating systems (GLUT is
cross-platform Within computing, cross-platform software (also called multi-platform software, platform-agnostic software, or platform-independent software) is computer software that is designed to work in several Computing platform, computing platforms. Some ...
) and to make learning OpenGL easier. Getting started with OpenGL programming while using GLUT often takes only a few lines of code and does not require knowledge of operating system–specific windowing APIs. All GLUT functions start with the glut prefix (for example, glutPostRedisplay marks the current window as needing to be redrawn).


Implementations

The original GLUT library by Mark Kilgard supports the
X Window System The X Window System (X11, or simply X) is a windowing system for bitmap displays, common on Unix-like operating systems. X originated as part of Project Athena at Massachusetts Institute of Technology (MIT) in 1984. The X protocol has been at ...
(
GLX GLX (initialism for "OpenGL Extension to the X Window System") is an extension to the X Window System core protocol providing an interface between OpenGL and the X Window System as well as extensions to OpenGL itself. It enables programs wishin ...
) and was ported to
Microsoft Windows Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
( WGL) by
Nate Robins Nate or NATE may refer to: People and fictional characters *Nate (given name) *A nickname for Nathanael *A nickname for Nathaniel Organizations *National Association for the Teaching of English, the UK subject teacher association for all aspects ...
. Additionally,
macOS macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
ships with a GLUT framework that supports its own NSGL/ CGL. Kilgard's GLUT library is no longer maintained, and its license did not permit the redistribution of modified versions of the library. This spurred the need for
free software Free software, libre software, libreware sometimes known as freedom-respecting software is computer software distributed open-source license, under terms that allow users to run the software for any purpose as well as to study, change, distribut ...
or
open source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use and view the source code, design documents, or content of the product. The open source model is a decentrali ...
reimplementations of the API from scratch. The first such library was
FreeGLUT freeglut is an open-source alternative to the OpenGL Utility Toolkit (GLUT) library. GLUT (and hence freeglut) allows the user to create and manage windows containing OpenGL contexts on a wide range of platforms and also read the mouse, keyboar ...
, which aims to be a reasonably close reproduction, though introducing a small number of new functions to deal with GLUT's limitations. OpenGLUT, a
fork In cutlery or kitchenware, a fork (from 'pitchfork') is a utensil, now usually made of metal, whose long handle terminates in a head that branches into several narrow and often slightly curved tines with which one can spear foods either to h ...
of FreeGLUT, adds a number of new features to the original API, but work on it ceased in May 2005. Mark Kilgard has a GitHub repository for GLUT. The glut.h header file contains the following license: /* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1998, 2000, 2006, 2010. */ /* This program is freely distributable without licensing fees and is provided without guarantee or warrantee expressed or implied. This program is -not- in the public domain. */


Limitations

Some of GLUT's original design decisions made it hard for programmers to perform desired tasks. This led many to create non-canon patches and extensions to GLU

Some
free software Free software, libre software, libreware sometimes known as freedom-respecting software is computer software distributed open-source license, under terms that allow users to run the software for any purpose as well as to study, change, distribut ...
or
open source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use and view the source code, design documents, or content of the product. The open source model is a decentrali ...
reimplementations also include fixes. Some of the more notable limitations of the original GLUT library include: * The library requires programmers to call glutMainLoop(), a function which never returns. This makes it hard for programmers to integrate GLUT into a program or library which wishes to have control of its own event loop. A common patch to fix this is to introduce a new function, called glutCheckLoop() (macOS) or glutMainLoopEvent() (FreeGLUT/OpenGLUT), which runs only a single iteration of the GLUT event loop. Another common workaround is to run GLUT's event loop in a separate thread (computing), thread, although this may vary by operating system, and also may introduce
synchronization Synchronization is the coordination of events to operate a system in unison. For example, the Conductor (music), conductor of an orchestra keeps the orchestra synchronized or ''in time''. Systems that operate with all parts in synchrony are sa ...
issues or other problems: for example, the macOS GLUT implementation requires that glutMainLoop() be run in the main thread. * The fact that glutMainLoop() never returns also means that a GLUT program cannot exit the event loop.
FreeGLUT freeglut is an open-source alternative to the OpenGL Utility Toolkit (GLUT) library. GLUT (and hence freeglut) allows the user to create and manage windows containing OpenGL contexts on a wide range of platforms and also read the mouse, keyboar ...
fixes this by introducing a new function, glutLeaveMainLoop(). * The library terminates the process when the window is closed; for some applications this may not be desired. Thus, many implementations include an extra callback, such as glutWMCloseFunc(). Since it is no longer maintained (essentially replaced by the
open source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use and view the source code, design documents, or content of the product. The open source model is a decentrali ...
FreeGLUT freeglut is an open-source alternative to the OpenGL Utility Toolkit (GLUT) library. GLUT (and hence freeglut) allows the user to create and manage windows containing OpenGL contexts on a wide range of platforms and also read the mouse, keyboar ...
) the above design issues are still not resolved in the original GLUT.


See also

* EGL is an interface between
OpenGL ES OpenGL for Embedded Systems (OpenGL ES or GLES) is a subset of the OpenGL computer graphics rendering application programming interface (API) for rendering 2D and 3D computer graphics such as those used by video games, typically hardware-accelerate ...
or
OpenVG OpenVG is an API designed for hardware-accelerated 2D vector graphics. Its primary platforms are mobile phones, gaming & media consoles and consumer electronic devices. It was designed to help manufacturers create more attractive user interfac ...
and a windowing system. *
FreeGLUT freeglut is an open-source alternative to the OpenGL Utility Toolkit (GLUT) library. GLUT (and hence freeglut) allows the user to create and manage windows containing OpenGL contexts on a wide range of platforms and also read the mouse, keyboar ...
is intended to be a full replacement for GLUT, and has only a few differences. *
GLFW GLFW (Graphics Library Framework) is a lightweight utility library for use with OpenGL, OpenGL ES and Vulkan. It provides programmers with the ability to create and manage windows and OpenGL contexts, as well as handle joystick, keyboard and mou ...
* Simple DirectMedia Layer (SDL) * OpenGL User Interface Library (GLUI) * OpenGL Utility Library (GLU)


References


External links


GLUT - The OpenGL Utility Toolkit
{{Webarchive, url=https://web.archive.org/web/20180118221325/https://www.opengl.org/resources/libraries/glut/ , date=2018-01-18

(official documentation)
The OpenGL Utility Toolkit (GLUT) downloads
(source and pre-compiled libraries) OpenGL