diff options
Diffstat (limited to 'src/opengl/qopenglwindow.cpp')
-rw-r--r-- | src/opengl/qopenglwindow.cpp | 65 |
1 files changed, 24 insertions, 41 deletions
diff --git a/src/opengl/qopenglwindow.cpp b/src/opengl/qopenglwindow.cpp index d000dced94..a3677aa828 100644 --- a/src/opengl/qopenglwindow.cpp +++ b/src/opengl/qopenglwindow.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qopenglwindow.h" #include <QtGui/QOpenGLFunctions> @@ -80,7 +44,7 @@ QT_BEGIN_NAMESPACE immediately result in a call to paintGL(). Calling update() multiple times in a row will not change the behavior in any way. - This is a slot so it can be connected to a \l QTimer::timeout() signal to + This is a slot so it can be connected to a \l QChronoTimer::timeout() signal to perform animation. Note however that in the modern OpenGL world it is a much better choice to rely on synchronization to the vertical refresh rate of the display. See \l{QSurfaceFormat::setSwapInterval()}{setSwapInterval()} on a @@ -96,6 +60,23 @@ QT_BEGIN_NAMESPACE given OpenGL version and profile, or enabling depth and stencil buffers. + \note It is up to the application to ensure depth and stencil buffers are + requested from the underlying windowing system interface. Without requesting + a non-zero depth buffer size there is no guarantee that a depth buffer will + be available, and as a result depth testing related OpenGL operations may fail + to function as expected. + + Commonly used depth and stencil buffer size requests are 24 and 8, + respectively. For example, a QOpenGLWindow subclass could do this in its + constructor: + + \code + QSurfaceFormat format; + format.setDepthBufferSize(24); + format.setStencilBufferSize(8); + setFormat(format); + \endcode + Unlike QWindow, QOpenGLWindow allows opening a painter on itself and perform QPainter-based drawing. @@ -412,7 +393,7 @@ bool QOpenGLWindow::isValid() const /*! Prepares for rendering OpenGL content for this window by making the corresponding context current and binding the framebuffer object, if there is - one, in that context context. + one, in that context. It is not necessary to call this function in most cases, because it is called automatically before invoking paintGL(). It is provided nonetheless to support @@ -590,7 +571,7 @@ void QOpenGLWindow::resizeGL(int w, int h) \note When using a partial update behavior, like \c PartialUpdateBlend, the output of the previous paintGL() call is preserved and, after the additional - drawing perfomed in the current invocation of the function, the content is + drawing performed in the current invocation of the function, the content is blitted or blended over the content drawn directly to the window in paintUnderGL(). @@ -696,3 +677,5 @@ QPaintDevice *QOpenGLWindow::redirected(QPoint *) const } QT_END_NAMESPACE + +#include "moc_qopenglwindow.cpp" |