summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@digia.com>2014-08-01 12:49:51 +0200
committerLaszlo Agocs <laszlo.agocs@digia.com>2014-08-01 20:42:26 +0200
commit751a74c339586d86bc5df0586e1cdcb886e381bb (patch)
treed59aff0c13e7e96775c44442842520ab1d673aed /src
parente453484bca5add5973602044ff0fbc224f819a07 (diff)
Update QOpenGLFunctions docs
Mention QOpenGLContext::functions() which is used quite commonly in Qt itself and also some examples. Also, make it clear that new instances do not degrade performance since function resolving is done only once. Change-Id: I74ac194a0b3956a70e5078dd5a1bcdd277b5cc28 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp
index db88fbb68c..f3d3d0b47b 100644
--- a/src/gui/opengl/qopenglfunctions.cpp
+++ b/src/gui/opengl/qopenglfunctions.cpp
@@ -126,6 +126,18 @@ QT_BEGIN_NAMESPACE
glFuncs.glActiveTexture(GL_TEXTURE1);
\endcode
+ An alternative approach is to query the context's associated
+ QOpenGLFunctions instance. This is somewhat faster than the previous
+ approach due to avoiding the creation of a new instance, but the difference
+ is fairly small since the internal data structures are shared, and function
+ resolving happens only once for a given context, regardless of the number of
+ QOpenGLFunctions instances initialized for it.
+
+ \code
+ QOpenGLFunctions *glFuncs = QOpenGLContext::currentContext()->functions();
+ glFuncs->glActiveTexture(GL_TEXTURE1);
+ \endcode
+
QOpenGLFunctions provides wrappers for all OpenGL ES 2.0
functions, including the common subset of OpenGL 1.x and ES
2.0. While such functions, for example glClear() or