Getting Started with OpenGL

Let's see what OpenGL is, what it does and doesn't do,
and how to get started writing code.

Overview

Open GL is a state-based, procedural API for 3-D Graphics. In has hundreds of functions
you call in your 3-D applications. It is a drawing-only library; it does
not deal with windows, menus, input devices, or any kind of interaction.

OpenGL consists of two parts: GL, the core library, and
GLU, which
has a bunch of convenience functions. Here are just some of them:

To deal with windows and interaction, you can either learn about rendering contexts
and pixel formats and other ways that your operating system connects with OpenGL (via
glx, wgl, or cgl). Or, you can use an operating-system independent
layer for this purpose, such as GLUT, GLFW, SDL, CPW, SFML, and
several others.

GLUT is pretty sparse, but it is popular and actually documented on the OpenGL
web site and in the OpenGL books.

Physical Components

In case you have issues configuring your system, or you just
like to know how things work, or you are a power user, it's good to
find out how OpenGL is packaged on your system. Typical configurations are

Download GLUT. Put glut32.dll in a Windows system directory (if you have Windows, you
should know what this is). Put glut32.lib somewhere, anywhere really. You will need this
file when you compile! (See the next section.)

To install on Mac OS/X:

OpenGL and GLUT are already there if you get XCode.

Writing Code

How exactly you write, build, and run OpenGL applications depends on:

The source language (C, JavaScript, C++, Java, Ada, etc.)

The windowing layer (O.S. native, GLUT, SDL, etc.)

The operating system (Ubuntu, OS/X, Windows, etc.)

Assuming C and GLUT, you'll put the following at the beginning of every
program: