diff options
Diffstat (limited to 'doc/src/examples/overpainting.qdoc')
-rw-r--r-- | doc/src/examples/overpainting.qdoc | 54 |
1 files changed, 31 insertions, 23 deletions
diff --git a/doc/src/examples/overpainting.qdoc b/doc/src/examples/overpainting.qdoc index 91100c0..e00ec91 100644 --- a/doc/src/examples/overpainting.qdoc +++ b/doc/src/examples/overpainting.qdoc @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the documentation of the Qt Toolkit. @@ -9,8 +10,8 @@ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -20,21 +21,20 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -53,7 +53,7 @@ yet also behaves like any other standard Qt widget with support for signals and slots, properties, and Qt's action system. - Usually, QGLWidget is subclassed to display a pure 3D scene; the + Usually, QGLWidget is subclassed to display a pure 3D scene. The developer reimplements \l{QGLWidget::initializeGL()}{initializeGL()} to initialize any required resources, \l{QGLWidget::resizeGL()}{resizeGL()} to set up the projection and viewport, and @@ -83,7 +83,7 @@ \snippet examples/opengl/overpainting/glwidget.h 4 As usual, the widget uses \l{QGLWidget::initializeGL()}{initializeGL()} - to set up objects for our scene and perform other OpenGL initialization tasks. + to set up geometry for our scene and perform OpenGL initialization tasks. The \l{QGLWidget::resizeGL()}{resizeGL()} function is used to ensure that the 3D graphics in the scene are transformed correctly to the 2D viewport displayed in the widget. @@ -100,7 +100,7 @@ \c animationTimer to update the widget; the \c createBubbles() function initializes the \c bubbles list with instances of a helper class used to draw the animation; the \c drawInstructions() function is responsible for - a semi-transparent messages that is also overpainted onto the OpenGL scene. + a semi-transparent message that is also overpainted onto the OpenGL scene. \section1 GLWidget Class Implementation @@ -119,8 +119,9 @@ \snippet examples/opengl/overpainting/glwidget.cpp 1 - The \c initializeGL() function is fairly minimal, only setting up the display - list used in the scene. + The \c initializeGL() function is fairly minimal, only setting up the QtLogo + object used in the scene. See the \l{Hello GL Example}{Hello GL} example + for details of the QtLogo class. \snippet examples/opengl/overpainting/glwidget.cpp 2 @@ -159,9 +160,10 @@ \snippet examples/opengl/overpainting/glwidget.cpp 7 - Once the list containing the object has been executed, the matrix stack - needs to be restored to its original state at the start of this function - before we can begin overpainting: + Once the QtLogo object's draw method has been executed, the GL + states we changed and the matrix stack needs to be restored to its + original state at the start of this function before we can begin + overpainting: \snippet examples/opengl/overpainting/glwidget.cpp 8 @@ -175,6 +177,12 @@ When QPainter::end() is called, suitable OpenGL-specific calls are made to write the scene, and its additional contents, onto the widget. + With \l{QGLWidget::paintGL()}{paintGL()} the + \l{QGLWidget::swapBuffers()}{swapBuffers()} call is done for us. But an explicit + call to swapBuffers() is still not required because in the + \l{QWidget::paintEvent()}{paintEvent()} method the QPainter on the OpenGL + widget takes care of this for us. + The implementation of the \l{QGLWidget::resizeGL()}{resizeGL()} function sets up the dimensions of the viewport and defines a projection transformation: |