Introduction
OpenGL is a standard application programming interface for 3D plotting.
OpenGL only deals with 3D plotting, but seldom or never provides graphical user interface programming support. OpenGL * the user interface of an application must be created by other toolkit, such as motif on the X platform and Microsoft basic class library (MFC) on the Windows platform) -- or QT that can be used on both platforms.
Qt OpenGL makes it easier to use OpenGL in QT applications. It provides an OpenGL component class. In addition to opening an OpenGL display buffer, this class uses the OpenGL Application Programming Interface to provide content, can be used like other QT components ,.
The operation of the QT OpenGL module is a platform-independent QT/C ++ package, which is the application programming interface of Glx, WGL, or agl c related to the platform. Its functions are very similar to mark kilgard's glut library, but qt's OpenGL module also has more non-OpenGL-specific GUI functions, that is, they are QT's application programming interfaces.
Install
When you install Qt in X11, the configuration script will automatically check whether the OpenGL header file and Library have been installed on your system. If it is correctly installed, the QT OpenGL module is included in the QT library. (If your OpenGL header file or library is placed in a non-standard directory, You need to modify sysconf_cxxflags_opengl and/or sysconf_lflags_opengl In the config file according to your system ). Some OpenGL configurations require the thread to take effect. If OpenGL is not detected, try it.Configure-Thread.
When you install Qt in windows, the QT OpenGL module is always included.
Qt's OpenGL module is not authorized to use QT Professional Edition. If OpenGL support is required, you can consider upgrading to QT Enterprise Edition.
When using MESA on X11, note that versions earlier than Mesa 3.1 use the names "mesagl" and "mesaglu" in the library, instead of "Gl" and "Glu ". If you want to use versions earlier than Mesa 3.1, you must change the makefile to use the names of these libraries. The simplest way is to edit the sysconf_libs_opengl line in the config file, change "-lgl-lglu" to "-lmesagl-lmesaglu", and then run "Configure" again ".
Qgl class
In QT, OpenGL supports the following classes:
- Qglwidget: An easy-to-use QT component that provides OpenGL scenarios.
- Qglcontext: encapsulates the context provided by OpenGL.
- Qglformat: Specifies a specific display mode for a given context.
- Qglcolormap: Process indexed colormaps In Gl-index.
Many applications only need high-level qglwidget classes. Other qgl classes provide advanced features. Users of X11 may want to read the comments in overlays.
Refer to the OpenGL instance.
Qgl documentation assumes that you are familiar with OpenGL programming. If you are a newbie, a good start is http://www.opengl.org /.
* OpenGL is a registered trademark of Silicon Graphics in the United States and other countries.
Qt OpenGL 3D drawing