summaryrefslogtreecommitdiffstats
path: root/src/opengl/qglfunctions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/opengl/qglfunctions.cpp')
-rw-r--r--src/opengl/qglfunctions.cpp42
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.