While starting to learn about OpenGL, I’ve been wondering what GLUT as a window toolkit abstracts. Does it involve OpenGL functions? Does it use functions from something low-level like Win32 API on Windows and the equivalent on other OS’s? Just wondering, would like to know more about it.
GLUT is primarily a simple, cross-platform GUI toolkit, which includes cross-platform support for OpenGL (i.e. creating and managing contexts). It also includes some utility functions for rendering text and geometric objects.
Most of the code involves using the OS APIs for the window system and managing OpenGL contexts (wgl/glX). GLUT uses OpenGL directly for rendering text and geometric objects, for drawing menus, and for querying state with glutGet().
In a nutshell, GLUT makes it easy to write simple OpenGL test programs where you don’t have to mess with platform-specific windows system APIs. This lets you write GL programs that are trivially portable between Windows, Linux, and MacOSX.
For instance, you tell GLUT to give you a window with specific properties, register mouse, keyboard, and other callbacks with GLUT, and it takes care of the platform-specific details, letting you focus on your OpenGL code. Many other features, but you get the idea.