Skip to content

FreeGLUT

FreeGLUT is a completely OpenSourced alternative to the OpenGL Utility Toolkit (GLUT) library. GLUT was originally written by Mark Kilgard to support the sample programs in the second edition OpenGL 'RedBook'. Since then, GLUT has been used in a wide variety of practical applications because it is simple, widely available and highly portable.

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, keyboard and joystick functions.

FreeGLUT is released under the X-Consortium license.

GLUT vs FreeGLUT

As far as I know, nothing much has been done with GLUT per se since about 1999 (anyone else know differently?) But I've been happily using freeGlut for many years now, and I like it. It seems to faithfully implement the GLUT 3.7 features, plus add a few extensions of its own.

OpenGL Simple init

간단한 GLUT 초기화 방법은 아래와 같다.

#include <stdio.h>
#include <stdlib.h>

#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>

void SimpleDisplay()
{
    glClear(GL_COLOR_BUFFER_BIT);
    glBegin(GL_POLYGON);
        glVertex3f(-0.5f, -0.5f, 0.0f);
        glVertex3f( 0.5f, -0.5f, 0.0f);
        glVertex3f( 0.5f,  0.5f, 0.0f);
        glVertex3f(-0.5f,  0.5f, 0.0f);
    glEnd();
    glFlush();
}

int main(int argc, char ** argv)
{
    glutInit(&argc, argv);
    glutCreateWindow("opengl beginning.");

    glutDisplayFunc(SimpleDisplay);
    glutMainLoop();

    return EXIT_SUCCESS;
}

See also

Favorite site