From 751a74c339586d86bc5df0586e1cdcb886e381bb Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 1 Aug 2014 12:49:51 +0200 Subject: 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 --- src/gui/opengl/qopenglfunctions.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') 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 -- cgit v1.2.3