QtOpenGL ModuleThe QtOpenGL module offers classes that make it easy to use OpenGL in Qt applications. More... Namespaces
Classes
Detailed DescriptionOpenGL 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. To include the definitions of the module's classes, use the following directive: #include <QtOpenGL> To link against the module, add this line to your qmake .pro file: QT += opengl 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. Warning: The QtOpenGL module is part of the Qt Desktop Edition and the Qt Open Source Edition. It is available on Windows, X11, and Mac OS X. Qtopia Core supports OpenGL ES (OpenGL for Embedded Systems). To be able to use the OpenGL API in Qtopia Core, it must be integrated with the Q Window System (QWS). See the Qtopia Core and OpenGL documentation for details. InstallationWhen 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 QtOpenGL 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 and Mac OS X, the QtOpenGL module is always included. X11 users might like to read the notes on overlays below. 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/. How to Use X11 Overlays with QtX11 overlays are a powerful mechanism for drawing annotations etc., on top of an image without destroying it, thus saving a great deal of image rendering time. For more information, see the highly recommended book OpenGL Programming for the X Window System (Mark Kilgard, Addison Wesley Developers Press 1996). Warning: The Qt OpenGL Extension includes direct support for the use of OpenGL overlays. For many uses of overlays, this makes the technique described below redundant. The following is a discussion on how to use non-QGL widgets in overlay planes. In the typical case, X11 overlays can easily be used together with the current version of Qt and the Qt OpenGL Extension. The following requirements apply:
Assuming that the requirements mentioned above are met, a QGLWidget will default to using the main plane visual, while all other widgets will use the overlay visual. Thus, we can place a normal widget on top of the QGLWidget, and do drawing on it, without affecting the image in the OpenGL window. In other words, we can use all the drawing capabilities of QPainter to draw annotations, rubberbands, etc. For the typical use of overlays, this is much easier than using OpenGL for rendering annotations. An overlay plane has a specific color called the transparent color. Pixels drawn in this color will not be visible; instead the underlying OpenGL image will show through. To use this technique, you must not use the QApplication::ManyColor or QApplication::TrueColor color specification for QApplication, because this will force the normal Qt widgets to use a TrueColor visual, which will typically be in the main plane, not in the overlay plane as desired. [Previous: QtNetwork Module] [Qt's Modules] [Next: QtSql Module] |
Publicité
Best OfActualités les plus luesSemaine
Mois
Année
Le Qt Labs au hasardVelours et QML Scene GraphLes Qt Labs sont les laboratoires des développeurs de Qt, où ils peuvent partager des impressions sur le framework, son utilisation, ce que pourrait être son futur. Lire l'article.
CommunautéRessources
Liens utilesContact
Qt dans le magazine |
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt 4.3 | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com