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

# TQt OpenGL 3D Graphics

## Introduction

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 TQt on both platforms.

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

The TQt OpenGL module is implemented as a platform-independent TQt/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 TQt API.

## Installation

When you install TQt for X11, the configure script will autodetect if OpenGL headers and libraries are installed on your system, and if so, it will include the TQt OpenGL module in the TQt 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). Some configurations require threading to be enabled for OpenGL, so if OpenGL is not detected, try `configure -thread`.

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

The TQt OpenGL module is not licensed for use with the TQt Professional Edition. Consider upgrading to the TQt Enterprise Edition if you require OpenGL support.

Note about using Mesa on X11: Mesa versions earlier than 3.1 would use the name "MesaGL" and "MesaGLU" for the libraries, instead of "GL" and "GLU". If you want to use a pre-3.1 version of Mesa, you must change the Makefiles to use these library names instead. The easiest way to do this is to edit the QMAKE_LIBS_OPENGL line in the config file you are using, changing "-lGL -lGLU" to "-lMesaGL -lMesaGLU"; then run "configure" again.

## The TQGL Classes

The OpenGL support classes in TQt are:

- TQGLWidget: An easy-to-use TQt widget for rendering OpenGL scenes.
- TQGLContext: Encapsulates an OpenGL rendering context.
- TQGLFormat: Specifies the display format of a rendering context.
- TQGLColormap: Handles indexed colormaps in GL-index mode.

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

See also the OpenGL examples.

The TQGL 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/.

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