diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2019-04-16 16:32:08 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2019-04-16 16:32:08 +0200 |
commit | 6630937e63ae5797487b86743a7733c8ae5cc42c (patch) | |
tree | 3d53dacf6430f9099e1fb20835881205de674961 /src/opengl/qglfunctions.cpp | |
parent | 37ed6dae00640f9cc980ffda05347c12a7eb5d7e (diff) | |
parent | c7af193d2e49e9f10b86262e63d8d13abf72b5cf (diff) |
Merge commit 'dev' into 'wip/cmake-merge'
Change-Id: I176c40d031be26a1dd1cf08843e448a660598783
Diffstat (limited to 'src/opengl/qglfunctions.cpp')
-rw-r--r-- | src/opengl/qglfunctions.cpp | 42 |
1 files changed, 7 insertions, 35 deletions
diff --git a/src/opengl/qglfunctions.cpp b/src/opengl/qglfunctions.cpp index aa1854dd3d..f22f9f470b 100644 --- a/src/opengl/qglfunctions.cpp +++ b/src/opengl/qglfunctions.cpp @@ -62,44 +62,18 @@ QT_BEGIN_NAMESPACE that need it. The recommended way to use QGLFunctions is by direct inheritance: - \code - class MyGLWidget : public QGLWidget, protected QGLFunctions - { - \Q_OBJECT - public: - MyGLWidget(QWidget *parent = 0) : QGLWidget(parent) {} - - protected: - void initializeGL(); - void paintGL(); - }; - - void MyGLWidget::initializeGL() - { - initializeGLFunctions(); - } - \endcode + \snippet code/src_opengl_qglfunctions.cpp 0 The \c{paintGL()} function can then use any of the OpenGL ES 2.0 functions without explicit resolution, such as glActiveTexture() in the following example: - \code - void MyGLWidget::paintGL() - { - glActiveTexture(GL_TEXTURE1); - glBindTexture(GL_TEXTURE_2D, textureId); - ... - } - \endcode + \snippet code/src_opengl_qglfunctions.cpp 1 QGLFunctions can also be used directly for ad-hoc invocation of OpenGL ES 2.0 functions on all platforms: - \code - QGLFunctions glFuncs(QGLContext::currentContext()); - glFuncs.glActiveTexture(GL_TEXTURE1); - \endcode + \snippet code/src_opengl_qglfunctions.cpp 2 QGLFunctions provides wrappers for all OpenGL ES 2.0 functions, except those like \c{glDrawArrays()}, \c{glViewport()}, and @@ -114,10 +88,7 @@ QT_BEGIN_NAMESPACE feature. For example, the following checks if non power of two textures are available: - \code - QGLFunctions funcs(QGLContext::currentContext()); - bool npot = funcs.hasOpenGLFeature(QGLFunctions::NPOTTextures); - \endcode + \snippet code/src_opengl_qglfunctions.cpp 3 \note This class has been deprecated in favor of QOpenGLFunctions. */ @@ -199,7 +170,8 @@ QGLFunctions::QGLFunctions() /*! Constructs a function resolver for \a context. If \a context - is null, then the resolver will be created for the current QGLContext. + is \nullptr, then the resolver will be created for the current + QGLContext. An object constructed in this way can only be used with \a context and other contexts that share with it. Use initializeGLFunctions() @@ -334,7 +306,7 @@ bool QGLFunctions::hasOpenGLFeature(QGLFunctions::OpenGLFeature feature) const /*! Initializes GL function resolution for \a context. If \a context - is null, then the current QGLContext will be used. + is \nullptr, then the current QGLContext will be used. After calling this function, the QGLFunctions object can only be used with \a context and other contexts that share with it. |