|  | Home · All Classes · Main Classes · Annotated · Grouped Classes · Functions |

# OpenGL Module

OpenGL is a standard API for rendering 3D graphics.

OpenGL only deals with 3D rendering and provides little or no support for GUI programming issues. The user interface for an OpenGL application must be created with another toolkit, such as Motif on the X platform, Microsoft Foundation Classes (MFC) under Windows, or Qt on both platforms.

Note: OpenGL is a trademark of Silicon Graphics, Inc. in the United States and other countries.

The Qt OpenGL module makes it easy to use OpenGL in Qt applications. It provides an OpenGL widget class that can be used just like any other Qt widget, except that it opens an OpenGL display buffer where you can use the OpenGL API to render the contents.

The Qt OpenGL module is implemented as a platform-independent Qt/C++ wrapper around the platform-dependent GLX, WGL, or AGL C APIs. The functionality provided is very similar to Mark Kilgard's GLUT library, but with much more non-OpenGL-specific GUI functionality, i.e. the whole Qt API.

## Installation

When you install Qt for X11, the configure script will autodetect if OpenGL headers and libraries are installed on your system, and if so, it will include the Qt OpenGL module in the Qt library. (If your OpenGL headers or libraries are placed in a non-standard directory, you may need to change the QMAKE_INCDIR_OPENGL and/or QMAKE_LIBDIR_OPENGL in the config file for your system).

When you install Qt for Windows, the Qt OpenGL module is always included.

## The QGL Classes

The OpenGL support classes in Qt are:

- QGLWidget: An easy-to-use Qt widget for rendering OpenGL scenes.
- QGLContext: Encapsulates an OpenGL rendering context.
- QGLFormat: Specifies the display format of a rendering context.
- QGLColormap: Handles indexed colormaps in GL-index mode.

Many applications only need the high-level QGLWidget class. The other QGL classes provide advanced features. X11 users might like to read the notes on overlays.

The QGL documentation assumes that you are familiar with OpenGL programming. If you're new to the subject a good starting point is http://www.opengl.org/.