summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui.pro6
-rw-r--r--src/gui/kernel/qevent.cpp9
-rw-r--r--src/gui/kernel/qguiapplication.cpp25
-rw-r--r--src/gui/kernel/qopenglcontext.cpp142
-rw-r--r--src/gui/kernel/qopenglcontext.h12
-rw-r--r--src/gui/kernel/qpalette.h3
-rw-r--r--src/gui/kernel/qplatformintegration.cpp34
-rw-r--r--src/gui/kernel/qplatformintegration.h9
-rw-r--r--src/gui/kernel/qplatformtheme.cpp2
-rw-r--r--src/gui/kernel/qplatformtheme.h3
-rw-r--r--src/gui/kernel/qsimpledrag.cpp10
-rw-r--r--src/gui/kernel/qtouchdevice.cpp2
-rw-r--r--src/gui/kernel/qwindow.cpp14
-rw-r--r--src/gui/math3d/qvector2d.h14
-rw-r--r--src/gui/math3d/qvector3d.h14
-rw-r--r--src/gui/math3d/qvector4d.h14
-rw-r--r--src/gui/opengl/opengl.pri4
-rw-r--r--src/gui/opengl/qopengl.cpp9
-rw-r--r--src/gui/opengl/qopengl.h30
-rw-r--r--src/gui/opengl/qopenglbuffer.cpp6
-rw-r--r--src/gui/opengl/qopengldebug.cpp22
-rw-r--r--src/gui/opengl/qopenglengineshadermanager.cpp2
-rw-r--r--src/gui/opengl/qopenglengineshadermanager_p.h2
-rw-r--r--src/gui/opengl/qopenglengineshadersource_p.h35
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp57
-rw-r--r--src/gui/opengl/qopenglframebufferobject_p.h7
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp992
-rw-r--r--src/gui/opengl/qopenglfunctions.h877
-rw-r--r--src/gui/opengl/qopenglgradientcache.cpp15
-rw-r--r--src/gui/opengl/qopenglpaintengine.cpp383
-rw-r--r--src/gui/opengl/qopenglproxy_win.cpp4597
-rw-r--r--src/gui/opengl/qopenglshaderprogram.cpp13
-rw-r--r--src/gui/opengl/qopengltexture.cpp110
-rw-r--r--src/gui/opengl/qopengltextureblitter.cpp9
-rw-r--r--src/gui/opengl/qopengltexturecache.cpp15
-rw-r--r--src/gui/opengl/qopengltextureglyphcache.cpp110
-rw-r--r--src/gui/opengl/qopengltextureglyphcache_p.h4
-rw-r--r--src/gui/opengl/qopengltexturehelper.cpp9
-rw-r--r--src/gui/opengl/qopengltimerquery.cpp12
-rw-r--r--src/gui/opengl/qopenglvertexarrayobject.cpp4
-rw-r--r--src/gui/painting/qdrawhelper.cpp14
-rw-r--r--src/gui/painting/qpaintengine_blitter.cpp2
-rw-r--r--src/gui/painting/qplatformbackingstore.cpp47
-rw-r--r--src/gui/painting/qregion.cpp27
-rw-r--r--src/gui/text/qdistancefield.cpp17
-rw-r--r--src/gui/text/qfont.cpp8
-rw-r--r--src/gui/text/qfont_p.h22
-rw-r--r--src/gui/text/qfontdatabase.cpp424
-rw-r--r--src/gui/text/qfontdatabase_qpa.cpp472
-rw-r--r--src/gui/text/qfontengine.cpp221
-rw-r--r--src/gui/text/qfontengine_ft.cpp87
-rw-r--r--src/gui/text/qfontengine_ft_p.h8
-rw-r--r--src/gui/text/qfontengine_p.h53
-rw-r--r--src/gui/text/qfontengine_qpa.cpp115
-rw-r--r--src/gui/text/qfontengine_qpa_p.h8
-rw-r--r--src/gui/text/qfontmetrics.cpp104
-rw-r--r--src/gui/text/qfontsubset.cpp16
-rw-r--r--src/gui/text/qharfbuzzng.cpp44
-rw-r--r--src/gui/text/qplatformfontdatabase.cpp10
-rw-r--r--src/gui/text/qplatformfontdatabase.h2
-rw-r--r--src/gui/text/qrawfont.cpp2
-rw-r--r--src/gui/text/qtextengine.cpp172
-rw-r--r--src/gui/text/qtextengine_p.h39
63 files changed, 3199 insertions, 6352 deletions
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 9bd33d1f57..f083245809 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -18,8 +18,6 @@ win32:contains(QT_CONFIG, angle)|contains(QT_CONFIG, dynamicgl) {
\$\$QT_MODULE_INCLUDE_BASE/QtANGLE
}
-contains(QT_CONFIG, dynamicgl): DEFINES += QT_OPENGL_DYNAMIC_IN_GUI
-
load(qt_module)
# Code coverage with TestCocoon
@@ -32,7 +30,7 @@ testcocoon {
mac:!ios: LIBS_PRIVATE += -framework Cocoa
-CONFIG += simd
+CONFIG += simd optimize_full
include(accessible/accessible.pri)
include(kernel/kernel.pri)
@@ -86,7 +84,7 @@ contains(QT_CONFIG, angle) {
} else:contains(QT_CONFIG, opengl) {
!isEmpty(QMAKE_INCDIR_OPENGL): CMAKE_GL_INCDIRS = $$cmakeTargetPaths($$QMAKE_INCDIR_OPENGL)
CMAKE_OPENGL_INCDIRS = $$cmakePortablePaths($$QMAKE_INCDIR_OPENGL)
- CMAKE_OPENGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_OPENGL)
+ !contains(QT_CONFIG, dynamicgl): CMAKE_OPENGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_OPENGL)
!isEmpty(QMAKE_LIBDIR_OPENGL): CMAKE_OPENGL_LIBDIR = $$cmakePortablePaths($$QMAKE_LIBDIR_OPENGL)
CMAKE_GL_HEADER_NAME = GL/gl.h
mac: CMAKE_GL_HEADER_NAME = gl.h
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 7759e812cb..295380a93c 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -3295,11 +3295,14 @@ QDebug operator<<(QDebug dbg, const QEvent *e) {
n = "MouseButtonDblClick";
break;
}
- dbg.nospace() << "QMouseEvent(" << n
+ QDebug nsp = dbg.nospace();
+ nsp << "QMouseEvent(" << n
<< ", " << me->button()
<< ", " << hex << (int)me->buttons()
- << ", " << hex << (int)me->modifiers()
- << ')';
+ << ", " << hex << (int)me->modifiers() << dec;
+ if (const Qt::MouseEventSource source = me->source())
+ nsp << ", source = " << source;
+ nsp << ')';
}
return dbg.space();
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index c587e51299..c6376b2647 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -145,7 +145,7 @@ ulong QGuiApplicationPrivate::mousePressTime = 0;
Qt::MouseButton QGuiApplicationPrivate::mousePressButton = Qt::NoButton;
int QGuiApplicationPrivate::mousePressX = 0;
int QGuiApplicationPrivate::mousePressY = 0;
-int QGuiApplicationPrivate::mouse_double_click_distance = 5;
+int QGuiApplicationPrivate::mouse_double_click_distance = -1;
static Qt::LayoutDirection layout_direction = Qt::LeftToRight;
static bool force_reverse = false;
@@ -910,7 +910,7 @@ qreal QGuiApplication::devicePixelRatio() const
}
/*!
- Returns the top level window at the given position, if any.
+ Returns the top level window at the given position \a pos, if any.
*/
QWindow *QGuiApplication::topLevelAt(const QPoint &pos)
{
@@ -1007,16 +1007,17 @@ static void init_platform(const QString &pluginArgument, const QString &platform
if (!platformThemeName.isEmpty())
themeNames.append(platformThemeName);
- // 2) Ask the platform integration for a list of names and try loading them.
+ // 2) Ask the platform integration for a list of theme names
themeNames += QGuiApplicationPrivate::platform_integration->themeNames();
+ // 3) Look for a theme plugin.
foreach (const QString &themeName, themeNames) {
QGuiApplicationPrivate::platform_theme = QPlatformThemeFactory::create(themeName, platformPluginPath);
if (QGuiApplicationPrivate::platform_theme)
break;
}
- // 3) If none found, look for a theme plugin. Theme plugins are located in the
- // same directory as platform plugins.
+ // 4) If no theme plugin was found ask the platform integration to
+ // create a theme
if (!QGuiApplicationPrivate::platform_theme) {
foreach (const QString &themeName, themeNames) {
QGuiApplicationPrivate::platform_theme = QGuiApplicationPrivate::platform_integration->createPlatformTheme(themeName);
@@ -1026,7 +1027,7 @@ static void init_platform(const QString &pluginArgument, const QString &platform
// No error message; not having a theme plugin is allowed.
}
- // 4) Fall back on the built-in "null" platform theme.
+ // 5) Fall back on the built-in "null" platform theme.
if (!QGuiApplicationPrivate::platform_theme)
QGuiApplicationPrivate::platform_theme = new QPlatformTheme;
@@ -1254,6 +1255,8 @@ void QGuiApplicationPrivate::init()
initPalette();
QFont::initialize();
+ mouse_double_click_distance = platformTheme()->themeHint(QPlatformTheme::MouseDoubleClickDistance).toInt();
+
#ifndef QT_NO_CURSOR
QCursorData::initialize();
#endif
@@ -2708,7 +2711,7 @@ void QGuiApplicationPrivate::notifyWindowIconChanged()
\brief whether the application implicitly quits when the last window is
closed.
- The default is true.
+ The default is \c true.
If this property is \c true, the applications quits when the last visible
primary window (i.e. window with no parent) is closed.
@@ -2736,7 +2739,7 @@ bool QGuiApplication::quitOnLastWindowClosed()
primary window (i.e. window with no parent) is closed.
By default, QGuiApplication quits after this signal is emitted. This feature
- can be turned off by setting \l quitOnLastWindowClosed to false.
+ can be turned off by setting \l quitOnLastWindowClosed to \c false.
\sa QWindow::close(), QWindow::isTopLevel()
*/
@@ -2912,7 +2915,7 @@ void QGuiApplicationPrivate::setApplicationState(Qt::ApplicationState state)
Returns \c true if the application is currently saving the
\l{Session Management}{session}; otherwise returns \c false.
- This is true when commitDataRequest() and saveStateRequest() are emitted,
+ This is \c true when commitDataRequest() and saveStateRequest() are emitted,
but also when the windows are closed afterwards by session management.
\sa sessionId(), commitDataRequest(), saveStateRequest()
@@ -3183,7 +3186,7 @@ QStyleHints *QGuiApplication::styleHints()
/*!
Sets whether Qt should use the system's standard colors, fonts, etc., to
- \a on. By default, this is true.
+ \a on. By default, this is \c true.
This function must be called before creating the QGuiApplication object, like
this:
@@ -3199,7 +3202,7 @@ void QGuiApplication::setDesktopSettingsAware(bool on)
/*!
Returns \c true if Qt is set to use the system's standard colors, fonts, etc.;
- otherwise returns \c false. The default is true.
+ otherwise returns \c false. The default is \c true.
\sa setDesktopSettingsAware()
*/
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index 7257663799..fb7d15c160 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -52,6 +52,7 @@
#include <QtGui/private/qopengl_p.h>
#include <QtGui/private/qwindow_p.h>
#include <QtGui/QScreen>
+#include <qpa/qplatformnativeinterface.h>
#include <private/qopenglextensions_p.h>
#include <private/qopenglversionfunctionsfactory_p.h>
@@ -162,7 +163,7 @@ void QOpenGLVersionProfile::setVersion(int majorVersion, int minorVersion)
}
/*!
- Returns the OpenGL profile. Only make sense if profiles are supported by this version.
+ Returns the OpenGL profile. Only makes sense if profiles are supported by this version.
\sa setProfile(), supportsProfiles()
*/
@@ -172,7 +173,8 @@ QSurfaceFormat::OpenGLContextProfile QOpenGLVersionProfile::profile() const
}
/*!
- Sets the profile. Only make sense if profiles are supported by this version.
+ Sets the OpenGL profile \a profile. Only makes sense if profiles are supported by
+ this version.
\sa profile(), supportsProfiles()
*/
@@ -204,7 +206,7 @@ bool QOpenGLVersionProfile::isLegacyVersion() const
/*!
Returns \c true if the version number is valid. Note that for a default constructed
- QOpenGLVersionProfile object this function will return false.
+ QOpenGLVersionProfile object this function will return \c false.
\sa setVersion(), version()
*/
@@ -256,12 +258,10 @@ QMutex QOpenGLContextPrivate::makeCurrentTrackerMutex;
rendering a new frame, after calling swapBuffers().
If the context is temporarily not needed, such as when the application is
- not rendering, it can be useful to call destroy() to free resources.
- However, if you do so you will need to call create() again before the
- context can be used, and you might need to recreate any OpenGL resources
- and reinitialize the OpenGL state. You can connect to the
- aboutToBeDestroyed() signal to clean up any resources that have been
- allocated with different ownership from the QOpenGLContext itself.
+ not rendering, it can be useful to delete it in order to free resources.
+ You can connect to the aboutToBeDestroyed() signal to clean up any
+ resources that have been allocated with different ownership from the
+ QOpenGLContext itself.
Once a QOpenGLContext has been made current, you can render to it in a
platform independent way by using Qt's OpenGL enablers such as
@@ -335,16 +335,18 @@ int QOpenGLContextPrivate::maxTextureSize()
if (max_texture_size != -1)
return max_texture_size;
- glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size);
+ Q_Q(QOpenGLContext);
+ QOpenGLFunctions *funcs = q->functions();
+ funcs->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size);
#ifndef QT_OPENGL_ES
- if (!QOpenGLFunctions::isES()) {
+ if (!q->isES()) {
GLenum proxy = GL_PROXY_TEXTURE_2D;
GLint size;
GLint next = 64;
- glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
- glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &size);
+ funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
+ funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &size);
if (size == 0) {
return max_texture_size;
}
@@ -354,8 +356,8 @@ int QOpenGLContextPrivate::maxTextureSize()
if (next > max_texture_size)
break;
- glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
- glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next);
+ funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
+ funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next);
} while (next > size);
max_texture_size = size;
@@ -633,9 +635,9 @@ QOpenGLFunctions *QOpenGLContext::functions() const
*/
/*!
- Returns a pointer to an object that provides access to all functions for
- the version of the current context. Before using any of the functions
- they must be initialized by calling QAbstractOpenGLFunctions::initializeOpenGLFunctions().
+ Returns a pointer to an object that provides access to all functions for the
+ \a versionProfile of the current context. Before using any of the functions they must
+ be initialized by calling QAbstractOpenGLFunctions::initializeOpenGLFunctions().
Usually one would use the template version of this function to automatically
have the result cast to the correct type.
@@ -643,8 +645,8 @@ QOpenGLFunctions *QOpenGLContext::functions() const
QAbstractOpenGLFunctions *QOpenGLContext::versionFunctions(const QOpenGLVersionProfile &versionProfile) const
{
#ifndef QT_OPENGL_ES_2
- if (QOpenGLFunctions::isES()) {
- qWarning("versionFunctions: Not supported on dynamic GL ES");
+ if (isES()) {
+ qWarning("versionFunctions: Not supported on OpenGL ES");
return 0;
}
#endif // QT_OPENGL_ES_2
@@ -703,7 +705,7 @@ QSet<QByteArray> QOpenGLContext::extensions() const
/*!
Returns \c true if this OpenGL context supports the specified OpenGL
- \a extension, false otherwise.
+ \a extension, \c false otherwise.
The context or a sharing context must be current.
@@ -864,7 +866,7 @@ void QOpenGLContext::swapBuffers(QSurface *surface)
qWarning() << "QOpenGLContext::swapBuffers() called without corresponding makeCurrent()";
#endif
if (surface->format().swapBehavior() == QSurfaceFormat::SingleBuffer)
- glFlush();
+ functions()->glFlush();
d->platformGLContext->swapBuffers(surfaceHandle);
}
@@ -885,6 +887,20 @@ QFunctionPointer QOpenGLContext::getProcAddress(const QByteArray &procName) cons
Returns the format of the underlying platform context, if create() has been called.
Otherwise, returns the requested format.
+
+ The requested and the actual format may differ. Requesting a given OpenGL version does
+ not mean the resulting context will target exactly the requested version. It is only
+ guaranteed that the version/profile/options combination for the created context is
+ compatible with the request, as long as the driver is able to provide such a context.
+
+ For example, requesting an OpenGL version 3.x core profile context may result in an
+ OpenGL 4.x core profile context. Similarly, a request for OpenGL 2.1 may result in an
+ OpenGL 3.0 context with deprecated functions enabled. Finally, depending on the
+ driver, unsupported versions may result in either a context creation failure or in a
+ context for the highest supported version.
+
+ Similar differences are possible in the buffer sizes, for example, the resulting
+ context may have a larger depth buffer than requested. This is perfectly normal.
*/
QSurfaceFormat QOpenGLContext::format() const
{
@@ -960,6 +976,88 @@ void QOpenGLContext::deleteQGLContext()
}
/*!
+ Returns the platform-specific handle for the OpenGL implementation that
+ is currently in use. (for example, a HMODULE on Windows)
+
+ On platforms that do not use dynamic GL switch the return value is null.
+
+ The library might be GL-only, meaning that windowing system interface
+ functions (for example EGL) may live in another, separate library.
+
+ \note This function requires that the QGuiApplication instance is already created.
+
+ \sa openGLModuleType()
+
+ \since 5.3
+ */
+void *QOpenGLContext::openGLModuleHandle()
+{
+#ifdef QT_OPENGL_DYNAMIC
+ QGuiApplication *app = qGuiApp;
+ Q_ASSERT(app);
+ return app->platformNativeInterface()->nativeResourceForIntegration(QByteArrayLiteral("glhandle"));
+#else
+ return 0;
+#endif
+}
+
+/*!
+ \enum QOpenGLContext::OpenGLModuleType
+ This enum defines the type of the underlying OpenGL implementation.
+
+ \value DesktopGL Desktop OpenGL
+ \value GLES2 OpenGL ES 2.0 or higher
+ \value GLES1 OpenGL ES 1.x
+
+ \since 5.3
+*/
+
+/*!
+ Returns the underlying OpenGL implementation type.
+
+ On platforms where the OpenGL implementation is not dynamically
+ loaded, the return value is determined during compile time and never
+ changes.
+
+ \note A desktop OpenGL implementation may be capable of creating
+ ES-compatible contexts too. Therefore in most cases it is more
+ appropriate to check QSurfaceFormat::renderableType() or using the
+ the convenience function isES().
+
+ \note This function requires that the QGuiApplication instance is already created.
+
+ \since 5.3
+ */
+QOpenGLContext::OpenGLModuleType QOpenGLContext::openGLModuleType()
+{
+#if defined(QT_OPENGL_DYNAMIC)
+ Q_ASSERT(qGuiApp);
+ return QGuiApplicationPrivate::instance()->platformIntegration()->openGLModuleType();
+#elif defined(QT_OPENGL_ES_2)
+ return GLES2;
+#elif defined(QT_OPENGL_ES)
+ return GLES1;
+#else
+ return DesktopGL;
+#endif
+}
+
+/*!
+ Returns true if the context is an OpenGL ES context.
+
+ If the context has not yet been created, the result is based on the
+ requested format set via setFormat().
+
+ \sa create(), format(), setFormat()
+
+ \since 5.3
+ */
+bool QOpenGLContext::isES() const
+{
+ return format().renderableType() == QSurfaceFormat::OpenGLES;
+}
+
+/*!
\internal
*/
QOpenGLVersionFunctionsBackend *QOpenGLContext::functionsBackend(const QOpenGLVersionStatus &v) const
diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h
index ce34a2d5a5..06a7b723b4 100644
--- a/src/gui/kernel/qopenglcontext.h
+++ b/src/gui/kernel/qopenglcontext.h
@@ -192,6 +192,18 @@ public:
QSet<QByteArray> extensions() const;
bool hasExtension(const QByteArray &extension) const;
+ static void *openGLModuleHandle();
+
+ enum OpenGLModuleType {
+ DesktopGL,
+ GLES2,
+ GLES1
+ };
+
+ static OpenGLModuleType openGLModuleType();
+
+ bool isES() const;
+
Q_SIGNALS:
void aboutToBeDestroyed();
diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h
index 9abca30f12..8d9754d388 100644
--- a/src/gui/kernel/qpalette.h
+++ b/src/gui/kernel/qpalette.h
@@ -72,8 +72,7 @@ public:
#ifdef Q_COMPILER_RVALUE_REFS
inline QPalette &operator=(QPalette &&other)
{
- data.resolve_mask = other.data.resolve_mask;
- data.current_group = other.data.current_group;
+ for_faster_swapping_dont_use = other.for_faster_swapping_dont_use;
qSwap(d, other.d); return *this;
}
#endif
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
index bec201f3f7..a6e0d4705b 100644
--- a/src/gui/kernel/qplatformintegration.cpp
+++ b/src/gui/kernel/qplatformintegration.cpp
@@ -229,6 +229,16 @@ QPlatformServices *QPlatformIntegration::services() const
management. This includes the typical desktop platforms. Can be set to false on
platforms where no window management is available, meaning for example that windows
are never repositioned by the window manager. The default implementation returns \c true.
+
+ \value AllGLFunctionsQueryable The QOpenGLContext backend provided by the platform is
+ able to return function pointers from getProcAddress() even for standard OpenGL
+ functions, for example OpenGL 1 functions like glClear() or glDrawArrays(). This is
+ important because the OpenGL specifications do not require this ability from the
+ getProcAddress implementations of the windowing system interfaces (EGL, WGL, GLX). The
+ platform plugins may however choose to enhance the behavior in the backend
+ implementation for QOpenGLContext::getProcAddress() and support returning a function
+ pointer also for the standard, non-extension functions. This capability is a
+ prerequisite for dynamic OpenGL loading.
*/
/*!
@@ -465,7 +475,31 @@ QPlatformSessionManager *QPlatformIntegration::createPlatformSessionManager(cons
*/
void QPlatformIntegration::sync()
{
+}
+
+#ifndef QT_NO_OPENGL
+/*!
+ Platform integration function for querying the OpenGL implementation type.
+
+ Used only when dynamic OpenGL implementation loading is enabled.
+ Subclasses should reimplement this function and return a value based on
+ the OpenGL implementation they have chosen to load.
+
+ \note The return value does not indicate or limit the types of
+ contexts that can be created by a given implementation. For example
+ a desktop OpenGL implementation may be capable of creating OpenGL
+ ES-compatible contexts too.
+
+ \sa QOpenGLContext::openGLModuleType(), QOpenGLContext::isES()
+
+ \since 5.3
+ */
+QOpenGLContext::OpenGLModuleType QPlatformIntegration::openGLModuleType()
+{
+ qWarning("This plugin does not support dynamic OpenGL loading!");
+ return QOpenGLContext::DesktopGL;
}
+#endif
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h
index 35ef88949f..4804048fde 100644
--- a/src/gui/kernel/qplatformintegration.h
+++ b/src/gui/kernel/qplatformintegration.h
@@ -54,6 +54,7 @@
#include <QtGui/qwindowdefs.h>
#include <qpa/qplatformscreen.h>
#include <QtGui/qsurfaceformat.h>
+#include <QtGui/qopenglcontext.h>
QT_BEGIN_NAMESPACE
@@ -96,7 +97,8 @@ public:
NativeWidgets,
WindowManagement,
SyncState,
- RasterGLSurface
+ RasterGLSurface,
+ AllGLFunctionsQueryable
};
virtual ~QPlatformIntegration() { }
@@ -169,6 +171,11 @@ public:
#endif
virtual void sync();
+
+#ifndef QT_NO_OPENGL
+ virtual QOpenGLContext::OpenGLModuleType openGLModuleType();
+#endif
+
protected:
void screenAdded(QPlatformScreen *screen);
};
diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp
index e12eb318dc..05ab2f15ba 100644
--- a/src/gui/kernel/qplatformtheme.cpp
+++ b/src/gui/kernel/qplatformtheme.cpp
@@ -499,6 +499,8 @@ QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint)
return QVariant(false);
case MousePressAndHoldInterval:
return QVariant(800);
+ case MouseDoubleClickDistance:
+ return QVariant(5);
}
return QVariant();
}
diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h
index 205a5bab69..073eda8d07 100644
--- a/src/gui/kernel/qplatformtheme.h
+++ b/src/gui/kernel/qplatformtheme.h
@@ -108,7 +108,8 @@ public:
PasswordMaskCharacter,
DialogSnapToDefaultButton,
ContextMenuOnMouseRelease,
- MousePressAndHoldInterval
+ MousePressAndHoldInterval,
+ MouseDoubleClickDistance
};
enum DialogType {
diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp
index f6912a2d57..d53239e74f 100644
--- a/src/gui/kernel/qsimpledrag.cpp
+++ b/src/gui/kernel/qsimpledrag.cpp
@@ -116,6 +116,8 @@ void QBasicDrag::disableEventFilter()
bool QBasicDrag::eventFilter(QObject *o, QEvent *e)
{
+ Q_UNUSED(o);
+
if (!m_drag) {
if (e->type() == QEvent::KeyRelease && static_cast<QKeyEvent*>(e)->key() == Qt::Key_Escape) {
disableEventFilter();
@@ -125,9 +127,6 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e)
return false;
}
- if (!qobject_cast<QWindow *>(o))
- return false;
-
switch (e->type()) {
case QEvent::ShortcutOverride:
// prevent accelerators from firing while dragging
@@ -324,9 +323,10 @@ void QSimpleDrag::startDrag()
void QSimpleDrag::cancel()
{
QBasicDrag::cancel();
- if (drag())
+ if (drag() && m_current_window) {
QWindowSystemInterface::handleDrag(m_current_window, 0, QPoint(), Qt::IgnoreAction);
- m_current_window = 0;
+ m_current_window = 0;
+ }
}
void QSimpleDrag::move(const QMouseEvent *me)
diff --git a/src/gui/kernel/qtouchdevice.cpp b/src/gui/kernel/qtouchdevice.cpp
index 3ad4b4161e..117f2c5e76 100644
--- a/src/gui/kernel/qtouchdevice.cpp
+++ b/src/gui/kernel/qtouchdevice.cpp
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QTouchDevice
- \brief The QTouchDevice class describes the device from with touch events originate.
+ \brief The QTouchDevice class describes the device from which touch events originate.
\since 5.0
\ingroup touch
\inmodule QtGui
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 04a2615c81..fd9e0ad61b 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -642,7 +642,7 @@ void QWindow::setFormat(const QSurfaceFormat &format)
}
/*!
- Returns the requested surfaceformat of this window.
+ Returns the requested surface format of this window.
If the requested format was not supported by the platform implementation,
the requestedFormat will differ from the actual window format.
@@ -662,9 +662,17 @@ QSurfaceFormat QWindow::requestedFormat() const
After the window has been created, this function will return the actual surface format
of the window. It might differ from the requested format if the requested format could
- not be fulfilled by the platform.
+ not be fulfilled by the platform. It might also be a superset, for example certain
+ buffer sizes may be larger than requested.
- \sa create(), requestedFormat()
+ \note Depending on the platform, certain values in this surface format may still
+ contain the requested values, that is, the values that have been passed to
+ setFormat(). Typical examples are the OpenGL version, profile and options. These may
+ not get updated during create() since these are context specific and a single window
+ may be used together with multiple contexts over its lifetime. Use the
+ QOpenGLContext's format() instead to query such values.
+
+ \sa create(), requestedFormat(), QOpenGLContext::format()
*/
QSurfaceFormat QWindow::format() const
{
diff --git a/src/gui/math3d/qvector2d.h b/src/gui/math3d/qvector2d.h
index 649d45d477..bd1d28274c 100644
--- a/src/gui/math3d/qvector2d.h
+++ b/src/gui/math3d/qvector2d.h
@@ -80,12 +80,7 @@ public:
float operator[](int i) const;
float length() const;
-#ifdef QT_BUILD_GUI_LIB
- float lengthSquared() const;
-#else
- Q_DECL_CONSTEXPR inline float lengthSquared() const
- { return xp * xp + yp * yp; }
-#endif
+ float lengthSquared() const; //In Qt 6 convert to inline and constexpr
QVector2D normalized() const;
void normalize();
@@ -99,12 +94,7 @@ public:
QVector2D &operator*=(const QVector2D &vector);
QVector2D &operator/=(float divisor);
-#ifdef QT_BUILD_GUI_LIB
- static float dotProduct(const QVector2D& v1, const QVector2D& v2);
-#else
- Q_DECL_CONSTEXPR inline static float dotProduct(const QVector2D& v1, const QVector2D& v2)
- { return v1.xp * v2.xp + v1.yp * v2.yp; }
-#endif
+ static float dotProduct(const QVector2D& v1, const QVector2D& v2); //In Qt 6 convert to inline and constexpr
Q_DECL_CONSTEXPR friend inline bool operator==(const QVector2D &v1, const QVector2D &v2);
Q_DECL_CONSTEXPR friend inline bool operator!=(const QVector2D &v1, const QVector2D &v2);
diff --git a/src/gui/math3d/qvector3d.h b/src/gui/math3d/qvector3d.h
index c5506bf1ac..51412a940a 100644
--- a/src/gui/math3d/qvector3d.h
+++ b/src/gui/math3d/qvector3d.h
@@ -95,17 +95,9 @@ public:
QVector3D &operator*=(const QVector3D& vector);
QVector3D &operator/=(float divisor);
-#ifdef QT_BUILD_GUI_LIB
- static float dotProduct(const QVector3D& v1, const QVector3D& v2);
- static QVector3D crossProduct(const QVector3D& v1, const QVector3D& v2);
-#else
- Q_DECL_CONSTEXPR inline static float dotProduct(const QVector3D& v1, const QVector3D& v2)
- { return v1.xp * v2.xp + v1.yp * v2.yp + v1.zp * v2.zp; }
- Q_DECL_CONSTEXPR inline static QVector3D crossProduct(const QVector3D& v1, const QVector3D& v2)
- { return QVector3D(v1.yp * v2.zp - v1.zp * v2.yp,
- v1.zp * v2.xp - v1.xp * v2.zp,
- v1.xp * v2.yp - v1.yp * v2.xp); }
-#endif
+ static float dotProduct(const QVector3D& v1, const QVector3D& v2); //In Qt 6 convert to inline and constexpr
+ static QVector3D crossProduct(const QVector3D& v1, const QVector3D& v2); //in Qt 6 convert to inline and constexpr
+
static QVector3D normal(const QVector3D& v1, const QVector3D& v2);
static QVector3D normal
(const QVector3D& v1, const QVector3D& v2, const QVector3D& v3);
diff --git a/src/gui/math3d/qvector4d.h b/src/gui/math3d/qvector4d.h
index 1256f384a0..9ab0eba09f 100644
--- a/src/gui/math3d/qvector4d.h
+++ b/src/gui/math3d/qvector4d.h
@@ -86,12 +86,7 @@ public:
float operator[](int i) const;
float length() const;
-#ifdef QT_BUILD_GUI_LIB
- float lengthSquared() const;
-#else
- Q_DECL_CONSTEXPR inline float lengthSquared() const
- { return xp * xp + yp * yp + zp * zp + wp * wp; }
-#endif
+ float lengthSquared() const; //In Qt 6 convert to inline and constexpr
QVector4D normalized() const;
void normalize();
@@ -102,12 +97,7 @@ public:
QVector4D &operator*=(const QVector4D &vector);
QVector4D &operator/=(float divisor);
-#ifdef QT_BUILD_GUI_LIB
- static float dotProduct(const QVector4D& v1, const QVector4D& v2);
-#else
- static float dotProduct(const QVector4D& v1, const QVector4D& v2)
- { return v1.xp * v2.xp + v1.yp * v2.yp + v1.zp * v2.zp + v1.wp * v2.wp; }
-#endif
+ static float dotProduct(const QVector4D& v1, const QVector4D& v2); //In Qt 6 convert to inline and constexpr
Q_DECL_CONSTEXPR friend inline bool operator==(const QVector4D &v1, const QVector4D &v2);
Q_DECL_CONSTEXPR friend inline bool operator!=(const QVector4D &v1, const QVector4D &v2);
diff --git a/src/gui/opengl/opengl.pri b/src/gui/opengl/opengl.pri
index 56aecd49e2..cadba26797 100644
--- a/src/gui/opengl/opengl.pri
+++ b/src/gui/opengl/opengl.pri
@@ -122,8 +122,4 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
SOURCES += opengl/qopenglfunctions_es2.cpp
}
-
- contains(QT_CONFIG, dynamicgl) {
- win32: SOURCES += opengl/qopenglproxy_win.cpp
- }
}
diff --git a/src/gui/opengl/qopengl.cpp b/src/gui/opengl/qopengl.cpp
index 94270ba0c4..b452c605e3 100644
--- a/src/gui/opengl/qopengl.cpp
+++ b/src/gui/opengl/qopengl.cpp
@@ -53,7 +53,9 @@ typedef const GLubyte * (QOPENGLF_APIENTRYP qt_glGetStringi)(GLenum, GLuint);
QOpenGLExtensionMatcher::QOpenGLExtensionMatcher()
{
- const char *extensionStr = reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS));
+ QOpenGLContext *ctx = QOpenGLContext::currentContext();
+ QOpenGLFunctions *funcs = ctx->functions();
+ const char *extensionStr = reinterpret_cast<const char *>(funcs->glGetString(GL_EXTENSIONS));
if (extensionStr) {
QByteArray ba(extensionStr);
@@ -64,9 +66,8 @@ QOpenGLExtensionMatcher::QOpenGLExtensionMatcher()
#else
} else {
// clear error state
- while (glGetError()) {}
+ while (funcs->glGetError()) {}
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
if (ctx) {
qt_glGetStringi glGetStringi = (qt_glGetStringi)ctx->getProcAddress("glGetStringi");
@@ -74,7 +75,7 @@ QOpenGLExtensionMatcher::QOpenGLExtensionMatcher()
return;
GLint numExtensions;
- glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
+ funcs->glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
for (int i = 0; i < numExtensions; ++i) {
const char *str = reinterpret_cast<const char *>(glGetStringi(GL_EXTENSIONS, i));
diff --git a/src/gui/opengl/qopengl.h b/src/gui/opengl/qopengl.h
index 025f8b823c..190c05ba26 100644
--- a/src/gui/opengl/qopengl.h
+++ b/src/gui/opengl/qopengl.h
@@ -66,7 +66,7 @@
// which the system headers do not.
#if defined(QT_OPENGL_ES_2)
-# if defined(Q_OS_MAC)
+# if defined(Q_OS_MAC) // iOS
# include <OpenGLES/ES2/gl.h>
# include <OpenGLES/ES2/glext.h>
@@ -78,7 +78,7 @@
*/
typedef void* GLeglImageOES;
-# else // "uncontrolled" platforms
+# else // "uncontrolled" ES2 platforms
# include <GLES2/gl2.h>
/*
@@ -90,14 +90,14 @@ typedef void* GLeglImageOES;
typedef char GLchar;
# include <QtGui/qopengles2ext.h>
-# ifndef GL_DOUBLE
-# define GL_DOUBLE GL_FLOAT
-# endif
-# ifndef GLdouble
-typedef GLfloat GLdouble;
-# endif
# endif // Q_OS_MAC
-#else
+# ifndef GL_DOUBLE
+# define GL_DOUBLE GL_FLOAT
+# endif
+# ifndef GLdouble
+typedef GLfloat GLdouble;
+# endif
+#else // non-ES2 platforms
# if defined(Q_OS_MAC)
# include <OpenGL/gl.h>
# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
@@ -107,20 +107,10 @@ typedef GLfloat GLdouble;
# include <OpenGL/glext.h>
# else
# define GL_GLEXT_LEGACY // Prevents GL/gl.h from #including system glext.h
- // In dynamic GL builds qopenglproxy will export the GL functions that are
- // called also in QtGui itself. To prevent linker warnings (msvc) or errors (mingw)
- // we need to make sure the prototypes do not have dllimport.
-# ifdef QT_OPENGL_DYNAMIC_IN_GUI
-# undef WINGDIAPI
-# define WINGDIAPI
-# endif // QT_OPENGL_DYNAMIC_IN_GUI
# include <GL/gl.h>
-# ifdef QT_OPENGL_DYNAMIC_IN_GUI
-# undef WINGDIAPI
-# endif // QT_OPENGL_DYNAMIC_IN_GUI
# include <QtGui/qopenglext.h>
# endif // Q_OS_MAC
-#endif
+#endif // QT_OPENGL_ES_2
// Desktops, apart from Mac OS X prior to 10.7 can support OpenGL 3
// and desktops apart from Mac can support OpenGL 4
diff --git a/src/gui/opengl/qopenglbuffer.cpp b/src/gui/opengl/qopenglbuffer.cpp
index a4c1e538ee..2e1a4577f6 100644
--- a/src/gui/opengl/qopenglbuffer.cpp
+++ b/src/gui/opengl/qopenglbuffer.cpp
@@ -333,13 +333,13 @@ void QOpenGLBuffer::destroy()
bool QOpenGLBuffer::read(int offset, void *data, int count)
{
#if !defined(QT_OPENGL_ES)
- if (QOpenGLFunctions::platformGLType() != QOpenGLFunctions::GLES1) {
+ if (QOpenGLContext::openGLModuleType() != QOpenGLContext::GLES1) {
Q_D(QOpenGLBuffer);
if (!d->funcs->hasOpenGLFeature(QOpenGLFunctions::Buffers) || !d->guard->id())
return false;
- while (glGetError() != GL_NO_ERROR) ; // Clear error state.
+ while (d->funcs->glGetError() != GL_NO_ERROR) ; // Clear error state.
d->funcs->glGetBufferSubData(d->type, offset, count, data);
- return glGetError() == GL_NO_ERROR;
+ return d->funcs->glGetError() == GL_NO_ERROR;
}
#else
Q_UNUSED(offset);
diff --git a/src/gui/opengl/qopengldebug.cpp b/src/gui/opengl/qopengldebug.cpp
index 2355d0a8a7..79b59a8e98 100644
--- a/src/gui/opengl/qopengldebug.cpp
+++ b/src/gui/opengl/qopengldebug.cpp
@@ -1370,7 +1370,7 @@ bool QOpenGLDebugLogger::initialize()
// through wglGetProcAddress
#if defined(Q_OS_WIN) && !defined(QT_OPENGL_ES_2)
{
- HMODULE handle = static_cast<HMODULE>(QOpenGLFunctions::platformGLHandle());
+ HMODULE handle = static_cast<HMODULE>(QOpenGLContext::openGLModuleHandle());
if (!handle)
handle = GetModuleHandleA("opengl32.dll");
d->glGetPointerv = reinterpret_cast<qt_glGetPointerv_t>(GetProcAddress(handle, QByteArrayLiteral("glGetPointerv")));
@@ -1381,7 +1381,7 @@ bool QOpenGLDebugLogger::initialize()
#undef GET_DEBUG_PROC_ADDRESS
- glGetIntegerv(GL_MAX_DEBUG_MESSAGE_LENGTH, &d->maxMessageLength);
+ QOpenGLContext::currentContext()->functions()->glGetIntegerv(GL_MAX_DEBUG_MESSAGE_LENGTH, &d->maxMessageLength);
#ifndef QT_NO_DEBUG
if (!d->context->format().testOption(QSurfaceFormat::DebugContext)) {
@@ -1449,15 +1449,16 @@ void QOpenGLDebugLogger::startLogging(QOpenGLDebugLogger::LoggingMode loggingMod
d->glDebugMessageCallback(&qt_opengl_debug_callback, d);
- d->debugWasEnabled = glIsEnabled(GL_DEBUG_OUTPUT);
- d->syncDebugWasEnabled = glIsEnabled(GL_DEBUG_OUTPUT_SYNCHRONOUS);
+ QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
+ d->debugWasEnabled = funcs->glIsEnabled(GL_DEBUG_OUTPUT);
+ d->syncDebugWasEnabled = funcs->glIsEnabled(GL_DEBUG_OUTPUT_SYNCHRONOUS);
if (d->loggingMode == SynchronousLogging)
- glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
+ funcs->glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
else
- glDisable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
+ funcs->glDisable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
- glEnable(GL_DEBUG_OUTPUT);
+ funcs->glEnable(GL_DEBUG_OUTPUT);
}
/*!
@@ -1486,13 +1487,14 @@ void QOpenGLDebugLogger::stopLogging()
d->glDebugMessageCallback(d->oldDebugCallbackFunction, d->oldDebugCallbackParameter);
+ QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
if (!d->debugWasEnabled)
- glDisable(GL_DEBUG_OUTPUT);
+ funcs->glDisable(GL_DEBUG_OUTPUT);
if (d->syncDebugWasEnabled)
- glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
+ funcs->glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
else
- glDisable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
+ funcs->glDisable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
}
/*!
diff --git a/src/gui/opengl/qopenglengineshadermanager.cpp b/src/gui/opengl/qopenglengineshadermanager.cpp
index 95bafb07d9..a1215acb7e 100644
--- a/src/gui/opengl/qopenglengineshadermanager.cpp
+++ b/src/gui/opengl/qopenglengineshadermanager.cpp
@@ -164,7 +164,7 @@ QOpenGLEngineSharedShaders::QOpenGLEngineSharedShaders(QOpenGLContext* context)
code[NonPremultipliedImageSrcFragmentShader] = qopenglslNonPremultipliedImageSrcFragmentShader;
code[CustomImageSrcFragmentShader] = qopenglslCustomSrcFragmentShader; // Calls "customShader", which must be appended
code[SolidBrushSrcFragmentShader] = qopenglslSolidBrushSrcFragmentShader;
- if (QOpenGLFunctions::isES())
+ if (context->isES())
code[TextureBrushSrcFragmentShader] = qopenglslTextureBrushSrcFragmentShader_ES;
else
code[TextureBrushSrcFragmentShader] = qopenglslTextureBrushSrcFragmentShader_desktop;
diff --git a/src/gui/opengl/qopenglengineshadermanager_p.h b/src/gui/opengl/qopenglengineshadermanager_p.h
index 49c03a7fee..893574a6e5 100644
--- a/src/gui/opengl/qopenglengineshadermanager_p.h
+++ b/src/gui/opengl/qopenglengineshadermanager_p.h
@@ -90,7 +90,7 @@
qopenglslMainVertexShader
qopenglslMainWithTexCoordsVertexShader
- And the the following position vertex shaders:
+ And the following position vertex shaders:
qopenglslPositionOnlyVertexShader
qopenglslPositionWithTextureBrushVertexShader
qopenglslPositionWithPatternBrushVertexShader
diff --git a/src/gui/opengl/qopenglengineshadersource_p.h b/src/gui/opengl/qopenglengineshadersource_p.h
index 5bb0bc4704..02a23193a8 100644
--- a/src/gui/opengl/qopenglengineshadersource_p.h
+++ b/src/gui/opengl/qopenglengineshadersource_p.h
@@ -517,6 +517,41 @@ static const char* const qopenglslRgbMaskFragmentShaderPass2 = "\n\
ExclusionCompositionModeFragmentShader,
*/
+// OpenGL 3.2 core profile versions of shaders that are used by QOpenGLTextureGlyphCache
+
+static const char* const qopenglslMainWithTexCoordsVertexShader_core = "#version 150 core \n\
+ in vec2 textureCoordArray; \n\
+ out vec2 textureCoords; \n\
+ void setPosition(); \n\
+ void main(void) \n\
+ { \n\
+ setPosition(); \n\
+ textureCoords = textureCoordArray; \n\
+ }\n";
+
+static const char* const qopenglslUntransformedPositionVertexShader_core = "\n\
+ in vec4 vertexCoordsArray; \n\
+ void setPosition(void) \n\
+ { \n\
+ gl_Position = vertexCoordsArray; \n\
+ }\n";
+
+static const char* const qopenglslMainFragmentShader_core = "#version 150 core \n\
+ vec4 srcPixel(); \n\
+ out vec4 fragColor; \n\
+ void main() \n\
+ { \n\
+ fragColor = srcPixel(); \n\
+ }\n";
+
+static const char* const qopenglslImageSrcFragmentShader_core = "\n\
+ in vec2 textureCoords; \n\
+ uniform sampler2D imageTexture; \n\
+ vec4 srcPixel() \n\
+ { \n"
+ "return texture(imageTexture, textureCoords); \n"
+ "}\n";
+
QT_END_NAMESPACE
#endif // GLGC_SHADER_SOURCE_H
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
index 9953b4e889..55edaf7baf 100644
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ b/src/gui/opengl/qopenglframebufferobject.cpp
@@ -57,11 +57,11 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_DEBUG
#define QT_RESET_GLERROR() \
{ \
- while (glGetError() != GL_NO_ERROR) {} \
+ while (QOpenGLContext::currentContext()->functions()->glGetError() != GL_NO_ERROR) {} \
}
#define QT_CHECK_GLERROR() \
{ \
- GLenum err = glGetError(); \
+ GLenum err = QOpenGLContext::currentContext()->functions()->glGetError(); \
if (err != GL_NO_ERROR) { \
qDebug("[%s line %d] OpenGL Error: %d", \
__FILE__, __LINE__, (int)err); \
@@ -405,9 +405,9 @@ namespace
funcs->glDeleteRenderbuffers(1, &id);
}
- void freeTextureFunc(QOpenGLFunctions *, GLuint id)
+ void freeTextureFunc(QOpenGLFunctions *funcs, GLuint id)
{
- glDeleteTextures(1, &id);
+ funcs->glDeleteTextures(1, &id);
}
}
@@ -432,7 +432,7 @@ void QOpenGLFramebufferObjectPrivate::init(QOpenGLFramebufferObject *, const QSi
#ifndef QT_OPENGL_ES_2
GLint maxSamples;
- glGetIntegerv(GL_MAX_SAMPLES, &maxSamples);
+ funcs.glGetIntegerv(GL_MAX_SAMPLES, &maxSamples);
samples = qBound(0, int(samples), int(maxSamples));
#endif
@@ -497,16 +497,16 @@ void QOpenGLFramebufferObjectPrivate::initTexture(GLenum target, GLenum internal
QOpenGLContext *ctx = QOpenGLContext::currentContext();
GLuint texture = 0;
- glGenTextures(1, &texture);
- glBindTexture(target, texture);
+ funcs.glGenTextures(1, &texture);
+ funcs.glBindTexture(target, texture);
- glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ funcs.glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ funcs.glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ funcs.glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ funcs.glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexImage2D(target, 0, internal_format, size.width(), size.height(), 0,
- GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ funcs.glTexImage2D(target, 0, internal_format, size.width(), size.height(), 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, NULL);
if (mipmap) {
int width = size.width();
int height = size.height();
@@ -515,20 +515,20 @@ void QOpenGLFramebufferObjectPrivate::initTexture(GLenum target, GLenum internal
width = qMax(1, width >> 1);
height = qMax(1, height >> 1);
++level;
- glTexImage2D(target, level, internal_format, width, height, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ funcs.glTexImage2D(target, level, internal_format, width, height, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, NULL);
}
}
funcs.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
target, texture, 0);
QT_CHECK_GLERROR();
- glBindTexture(target, 0);
+ funcs.glBindTexture(target, 0);
valid = checkFramebufferStatus(ctx);
if (valid)
texture_guard = new QOpenGLSharedResourceGuard(ctx, texture, freeTextureFunc);
else
- glDeleteTextures(1, &texture);
+ funcs.glDeleteTextures(1, &texture);
}
void QOpenGLFramebufferObjectPrivate::initAttachments(QOpenGLContext *ctx, QOpenGLFramebufferObject::Attachment attachment)
@@ -590,7 +590,7 @@ void QOpenGLFramebufferObjectPrivate::initAttachments(QOpenGLContext *ctx, QOpen
funcs.glBindRenderbuffer(GL_RENDERBUFFER, depth_buffer);
Q_ASSERT(funcs.glIsRenderbuffer(depth_buffer));
if (samples != 0 && funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)) {
- if (QOpenGLFunctions::isES()) {
+ if (ctx->isES()) {
if (funcs.hasOpenGLExtension(QOpenGLExtensions::Depth24))
funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples,
GL_DEPTH_COMPONENT24, size.width(), size.height());
@@ -602,7 +602,7 @@ void QOpenGLFramebufferObjectPrivate::initAttachments(QOpenGLContext *ctx, QOpen
GL_DEPTH_COMPONENT, size.width(), size.height());
}
} else {
- if (QOpenGLFunctions::isES()) {
+ if (ctx->isES()) {
if (funcs.hasOpenGLExtension(QOpenGLExtensions::Depth24)) {
funcs.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24,
size.width(), size.height());
@@ -631,7 +631,7 @@ void QOpenGLFramebufferObjectPrivate::initAttachments(QOpenGLContext *ctx, QOpen
#ifdef QT_OPENGL_ES
GLenum storage = GL_STENCIL_INDEX8;
#else
- GLenum storage = QOpenGLFunctions::isES() ? GL_STENCIL_INDEX8 : GL_STENCIL_INDEX;
+ GLenum storage = ctx->isES() ? GL_STENCIL_INDEX8 : GL_STENCIL_INDEX;
#endif
if (samples != 0 && funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample))
@@ -773,7 +773,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, GLenum tar
Q_D(QOpenGLFramebufferObject);
d->init(this, size, NoAttachment, target,
#ifndef QT_OPENGL_ES_2
- QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8
+ QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8
#else
GL_RGBA
#endif
@@ -793,7 +793,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, GLenum
Q_D(QOpenGLFramebufferObject);
d->init(this, QSize(width, height), NoAttachment, target,
#ifndef QT_OPENGL_ES_2
- QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8
+ QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8
#else
GL_RGBA
#endif
@@ -850,7 +850,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, Attach
#ifdef QT_OPENGL_ES_2
internal_format = GL_RGBA;
#else
- internal_format = QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8;
+ internal_format = QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8;
#endif
d->init(this, QSize(width, height), attachment, target, internal_format);
}
@@ -877,7 +877,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, Attachment
#ifdef QT_OPENGL_ES_2
internal_format = GL_RGBA;
#else
- internal_format = QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8;
+ internal_format = QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8;
#endif
d->init(this, size, attachment, target, internal_format);
}
@@ -1084,7 +1084,8 @@ Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format,
int w = size.width();
int h = size.height();
- while (glGetError());
+ QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
+ while (funcs->glGetError());
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
QImage img(size, (alpha_format && include_alpha) ? QImage::Format_ARGB32_Premultiplied
@@ -1094,14 +1095,14 @@ Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format,
#else
GLint fmt = GL_BGRA;
#endif
- glReadPixels(0, 0, w, h, fmt, GL_UNSIGNED_BYTE, img.bits());
- if (!glGetError())
+ funcs->glReadPixels(0, 0, w, h, fmt, GL_UNSIGNED_BYTE, img.bits());
+ if (!funcs->glGetError())
return img.mirrored();
#endif
QImage rgbaImage(size, (alpha_format && include_alpha) ? QImage::Format_RGBA8888_Premultiplied
: QImage::Format_RGBX8888);
- glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, rgbaImage.bits());
+ funcs->glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, rgbaImage.bits());
return rgbaImage.mirrored();
}
diff --git a/src/gui/opengl/qopenglframebufferobject_p.h b/src/gui/opengl/qopenglframebufferobject_p.h
index f0e07f2119..bd830b38e9 100644
--- a/src/gui/opengl/qopenglframebufferobject_p.h
+++ b/src/gui/opengl/qopenglframebufferobject_p.h
@@ -70,7 +70,12 @@ public:
mipmap(false)
{
#ifndef QT_OPENGL_ES_2
- internal_format = QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8;
+ // There is nothing that says QOpenGLFramebufferObjectFormat needs a current
+ // context, so we need a fallback just to be safe, even though in pratice there
+ // will usually be a context current.
+ QOpenGLContext *ctx = QOpenGLContext::currentContext();
+ const bool isES = ctx ? ctx->isES() : QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL;
+ internal_format = isES ? GL_RGBA : GL_RGBA8;
#else
internal_format = GL_RGBA;
#endif
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp
index 60743b3a27..84c70606b1 100644
--- a/src/gui/opengl/qopenglfunctions.cpp
+++ b/src/gui/opengl/qopenglfunctions.cpp
@@ -42,8 +42,10 @@
#include "qopenglfunctions.h"
#include "qopenglextensions_p.h"
#include "qdebug.h"
-#include "QtGui/private/qopenglcontext_p.h"
-#include "QtGui/private/qopengl_p.h"
+#include <QtGui/private/qopenglcontext_p.h>
+#include <QtGui/private/qopengl_p.h>
+#include <QtGui/private/qguiapplication_p.h>
+#include <qpa/qplatformintegration.h>
QT_BEGIN_NAMESPACE
@@ -124,9 +126,13 @@ QT_BEGIN_NAMESPACE
glFuncs.glActiveTexture(GL_TEXTURE1);
\endcode
- QOpenGLFunctions provides wrappers for all OpenGL/ES 2.0 functions,
- except those like \c{glDrawArrays()}, \c{glViewport()}, and
- \c{glBindTexture()} that don't have portability issues.
+ 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
+ glDrawArrays(), can be called also directly, as long as the
+ application links to the platform-specific OpenGL library, calling
+ them via QOpenGLFunctions enables the possibility of dynamically
+ loading the OpenGL implementation.
The hasOpenGLFeature() and openGLFeatures() functions can be used
to determine if the OpenGL implementation has a major OpenGL/ES 2.0
@@ -249,7 +255,9 @@ QOpenGLExtensions::QOpenGLExtensions(QOpenGLContext *context)
static int qt_gl_resolve_features()
{
- if (QOpenGLFunctions::platformGLType() == QOpenGLFunctions::GLES2) {
+ QOpenGLContext *ctx = QOpenGLContext::currentContext();
+ if (ctx->isES() && QOpenGLContext::openGLModuleType() != QOpenGLContext::GLES1) {
+ // OpenGL ES 2
int features = QOpenGLFunctions::Multitexture |
QOpenGLFunctions::Shaders |
QOpenGLFunctions::Buffers |
@@ -269,7 +277,8 @@ static int qt_gl_resolve_features()
features |= QOpenGLFunctions::NPOTTextures |
QOpenGLFunctions::NPOTTextureRepeat;
return features;
- } else if (QOpenGLFunctions::platformGLType() == QOpenGLFunctions::GLES1) {
+ } else if (ctx->isES()) {
+ // OpenGL ES 1
int features = QOpenGLFunctions::Multitexture |
QOpenGLFunctions::Buffers |
QOpenGLFunctions::CompressedTextures |
@@ -289,6 +298,7 @@ static int qt_gl_resolve_features()
features |= QOpenGLFunctions::NPOTTextures;
return features;
} else {
+ // OpenGL
int features = 0;
QSurfaceFormat format = QOpenGLContext::currentContext()->format();
QOpenGLExtensionMatcher extensions;
@@ -352,7 +362,7 @@ static int qt_gl_resolve_extensions()
if (extensionMatcher.match("GL_EXT_bgra"))
extensions |= QOpenGLExtensions::BGRATextureFormat;
- if (QOpenGLFunctions::isES()) {
+ if (QOpenGLContext::currentContext()->isES()) {
if (extensionMatcher.match("GL_OES_mapbuffer"))
extensions |= QOpenGLExtensions::MapBuffer;
if (extensionMatcher.match("GL_OES_packed_depth_stencil"))
@@ -484,6 +494,501 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
}
/*!
+ \fn void QOpenGLFunctions::glBindTexture(GLenum target, GLuint texture)
+
+ Convenience function that calls glBindTexture(\a target, \a texture).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glBindTexture.xml}{glBindTexture()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glBlendFunc(GLenum sfactor, GLenum dfactor)
+
+ Convenience function that calls glBlendFunc(\a sfactor, \a dfactor).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glBlendFunc.xml}{glBlendFunc()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glClear(GLbitfield mask)
+
+ Convenience function that calls glClear(\a mask).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glClear.xml}{glClear()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+
+ Convenience function that calls glClearColor(\a red, \a green, \a blue, \a alpha).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glClearColor.xml}{glClearColor()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glClearStencil(GLint s)
+
+ Convenience function that calls glClearStencil(\a s).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glClearStencil.xml}{glClearStencil()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
+
+ Convenience function that calls glColorMask(\a red, \a green, \a blue, \a alpha).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glColorMask.xml}{glColorMask()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
+
+ Convenience function that calls glCopyTexImage2D(\a target, \a level, \a internalformat, \a x, \a y, \a width, \a height, \a border).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glCopyTexImage2D.xml}{glCopyTexImage2D()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+
+ Convenience function that calls glCopyTexSubImage2D(\a target, \a level, \a xoffset, \a yoffset, \a x, \a y, \a width, \a height).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glCopyTexSubImage2D.xml}{glCopyTexSubImage2D()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glCullFace(GLenum mode)
+
+ Convenience function that calls glCullFace(\a mode).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glCullFace.xml}{glCullFace()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glDeleteTextures(GLsizei n, const GLuint* textures)
+
+ Convenience function that calls glDeleteTextures(\a n, \a textures).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteTextures.xml}{glDeleteTextures()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glDepthFunc(GLenum func)
+
+ Convenience function that calls glDepthFunc(\a func).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glDepthFunc.xml}{glDepthFunc()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glDepthMask(GLboolean flag)
+
+ Convenience function that calls glDepthMask(\a flag).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glDepthMask.xml}{glDepthMask()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glDisable(GLenum cap)
+
+ Convenience function that calls glDisable(\a cap).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glDisable.xml}{glDisable()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glDrawArrays(GLenum mode, GLint first, GLsizei count)
+
+ Convenience function that calls glDrawArrays(\a mode, \a first, \a count).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glDrawArrays.xml}{glDrawArrays()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices)
+
+ Convenience function that calls glDrawElements(\a mode, \a count, \a type, \a indices).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glDrawElements.xml}{glDrawElements()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glEnable(GLenum cap)
+
+ Convenience function that calls glEnable(\a cap).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glEnable.xml}{glEnable()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glFinish()
+
+ Convenience function that calls glFinish().
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glFinish.xml}{glFinish()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glFlush()
+
+ Convenience function that calls glFlush().
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glFlush.xml}{glFlush()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glFrontFace(GLenum mode)
+
+ Convenience function that calls glFrontFace(\a mode).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glFrontFace.xml}{glFrontFace()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glGenTextures(GLsizei n, GLuint* textures)
+
+ Convenience function that calls glGenTextures(\a n, \a textures).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glGenTextures.xml}{glGenTextures()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glGetBooleanv(GLenum pname, GLboolean* params)
+
+ Convenience function that calls glGetBooleanv(\a pname, \a params).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glGetBooleanv.xml}{glGetBooleanv()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn GLenum QOpenGLFunctions::glGetError()
+
+ Convenience function that calls glGetError().
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glGetError.xml}{glGetError()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glGetFloatv(GLenum pname, GLfloat* params)
+
+ Convenience function that calls glGetFloatv(\a pname, \a params).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glGetFloatv.xml}{glGetFloatv()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glGetIntegerv(GLenum pname, GLint* params)
+
+ Convenience function that calls glGetIntegerv(\a pname, \a params).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glGetIntegerv.xml}{glGetIntegerv()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn const GLubyte *QOpenGLFunctions::glGetString(GLenum name)
+
+ Convenience function that calls glGetString(\a name).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glGetString.xml}{glGetString()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
+
+ Convenience function that calls glGetTexParameterfv(\a target, \a pname, \a params).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glGetTexParameterfv.xml}{glGetTexParameterfv()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
+
+ Convenience function that calls glGetTexParameteriv(\a target, \a pname, \a params).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glGetTexParameteriv.xml}{glGetTexParameteriv()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glHint(GLenum target, GLenum mode)
+
+ Convenience function that calls glHint(\a target, \a mode).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glHint.xml}{glHint()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn GLboolean QOpenGLFunctions::glIsEnabled(GLenum cap)
+
+ Convenience function that calls glIsEnabled(\a cap).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glIsEnabled.xml}{glIsEnabled()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn GLboolean QOpenGLFunctions::glIsTexture(GLuint texture)
+
+ Convenience function that calls glIsTexture(\a texture).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glIsTexture.xml}{glIsTexture()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glLineWidth(GLfloat width)
+
+ Convenience function that calls glLineWidth(\a width).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glLineWidth.xml}{glLineWidth()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glPixelStorei(GLenum pname, GLint param)
+
+ Convenience function that calls glPixelStorei(\a pname, \a param).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glPixelStorei.xml}{glPixelStorei()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glPolygonOffset(GLfloat factor, GLfloat units)
+
+ Convenience function that calls glPolygonOffset(\a factor, \a units).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glPolygonOffset.xml}{glPolygonOffset()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
+
+ Convenience function that calls glReadPixels(\a x, \a y, \a width, \a height, \a format, \a type, \a pixels).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glReadPixels.xml}{glReadPixels()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
+
+ Convenience function that calls glScissor(\a x, \a y, \a width, \a height).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glScissor.xml}{glScissor()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glStencilFunc(GLenum func, GLint ref, GLuint mask)
+
+ Convenience function that calls glStencilFunc(\a func, \a ref, \a mask).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glStencilFunc.xml}{glStencilFunc()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glStencilMask(GLuint mask)
+
+ Convenience function that calls glStencilMask(\a mask).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glStencilMask.xml}{glStencilMask()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
+
+ Convenience function that calls glStencilOp(\a fail, \a zfail, \a zpass).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glStencilOp.xml}{glStencilOp()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
+
+ Convenience function that calls glTexImage2D(\a target, \a level, \a internalformat, \a width, \a height, \a border, \a format, \a type, \a pixels).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glTexImage2D.xml}{glTexImage2D()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
+
+ Convenience function that calls glTexParameterf(\a target, \a pname, \a param).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glTexParameterf.xml}{glTexParameterf()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
+
+ Convenience function that calls glTexParameterfv(\a target, \a pname, \a params).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glTexParameterfv.xml}{glTexParameterfv()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glTexParameteri(GLenum target, GLenum pname, GLint param)
+
+ Convenience function that calls glTexParameteri(\a target, \a pname, \a param).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glTexParameteri.xml}{glTexParameteri()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glTexParameteriv(GLenum target, GLenum pname, const GLint* params)
+
+ Convenience function that calls glTexParameteriv(\a target, \a pname, \a params).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glTexParameteriv.xml}{glTexParameteriv()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels)
+
+ Convenience function that calls glTexSubImage2D(\a target, \a level, \a xoffset, \a yoffset, \a width, \a height, \a format, \a type, \a pixels).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glTexSubImage2D.xml}{glTexSubImage2D()}.
+
+ \since 5.3
+*/
+
+/*!
+ \fn void QOpenGLFunctions::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
+
+ Convenience function that calls glViewport(\a x, \a y, \a width, \a height).
+
+ For more information, see the OpenGL/ES 2.0 documentation for
+ \l{http://www.khronos.org/opengles/sdk/docs/man/glViewport.xml}{glViewport()}.
+
+ \since 5.3
+*/
+
+/*!
\fn void QOpenGLFunctions::glActiveTexture(GLenum texture)
Convenience function that calls glActiveTexture(\a texture).
@@ -1488,6 +1993,12 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
*/
/*!
+ \fn void QOpenGLFunctions::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
+
+ \internal
+*/
+
+/*!
\fn bool QOpenGLFunctions::isInitialized(const QOpenGLFunctionsPrivate *d)
\internal
*/
@@ -1866,6 +2377,254 @@ Resolver<Base, FuncType, Policy, ReturnType> functionResolver(FuncType Base::*fu
#ifndef QT_OPENGL_ES_2
+// GLES2 + OpenGL1 common subset. These are normally not resolvable,
+// but the underlying platform code may hide this limitation.
+
+static void QOPENGLF_APIENTRY qopenglfResolveBindTexture(GLenum target, GLuint texture)
+{
+ RESOLVE_FUNC_VOID(0, BindTexture)(target, texture);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveBlendFunc(GLenum sfactor, GLenum dfactor)
+{
+ RESOLVE_FUNC_VOID(0, BlendFunc)(sfactor, dfactor);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveClear(GLbitfield mask)
+{
+ RESOLVE_FUNC_VOID(0, Clear)(mask);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+{
+ RESOLVE_FUNC_VOID(0, ClearColor)(red, green, blue, alpha);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveClearDepthf(GLclampf depth)
+{
+ if (QOpenGLContext::currentContext()->isES()) {
+ RESOLVE_FUNC_VOID(0, ClearDepthf)(depth);
+ } else {
+ RESOLVE_FUNC_VOID(0, ClearDepth)((GLdouble) depth);
+ }
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveClearStencil(GLint s)
+{
+ RESOLVE_FUNC_VOID(0, ClearStencil)(s);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
+{
+ RESOLVE_FUNC_VOID(0, ColorMask)(red, green, blue, alpha);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
+{
+ RESOLVE_FUNC_VOID(0, CopyTexImage2D)(target, level, internalformat, x, y, width, height, border);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ RESOLVE_FUNC_VOID(0, CopyTexSubImage2D)(target, level, xoffset, yoffset, x, y, width, height);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveCullFace(GLenum mode)
+{
+ RESOLVE_FUNC_VOID(0, CullFace)(mode);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveDeleteTextures(GLsizei n, const GLuint* textures)
+{
+ RESOLVE_FUNC_VOID(0, DeleteTextures)(n, textures);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveDepthFunc(GLenum func)
+{
+ RESOLVE_FUNC_VOID(0, DepthFunc)(func);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveDepthMask(GLboolean flag)
+{
+ RESOLVE_FUNC_VOID(0, DepthMask)(flag);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveDepthRangef(GLclampf zNear, GLclampf zFar)
+{
+ if (QOpenGLContext::currentContext()->isES()) {
+ RESOLVE_FUNC_VOID(0, DepthRangef)(zNear, zFar);
+ } else {
+ RESOLVE_FUNC_VOID(0, DepthRange)((GLdouble) zNear, (GLdouble) zFar);
+ }
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveDisable(GLenum cap)
+{
+ RESOLVE_FUNC_VOID(0, Disable)(cap);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveDrawArrays(GLenum mode, GLint first, GLsizei count)
+{
+ RESOLVE_FUNC_VOID(0, DrawArrays)(mode, first, count);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices)
+{
+ RESOLVE_FUNC_VOID(0, DrawElements)(mode, count, type, indices);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveEnable(GLenum cap)
+{
+ RESOLVE_FUNC_VOID(0, Enable)(cap);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveFinish()
+{
+ RESOLVE_FUNC_VOID(0, Finish)();
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveFlush()
+{
+ RESOLVE_FUNC_VOID(0, Flush)();
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveFrontFace(GLenum mode)
+{
+ RESOLVE_FUNC_VOID(0, FrontFace)(mode);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveGenTextures(GLsizei n, GLuint* textures)
+{
+ RESOLVE_FUNC_VOID(0, GenTextures)(n, textures);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveGetBooleanv(GLenum pname, GLboolean* params)
+{
+ RESOLVE_FUNC_VOID(0, GetBooleanv)(pname, params);
+}
+
+static GLenum QOPENGLF_APIENTRY qopenglfResolveGetError()
+{
+ RESOLVE_FUNC(GLenum, 0, GetError)();
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveGetFloatv(GLenum pname, GLfloat* params)
+{
+ RESOLVE_FUNC_VOID(0, GetFloatv)(pname, params);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveGetIntegerv(GLenum pname, GLint* params)
+{
+ RESOLVE_FUNC_VOID(0, GetIntegerv)(pname, params);
+}
+
+static const GLubyte * QOPENGLF_APIENTRY qopenglfResolveGetString(GLenum name)
+{
+ RESOLVE_FUNC(const GLubyte *, 0, GetString)(name);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
+{
+ RESOLVE_FUNC_VOID(0, GetTexParameterfv)(target, pname, params);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
+{
+ RESOLVE_FUNC_VOID(0, GetTexParameteriv)(target, pname, params);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveHint(GLenum target, GLenum mode)
+{
+ RESOLVE_FUNC_VOID(0, Hint)(target, mode);
+}
+
+static GLboolean QOPENGLF_APIENTRY qopenglfResolveIsEnabled(GLenum cap)
+{
+ RESOLVE_FUNC(GLboolean, 0, IsEnabled)(cap);
+}
+
+static GLboolean QOPENGLF_APIENTRY qopenglfResolveIsTexture(GLuint texture)
+{
+ RESOLVE_FUNC(GLboolean, 0, IsTexture)(texture);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveLineWidth(GLfloat width)
+{
+ RESOLVE_FUNC_VOID(0, LineWidth)(width);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolvePixelStorei(GLenum pname, GLint param)
+{
+ RESOLVE_FUNC_VOID(0, PixelStorei)(pname, param);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolvePolygonOffset(GLfloat factor, GLfloat units)
+{
+ RESOLVE_FUNC_VOID(0, PolygonOffset)(factor, units);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
+{
+ RESOLVE_FUNC_VOID(0, ReadPixels)(x, y, width, height, format, type, pixels);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveScissor(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ RESOLVE_FUNC_VOID(0, Scissor)(x, y, width, height);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveStencilFunc(GLenum func, GLint ref, GLuint mask)
+{
+ RESOLVE_FUNC_VOID(0, StencilFunc)(func, ref, mask);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveStencilMask(GLuint mask)
+{
+ RESOLVE_FUNC_VOID(0, StencilMask)(mask);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
+{
+ RESOLVE_FUNC_VOID(0, StencilOp)(fail, zfail, zpass);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
+{
+ RESOLVE_FUNC_VOID(0, TexImage2D)(target, level, internalformat, width, height, border, format, type, pixels);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveTexParameterf(GLenum target, GLenum pname, GLfloat param)
+{
+ RESOLVE_FUNC_VOID(0, TexParameterf)(target, pname, param);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveTexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
+{
+ RESOLVE_FUNC_VOID(0, TexParameterfv)(target, pname, params);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveTexParameteri(GLenum target, GLenum pname, GLint param)
+{
+ RESOLVE_FUNC_VOID(0, TexParameteri)(target, pname, param);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveTexParameteriv(GLenum target, GLenum pname, const GLint* params)
+{
+ RESOLVE_FUNC_VOID(0, TexParameteriv)(target, pname, params);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels)
+{
+ RESOLVE_FUNC_VOID(0, TexSubImage2D)(target, level, xoffset, yoffset, width, height, format, type, pixels);
+}
+
+static void QOPENGLF_APIENTRY qopenglfResolveViewport(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ RESOLVE_FUNC_VOID(0, Viewport)(x, y, width, height);
+}
+
+// GL(ES)2
+
static void QOPENGLF_APIENTRY qopenglfResolveActiveTexture(GLenum texture)
{
RESOLVE_FUNC_VOID(0, ActiveTexture)(texture);
@@ -2396,6 +3155,29 @@ static void QOPENGLF_APIENTRY qopenglfResolveGetBufferSubData(GLenum target, qop
(target, offset, size, data);
}
+#if !defined(QT_OPENGL_ES_2) && !defined(QT_OPENGL_DYNAMIC)
+
+// Desktop only
+
+static void QOPENGLF_APIENTRY qopenglfResolveGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
+{
+ RESOLVE_FUNC_VOID(0, GetTexLevelParameteriv)(target, level, pname, params);
+}
+
+// Special translation functions for ES-specific calls on desktop GL
+
+static void QOPENGLF_APIENTRY qopenglfTranslateClearDepthf(GLclampf depth)
+{
+ ::glClearDepth(depth);
+}
+
+static void QOPENGLF_APIENTRY qopenglfTranslateDepthRangef(GLclampf zNear, GLclampf zFar)
+{
+ ::glDepthRange(zNear, zFar);
+}
+
+#endif // !ES2 && !DYNAMIC
+
QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *)
{
/* Assign a pointer to an above defined static function
@@ -2403,6 +3185,116 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *)
* context, assigns it to the member variable and executes it
* (see Resolver template) */
#ifndef QT_OPENGL_ES_2
+ // The GL1 functions may not be queriable via getProcAddress().
+ if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::AllGLFunctionsQueryable)) {
+ // The platform plugin supports resolving these.
+ BindTexture = qopenglfResolveBindTexture;
+ BlendFunc = qopenglfResolveBlendFunc;
+ Clear = qopenglfResolveClear;
+ ClearColor = qopenglfResolveClearColor;
+ ClearDepthf = qopenglfResolveClearDepthf;
+ ClearStencil = qopenglfResolveClearStencil;
+ ColorMask = qopenglfResolveColorMask;
+ CopyTexImage2D = qopenglfResolveCopyTexImage2D;
+ CopyTexSubImage2D = qopenglfResolveCopyTexSubImage2D;
+ CullFace = qopenglfResolveCullFace;
+ DeleteTextures = qopenglfResolveDeleteTextures;
+ DepthFunc = qopenglfResolveDepthFunc;
+ DepthMask = qopenglfResolveDepthMask;
+ DepthRangef = qopenglfResolveDepthRangef;
+ Disable = qopenglfResolveDisable;
+ DrawArrays = qopenglfResolveDrawArrays;
+ DrawElements = qopenglfResolveDrawElements;
+ Enable = qopenglfResolveEnable;
+ Finish = qopenglfResolveFinish;
+ Flush = qopenglfResolveFlush;
+ FrontFace = qopenglfResolveFrontFace;
+ GenTextures = qopenglfResolveGenTextures;
+ GetBooleanv = qopenglfResolveGetBooleanv;
+ GetError = qopenglfResolveGetError;
+ GetFloatv = qopenglfResolveGetFloatv;
+ GetIntegerv = qopenglfResolveGetIntegerv;
+ GetString = qopenglfResolveGetString;
+ GetTexParameterfv = qopenglfResolveGetTexParameterfv;
+ GetTexParameteriv = qopenglfResolveGetTexParameteriv;
+ Hint = qopenglfResolveHint;
+ IsEnabled = qopenglfResolveIsEnabled;
+ IsTexture = qopenglfResolveIsTexture;
+ LineWidth = qopenglfResolveLineWidth;
+ PixelStorei = qopenglfResolvePixelStorei;
+ PolygonOffset = qopenglfResolvePolygonOffset;
+ ReadPixels = qopenglfResolveReadPixels;
+ Scissor = qopenglfResolveScissor;
+ StencilFunc = qopenglfResolveStencilFunc;
+ StencilMask = qopenglfResolveStencilMask;
+ StencilOp = qopenglfResolveStencilOp;
+ TexImage2D = qopenglfResolveTexImage2D;
+ TexParameterf = qopenglfResolveTexParameterf;
+ TexParameterfv = qopenglfResolveTexParameterfv;
+ TexParameteri = qopenglfResolveTexParameteri;
+ TexParameteriv = qopenglfResolveTexParameteriv;
+ TexSubImage2D = qopenglfResolveTexSubImage2D;
+ Viewport = qopenglfResolveViewport;
+
+ GetTexLevelParameteriv = qopenglfResolveGetTexLevelParameteriv;
+ } else {
+#ifndef QT_OPENGL_DYNAMIC
+ // Use the functions directly. This requires linking QtGui to an OpenGL implementation.
+ BindTexture = ::glBindTexture;
+ BlendFunc = ::glBlendFunc;
+ Clear = ::glClear;
+ ClearColor = ::glClearColor;
+ ClearDepthf = qopenglfTranslateClearDepthf;
+ ClearStencil = ::glClearStencil;
+ ColorMask = ::glColorMask;
+ CopyTexImage2D = ::glCopyTexImage2D;
+ CopyTexSubImage2D = ::glCopyTexSubImage2D;
+ CullFace = ::glCullFace;
+ DeleteTextures = ::glDeleteTextures;
+ DepthFunc = ::glDepthFunc;
+ DepthMask = ::glDepthMask;
+ DepthRangef = qopenglfTranslateDepthRangef;
+ Disable = ::glDisable;
+ DrawArrays = ::glDrawArrays;
+ DrawElements = ::glDrawElements;
+ Enable = ::glEnable;
+ Finish = ::glFinish;
+ Flush = ::glFlush;
+ FrontFace = ::glFrontFace;
+ GenTextures = ::glGenTextures;
+ GetBooleanv = ::glGetBooleanv;
+ GetError = ::glGetError;
+ GetFloatv = ::glGetFloatv;
+ GetIntegerv = ::glGetIntegerv;
+ GetString = ::glGetString;
+ GetTexParameterfv = ::glGetTexParameterfv;
+ GetTexParameteriv = ::glGetTexParameteriv;
+ Hint = ::glHint;
+ IsEnabled = ::glIsEnabled;
+ IsTexture = ::glIsTexture;
+ LineWidth = ::glLineWidth;
+ PixelStorei = ::glPixelStorei;
+ PolygonOffset = ::glPolygonOffset;
+ ReadPixels = ::glReadPixels;
+ Scissor = ::glScissor;
+ StencilFunc = ::glStencilFunc;
+ StencilMask = ::glStencilMask;
+ StencilOp = ::glStencilOp;
+ TexImage2D = ::glTexImage2D;
+ TexParameterf = ::glTexParameterf;
+ TexParameterfv = ::glTexParameterfv;
+ TexParameteri = ::glTexParameteri;
+ TexParameteriv = ::glTexParameteriv;
+ TexSubImage2D = ::glTexSubImage2D;
+ Viewport = ::glViewport;
+
+ GetTexLevelParameteriv = ::glGetTexLevelParameteriv;
+#else // QT_OPENGL_DYNAMIC
+ // This should not happen.
+ qFatal("QOpenGLFunctions: Dynamic OpenGL builds do not support platforms with insufficient function resolving capabilities");
+#endif
+ }
+
ActiveTexture = qopenglfResolveActiveTexture;
AttachShader = qopenglfResolveAttachShader;
BindAttribLocation = qopenglfResolveBindAttribLocation;
@@ -2511,88 +3403,4 @@ QOpenGLExtensionsPrivate::QOpenGLExtensionsPrivate(QOpenGLContext *ctx)
GetBufferSubData = qopenglfResolveGetBufferSubData;
}
-#if defined(QT_OPENGL_DYNAMIC)
-extern int qgl_proxyLibraryType(void);
-extern HMODULE qgl_glHandle(void);
-#endif
-
-/*!
- \enum QOpenGLFunctions::PlatformGLType
- This enum defines the type of the underlying GL implementation.
-
- \value DesktopGL Desktop OpenGL
- \value GLES2 OpenGL ES 2.0 or higher
- \value GLES1 OpenGL ES 1.x
-
- \since 5.3
- */
-
-/*!
- \fn QOpenGLFunctions::isES()
-
- On platforms where the OpenGL implementation is dynamically loaded
- this function returns true if the underlying GL implementation is
- Open GL ES.
-
- On platforms that do not use runtime loading of the GL the return
- value is based on Qt's compile-time configuration and will never
- change during runtime.
-
- \sa platformGLType()
-
- \since 5.3
- */
-
-/*!
- Returns the underlying GL implementation type.
-
- On platforms where the OpenGL implementation is not dynamically
- loaded, the return value is determined during compile time and never
- changes.
-
- Platforms that use dynamic GL loading (e.g. Windows) cannot rely on
- compile-time defines for differentiating between desktop and ES
- OpenGL code. Instead, they rely on this function to query, during
- runtime, the type of the loaded graphics library.
-
- \since 5.3
- */
-QOpenGLFunctions::PlatformGLType QOpenGLFunctions::platformGLType()
-{
-#if defined(QT_OPENGL_DYNAMIC)
- return PlatformGLType(qgl_proxyLibraryType());
-#elif defined(QT_OPENGL_ES_2)
- return GLES2;
-#elif defined(QT_OPENGL_ES)
- return GLES1;
-#else
- return DesktopGL;
-#endif
-}
-
-/*!
- Returns the platform-specific handle for the OpenGL implementation that
- is currently in use. (for example, a HMODULE on Windows)
-
- On platforms that do not use dynamic GL switch the return value is null.
-
- The library might be GL-only, meaning that windowing system interface
- functions (for example EGL) may live in another, separate library.
-
- Always use platformGLType() before resolving any functions to check if the
- library implements desktop OpenGL or OpenGL ES.
-
- \sa platformGLType()
-
- \since 5.3
- */
-void *QOpenGLFunctions::platformGLHandle()
-{
-#if defined(QT_OPENGL_DYNAMIC)
- return qgl_glHandle();
-#else
- return 0;
-#endif
-}
-
QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglfunctions.h b/src/gui/opengl/qopenglfunctions.h
index 6d3f038004..03c12200d5 100644
--- a/src/gui/opengl/qopenglfunctions.h
+++ b/src/gui/opengl/qopenglfunctions.h
@@ -79,6 +79,52 @@ struct QOpenGLFunctionsPrivate;
// Undefine any macros from GLEW, qopenglextensions_p.h, etc that
// may interfere with the definition of QOpenGLFunctions.
+#undef glBindTexture
+#undef glBlendFunc
+#undef glClear
+#undef glClearColor
+#undef glClearStencil
+#undef glColorMask
+#undef glCopyTexImage2D
+#undef glCopyTexSubImage2D
+#undef glCullFace
+#undef glDeleteTextures
+#undef glDepthFunc
+#undef glDepthMask
+#undef glDisable
+#undef glDrawArrays
+#undef glDrawElements
+#undef glEnable
+#undef glFinish
+#undef glFlush
+#undef glFrontFace
+#undef glGenTextures
+#undef glGetBooleanv
+#undef glGetError
+#undef glGetFloatv
+#undef glGetIntegerv
+#undef glGetString
+#undef glGetTexParameterfv
+#undef glGetTexParameteriv
+#undef glHint
+#undef glIsEnabled
+#undef glIsTexture
+#undef glLineWidth
+#undef glPixelStorei
+#undef glPolygonOffset
+#undef glReadPixels
+#undef glScissor
+#undef glStencilFunc
+#undef glStencilMask
+#undef glStencilOp
+#undef glTexImage2D
+#undef glTexParameterf
+#undef glTexParameterfv
+#undef glTexParameteri
+#undef glTexParameteriv
+#undef glTexSubImage2D
+#undef glViewport
+
#undef glActiveTexture
#undef glAttachShader
#undef glBindAttribLocation
@@ -177,6 +223,8 @@ struct QOpenGLFunctionsPrivate;
#undef glVertexAttrib4fv
#undef glVertexAttribPointer
+#undef glTexLevelParameteriv
+
class Q_GUI_EXPORT QOpenGLFunctions
{
public:
@@ -213,6 +261,54 @@ public:
QT_DEPRECATED void initializeGLFunctions() { initializeOpenGLFunctions(); }
#endif
+ // GLES2 + OpenGL1 common subset
+ void glBindTexture(GLenum target, GLuint texture);
+ void glBlendFunc(GLenum sfactor, GLenum dfactor);
+ void glClear(GLbitfield mask);
+ void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+ void glClearStencil(GLint s);
+ void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+ void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+ void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+ void glCullFace(GLenum mode);
+ void glDeleteTextures(GLsizei n, const GLuint* textures);
+ void glDepthFunc(GLenum func);
+ void glDepthMask(GLboolean flag);
+ void glDisable(GLenum cap);
+ void glDrawArrays(GLenum mode, GLint first, GLsizei count);
+ void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
+ void glEnable(GLenum cap);
+ void glFinish();
+ void glFlush();
+ void glFrontFace(GLenum mode);
+ void glGenTextures(GLsizei n, GLuint* textures);
+ void glGetBooleanv(GLenum pname, GLboolean* params);
+ GLenum glGetError();
+ void glGetFloatv(GLenum pname, GLfloat* params);
+ void glGetIntegerv(GLenum pname, GLint* params);
+ const GLubyte *glGetString(GLenum name);
+ void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params);
+ void glGetTexParameteriv(GLenum target, GLenum pname, GLint* params);
+ void glHint(GLenum target, GLenum mode);
+ GLboolean glIsEnabled(GLenum cap);
+ GLboolean glIsTexture(GLuint texture);
+ void glLineWidth(GLfloat width);
+ void glPixelStorei(GLenum pname, GLint param);
+ void glPolygonOffset(GLfloat factor, GLfloat units);
+ void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
+ void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
+ void glStencilFunc(GLenum func, GLint ref, GLuint mask);
+ void glStencilMask(GLuint mask);
+ void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
+ void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+ void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
+ void glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params);
+ void glTexParameteri(GLenum target, GLenum pname, GLint param);
+ void glTexParameteriv(GLenum target, GLenum pname, const GLint* params);
+ void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
+ void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
+
+ // GL(ES)2
void glActiveTexture(GLenum texture);
void glAttachShader(GLuint program, GLuint shader);
void glBindAttribLocation(GLuint program, GLuint index, const char* name);
@@ -311,14 +407,8 @@ public:
void glVertexAttrib4fv(GLuint indx, const GLfloat* values);
void glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr);
- enum PlatformGLType {
- DesktopGL = 0,
- GLES2,
- GLES1
- };
- static PlatformGLType platformGLType();
- static void *platformGLHandle();
- static bool isES() { return platformGLType() != DesktopGL; }
+ // OpenGL1, not GLES2
+ void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
protected:
QOpenGLFunctionsPrivate *d_ptr;
@@ -331,6 +421,54 @@ struct QOpenGLFunctionsPrivate
{
QOpenGLFunctionsPrivate(QOpenGLContext *ctx);
+ void (QOPENGLF_APIENTRYP BindTexture)(GLenum target, GLuint texture);
+ void (QOPENGLF_APIENTRYP BlendFunc)(GLenum sfactor, GLenum dfactor);
+ void (QOPENGLF_APIENTRYP Clear)(GLbitfield mask);
+ void (QOPENGLF_APIENTRYP ClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+ void (QOPENGLF_APIENTRYP ClearDepthf)(GLclampf depth);
+ void (QOPENGLF_APIENTRYP ClearStencil)(GLint s);
+ void (QOPENGLF_APIENTRYP ColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+ void (QOPENGLF_APIENTRYP CopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+ void (QOPENGLF_APIENTRYP CopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+ void (QOPENGLF_APIENTRYP CullFace)(GLenum mode);
+ void (QOPENGLF_APIENTRYP DeleteTextures)(GLsizei n, const GLuint* textures);
+ void (QOPENGLF_APIENTRYP DepthFunc)(GLenum func);
+ void (QOPENGLF_APIENTRYP DepthMask)(GLboolean flag);
+ void (QOPENGLF_APIENTRYP DepthRangef)(GLclampf nearVal, GLclampf farVal);
+ void (QOPENGLF_APIENTRYP Disable)(GLenum cap);
+ void (QOPENGLF_APIENTRYP DrawArrays)(GLenum mode, GLint first, GLsizei count);
+ void (QOPENGLF_APIENTRYP DrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
+ void (QOPENGLF_APIENTRYP Enable)(GLenum cap);
+ void (QOPENGLF_APIENTRYP Finish)();
+ void (QOPENGLF_APIENTRYP Flush)();
+ void (QOPENGLF_APIENTRYP FrontFace)(GLenum mode);
+ void (QOPENGLF_APIENTRYP GenTextures)(GLsizei n, GLuint* textures);
+ void (QOPENGLF_APIENTRYP GetBooleanv)(GLenum pname, GLboolean* params);
+ GLenum (QOPENGLF_APIENTRYP GetError)();
+ void (QOPENGLF_APIENTRYP GetFloatv)(GLenum pname, GLfloat* params);
+ void (QOPENGLF_APIENTRYP GetIntegerv)(GLenum pname, GLint* params);
+ const GLubyte * (QOPENGLF_APIENTRYP GetString)(GLenum name);
+ void (QOPENGLF_APIENTRYP GetTexParameterfv)(GLenum target, GLenum pname, GLfloat* params);
+ void (QOPENGLF_APIENTRYP GetTexParameteriv)(GLenum target, GLenum pname, GLint* params);
+ void (QOPENGLF_APIENTRYP Hint)(GLenum target, GLenum mode);
+ GLboolean (QOPENGLF_APIENTRYP IsEnabled)(GLenum cap);
+ GLboolean (QOPENGLF_APIENTRYP IsTexture)(GLuint texture);
+ void (QOPENGLF_APIENTRYP LineWidth)(GLfloat width);
+ void (QOPENGLF_APIENTRYP PixelStorei)(GLenum pname, GLint param);
+ void (QOPENGLF_APIENTRYP PolygonOffset)(GLfloat factor, GLfloat units);
+ void (QOPENGLF_APIENTRYP ReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
+ void (QOPENGLF_APIENTRYP Scissor)(GLint x, GLint y, GLsizei width, GLsizei height);
+ void (QOPENGLF_APIENTRYP StencilFunc)(GLenum func, GLint ref, GLuint mask);
+ void (QOPENGLF_APIENTRYP StencilMask)(GLuint mask);
+ void (QOPENGLF_APIENTRYP StencilOp)(GLenum fail, GLenum zfail, GLenum zpass);
+ void (QOPENGLF_APIENTRYP TexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+ void (QOPENGLF_APIENTRYP TexParameterf)(GLenum target, GLenum pname, GLfloat param);
+ void (QOPENGLF_APIENTRYP TexParameterfv)(GLenum target, GLenum pname, const GLfloat* params);
+ void (QOPENGLF_APIENTRYP TexParameteri)(GLenum target, GLenum pname, GLint param);
+ void (QOPENGLF_APIENTRYP TexParameteriv)(GLenum target, GLenum pname, const GLint* params);
+ void (QOPENGLF_APIENTRYP TexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
+ void (QOPENGLF_APIENTRYP Viewport)(GLint x, GLint y, GLsizei width, GLsizei height);
+
void (QOPENGLF_APIENTRYP ActiveTexture)(GLenum texture);
void (QOPENGLF_APIENTRYP AttachShader)(GLuint program, GLuint shader);
void (QOPENGLF_APIENTRYP BindAttribLocation)(GLuint program, GLuint index, const char* name);
@@ -426,11 +564,520 @@ struct QOpenGLFunctionsPrivate
void (QOPENGLF_APIENTRYP VertexAttrib4f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
void (QOPENGLF_APIENTRYP VertexAttrib4fv)(GLuint indx, const GLfloat* values);
void (QOPENGLF_APIENTRYP VertexAttribPointer)(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr);
+
+ // OpenGL1 only, not GLES2
+ void (QOPENGLF_APIENTRYP GetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint *params);
+
+ // Special non-ES OpenGL variants, not to be called directly
+ void (QOPENGLF_APIENTRYP ClearDepth)(GLdouble depth);
+ void (QOPENGLF_APIENTRYP DepthRange)(GLdouble zNear, GLdouble zFar);
};
+// GLES2 + OpenGL1 common subset
+
+inline void QOpenGLFunctions::glBindTexture(GLenum target, GLuint texture)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glBindTexture(target, texture);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->BindTexture(target, texture);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glBlendFunc(GLenum sfactor, GLenum dfactor)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glBlendFunc(sfactor, dfactor);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->BlendFunc(sfactor, dfactor);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glClear(GLbitfield mask)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glClear(mask);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->Clear(mask);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glClearColor(red, green, blue, alpha);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->ClearColor(red, green, blue, alpha);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glClearStencil(GLint s)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glClearStencil(s);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->ClearStencil(s);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glColorMask(red, green, blue, alpha);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->ColorMask(red, green, blue, alpha);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glCopyTexImage2D(target, level, internalformat, x, y, width,height, border);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->CopyTexImage2D(target, level, internalformat, x, y, width,height, border);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glCullFace(GLenum mode)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glCullFace(mode);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->CullFace(mode);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glDeleteTextures(GLsizei n, const GLuint* textures)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glDeleteTextures(n, textures);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->DeleteTextures(n, textures);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glDepthFunc(GLenum func)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glDepthFunc(func);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->DepthFunc(func);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glDepthMask(GLboolean flag)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glDepthMask(flag);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->DepthMask(flag);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glDisable(GLenum cap)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glDisable(cap);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->Disable(cap);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glDrawArrays(GLenum mode, GLint first, GLsizei count)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glDrawArrays(mode, first, count);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->DrawArrays(mode, first, count);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glDrawElements(mode, count, type, indices);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->DrawElements(mode, count, type, indices);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glEnable(GLenum cap)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glEnable(cap);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->Enable(cap);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glFinish()
+{
+#ifdef QT_OPENGL_ES_2
+ ::glFinish();
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->Finish();
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glFlush()
+{
+#ifdef QT_OPENGL_ES_2
+ ::glFlush();
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->Flush();
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glFrontFace(GLenum mode)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glFrontFace(mode);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->FrontFace(mode);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glGenTextures(GLsizei n, GLuint* textures)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glGenTextures(n, textures);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->GenTextures(n, textures);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glGetBooleanv(GLenum pname, GLboolean* params)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glGetBooleanv(pname, params);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->GetBooleanv(pname, params);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline GLenum QOpenGLFunctions::glGetError()
+{
+#ifdef QT_OPENGL_ES_2
+ GLenum result = ::glGetError();
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ GLenum result = d_ptr->GetError();
+#endif
+ return result;
+}
+
+inline void QOpenGLFunctions::glGetFloatv(GLenum pname, GLfloat* params)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glGetFloatv(pname, params);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->GetFloatv(pname, params);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glGetIntegerv(GLenum pname, GLint* params)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glGetIntegerv(pname, params);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->GetIntegerv(pname, params);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline const GLubyte *QOpenGLFunctions::glGetString(GLenum name)
+{
+#ifdef QT_OPENGL_ES_2
+ const GLubyte *result = ::glGetString(name);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ const GLubyte *result = d_ptr->GetString(name);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+ return result;
+}
+
+inline void QOpenGLFunctions::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glGetTexParameterfv(target, pname, params);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->GetTexParameterfv(target, pname, params);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glGetTexParameteriv(target, pname, params);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->GetTexParameteriv(target, pname, params);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glHint(GLenum target, GLenum mode)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glHint(target, mode);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->Hint(target, mode);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline GLboolean QOpenGLFunctions::glIsEnabled(GLenum cap)
+{
+#ifdef QT_OPENGL_ES_2
+ GLboolean result = ::glIsEnabled(cap);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ GLboolean result = d_ptr->IsEnabled(cap);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+ return result;
+}
+
+inline GLboolean QOpenGLFunctions::glIsTexture(GLuint texture)
+{
+#ifdef QT_OPENGL_ES_2
+ GLboolean result = ::glIsTexture(texture);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ GLboolean result = d_ptr->IsTexture(texture);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+ return result;
+}
+
+inline void QOpenGLFunctions::glLineWidth(GLfloat width)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glLineWidth(width);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->LineWidth(width);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glPixelStorei(GLenum pname, GLint param)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glPixelStorei(pname, param);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->PixelStorei(pname, param);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glPolygonOffset(GLfloat factor, GLfloat units)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glPolygonOffset(factor, units);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->PolygonOffset(factor, units);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glReadPixels(x, y, width, height, format, type, pixels);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->ReadPixels(x, y, width, height, format, type, pixels);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glScissor(x, y, width, height);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->Scissor(x, y, width, height);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glStencilFunc(GLenum func, GLint ref, GLuint mask)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glStencilFunc(func, ref, mask);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->StencilFunc(func, ref, mask);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glStencilMask(GLuint mask)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glStencilMask(mask);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->StencilMask(mask);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glStencilOp(fail, zfail, zpass);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->StencilOp(fail, zfail, zpass);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glTexImage2D(target, level, internalformat, width,height, border, format, type, pixels);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->TexImage2D(target, level, internalformat, width,height, border, format, type, pixels);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glTexParameterf(GLenum target, GLenum pname, GLfloat param)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glTexParameterf(target, pname, param);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->TexParameterf(target, pname, param);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glTexParameterfv(target, pname, params);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->TexParameterfv(target, pname, params);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glTexParameteri(GLenum target, GLenum pname, GLint param)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glTexParameteri(target, pname, param);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->TexParameteri(target, pname, param);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glTexParameteriv(GLenum target, GLenum pname, const GLint* params)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glTexParameteriv(target, pname, params);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->TexParameteriv(target, pname, params);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+inline void QOpenGLFunctions::glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+#ifdef QT_OPENGL_ES_2
+ ::glViewport(x, y, width, height);
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->Viewport(x, y, width, height);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
+// GL(ES)2
+
inline void QOpenGLFunctions::glActiveTexture(GLenum texture)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glActiveTexture(texture);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -441,7 +1088,7 @@ inline void QOpenGLFunctions::glActiveTexture(GLenum texture)
inline void QOpenGLFunctions::glAttachShader(GLuint program, GLuint shader)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glAttachShader(program, shader);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -452,7 +1099,7 @@ inline void QOpenGLFunctions::glAttachShader(GLuint program, GLuint shader)
inline void QOpenGLFunctions::glBindAttribLocation(GLuint program, GLuint index, const char* name)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glBindAttribLocation(program, index, name);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -463,7 +1110,7 @@ inline void QOpenGLFunctions::glBindAttribLocation(GLuint program, GLuint index,
inline void QOpenGLFunctions::glBindBuffer(GLenum target, GLuint buffer)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glBindBuffer(target, buffer);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -476,7 +1123,7 @@ inline void QOpenGLFunctions::glBindFramebuffer(GLenum target, GLuint framebuffe
{
if (framebuffer == 0)
framebuffer = QOpenGLContext::currentContext()->defaultFramebufferObject();
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glBindFramebuffer(target, framebuffer);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -487,7 +1134,7 @@ inline void QOpenGLFunctions::glBindFramebuffer(GLenum target, GLuint framebuffe
inline void QOpenGLFunctions::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glBindRenderbuffer(target, renderbuffer);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -498,7 +1145,7 @@ inline void QOpenGLFunctions::glBindRenderbuffer(GLenum target, GLuint renderbuf
inline void QOpenGLFunctions::glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glBlendColor(red, green, blue, alpha);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -509,7 +1156,7 @@ inline void QOpenGLFunctions::glBlendColor(GLclampf red, GLclampf green, GLclamp
inline void QOpenGLFunctions::glBlendEquation(GLenum mode)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glBlendEquation(mode);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -520,7 +1167,7 @@ inline void QOpenGLFunctions::glBlendEquation(GLenum mode)
inline void QOpenGLFunctions::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glBlendEquationSeparate(modeRGB, modeAlpha);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -531,7 +1178,7 @@ inline void QOpenGLFunctions::glBlendEquationSeparate(GLenum modeRGB, GLenum mod
inline void QOpenGLFunctions::glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -542,7 +1189,7 @@ inline void QOpenGLFunctions::glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB,
inline void QOpenGLFunctions::glBufferData(GLenum target, qopengl_GLsizeiptr size, const void* data, GLenum usage)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glBufferData(target, size, data, usage);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -553,7 +1200,7 @@ inline void QOpenGLFunctions::glBufferData(GLenum target, qopengl_GLsizeiptr siz
inline void QOpenGLFunctions::glBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, const void* data)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glBufferSubData(target, offset, size, data);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -564,7 +1211,7 @@ inline void QOpenGLFunctions::glBufferSubData(GLenum target, qopengl_GLintptr of
inline GLenum QOpenGLFunctions::glCheckFramebufferStatus(GLenum target)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
GLenum result = ::glCheckFramebufferStatus(target);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -577,7 +1224,8 @@ inline GLenum QOpenGLFunctions::glCheckFramebufferStatus(GLenum target)
inline void QOpenGLFunctions::glClearDepthf(GLclampf depth)
{
#ifndef QT_OPENGL_ES
- ::glClearDepth(depth);
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->ClearDepthf(depth);
#else
::glClearDepthf(depth);
#endif
@@ -586,7 +1234,7 @@ inline void QOpenGLFunctions::glClearDepthf(GLclampf depth)
inline void QOpenGLFunctions::glCompileShader(GLuint shader)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glCompileShader(shader);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -597,7 +1245,7 @@ inline void QOpenGLFunctions::glCompileShader(GLuint shader)
inline void QOpenGLFunctions::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -608,7 +1256,7 @@ inline void QOpenGLFunctions::glCompressedTexImage2D(GLenum target, GLint level,
inline void QOpenGLFunctions::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -619,7 +1267,7 @@ inline void QOpenGLFunctions::glCompressedTexSubImage2D(GLenum target, GLint lev
inline GLuint QOpenGLFunctions::glCreateProgram()
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
GLuint result = ::glCreateProgram();
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -631,7 +1279,7 @@ inline GLuint QOpenGLFunctions::glCreateProgram()
inline GLuint QOpenGLFunctions::glCreateShader(GLenum type)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
GLuint result = ::glCreateShader(type);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -643,7 +1291,7 @@ inline GLuint QOpenGLFunctions::glCreateShader(GLenum type)
inline void QOpenGLFunctions::glDeleteBuffers(GLsizei n, const GLuint* buffers)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glDeleteBuffers(n, buffers);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -654,7 +1302,7 @@ inline void QOpenGLFunctions::glDeleteBuffers(GLsizei n, const GLuint* buffers)
inline void QOpenGLFunctions::glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glDeleteFramebuffers(n, framebuffers);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -665,7 +1313,7 @@ inline void QOpenGLFunctions::glDeleteFramebuffers(GLsizei n, const GLuint* fram
inline void QOpenGLFunctions::glDeleteProgram(GLuint program)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glDeleteProgram(program);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -676,7 +1324,7 @@ inline void QOpenGLFunctions::glDeleteProgram(GLuint program)
inline void QOpenGLFunctions::glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glDeleteRenderbuffers(n, renderbuffers);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -687,7 +1335,7 @@ inline void QOpenGLFunctions::glDeleteRenderbuffers(GLsizei n, const GLuint* ren
inline void QOpenGLFunctions::glDeleteShader(GLuint shader)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glDeleteShader(shader);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -699,7 +1347,8 @@ inline void QOpenGLFunctions::glDeleteShader(GLuint shader)
inline void QOpenGLFunctions::glDepthRangef(GLclampf zNear, GLclampf zFar)
{
#ifndef QT_OPENGL_ES
- ::glDepthRange(zNear, zFar);
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->DepthRangef(zNear, zFar);
#else
::glDepthRangef(zNear, zFar);
#endif
@@ -708,7 +1357,7 @@ inline void QOpenGLFunctions::glDepthRangef(GLclampf zNear, GLclampf zFar)
inline void QOpenGLFunctions::glDetachShader(GLuint program, GLuint shader)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glDetachShader(program, shader);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -719,7 +1368,7 @@ inline void QOpenGLFunctions::glDetachShader(GLuint program, GLuint shader)
inline void QOpenGLFunctions::glDisableVertexAttribArray(GLuint index)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glDisableVertexAttribArray(index);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -730,7 +1379,7 @@ inline void QOpenGLFunctions::glDisableVertexAttribArray(GLuint index)
inline void QOpenGLFunctions::glEnableVertexAttribArray(GLuint index)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glEnableVertexAttribArray(index);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -741,7 +1390,7 @@ inline void QOpenGLFunctions::glEnableVertexAttribArray(GLuint index)
inline void QOpenGLFunctions::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -752,7 +1401,7 @@ inline void QOpenGLFunctions::glFramebufferRenderbuffer(GLenum target, GLenum at
inline void QOpenGLFunctions::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glFramebufferTexture2D(target, attachment, textarget, texture, level);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -763,7 +1412,7 @@ inline void QOpenGLFunctions::glFramebufferTexture2D(GLenum target, GLenum attac
inline void QOpenGLFunctions::glGenBuffers(GLsizei n, GLuint* buffers)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glGenBuffers(n, buffers);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -774,7 +1423,7 @@ inline void QOpenGLFunctions::glGenBuffers(GLsizei n, GLuint* buffers)
inline void QOpenGLFunctions::glGenerateMipmap(GLenum target)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glGenerateMipmap(target);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -785,7 +1434,7 @@ inline void QOpenGLFunctions::glGenerateMipmap(GLenum target)
inline void QOpenGLFunctions::glGenFramebuffers(GLsizei n, GLuint* framebuffers)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glGenFramebuffers(n, framebuffers);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -796,7 +1445,7 @@ inline void QOpenGLFunctions::glGenFramebuffers(GLsizei n, GLuint* framebuffers)
inline void QOpenGLFunctions::glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glGenRenderbuffers(n, renderbuffers);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -807,7 +1456,7 @@ inline void QOpenGLFunctions::glGenRenderbuffers(GLsizei n, GLuint* renderbuffer
inline void QOpenGLFunctions::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glGetActiveAttrib(program, index, bufsize, length, size, type, name);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -818,7 +1467,7 @@ inline void QOpenGLFunctions::glGetActiveAttrib(GLuint program, GLuint index, GL
inline void QOpenGLFunctions::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glGetActiveUniform(program, index, bufsize, length, size, type, name);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -829,7 +1478,7 @@ inline void QOpenGLFunctions::glGetActiveUniform(GLuint program, GLuint index, G
inline void QOpenGLFunctions::glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glGetAttachedShaders(program, maxcount, count, shaders);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -840,7 +1489,7 @@ inline void QOpenGLFunctions::glGetAttachedShaders(GLuint program, GLsizei maxco
inline GLint QOpenGLFunctions::glGetAttribLocation(GLuint program, const char* name)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
GLint result = ::glGetAttribLocation(program, name);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -852,7 +1501,7 @@ inline GLint QOpenGLFunctions::glGetAttribLocation(GLuint program, const char* n
inline void QOpenGLFunctions::glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glGetBufferParameteriv(target, pname, params);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -863,7 +1512,7 @@ inline void QOpenGLFunctions::glGetBufferParameteriv(GLenum target, GLenum pname
inline void QOpenGLFunctions::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -874,7 +1523,7 @@ inline void QOpenGLFunctions::glGetFramebufferAttachmentParameteriv(GLenum targe
inline void QOpenGLFunctions::glGetProgramiv(GLuint program, GLenum pname, GLint* params)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glGetProgramiv(program, pname, params);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -885,7 +1534,7 @@ inline void QOpenGLFunctions::glGetProgramiv(GLuint program, GLenum pname, GLint
inline void QOpenGLFunctions::glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glGetProgramInfoLog(program, bufsize, length, infolog);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -896,7 +1545,7 @@ inline void QOpenGLFunctions::glGetProgramInfoLog(GLuint program, GLsizei bufsiz
inline void QOpenGLFunctions::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glGetRenderbufferParameteriv(target, pname, params);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -907,7 +1556,7 @@ inline void QOpenGLFunctions::glGetRenderbufferParameteriv(GLenum target, GLenum
inline void QOpenGLFunctions::glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glGetShaderiv(shader, pname, params);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -918,7 +1567,7 @@ inline void QOpenGLFunctions::glGetShaderiv(GLuint shader, GLenum pname, GLint*
inline void QOpenGLFunctions::glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glGetShaderInfoLog(shader, bufsize, length, infolog);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -929,7 +1578,7 @@ inline void QOpenGLFunctions::glGetShaderInfoLog(GLuint shader, GLsizei bufsize,
inline void QOpenGLFunctions::glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -940,7 +1589,7 @@ inline void QOpenGLFunctions::glGetShaderPrecisionFormat(GLenum shadertype, GLen
inline void QOpenGLFunctions::glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glGetShaderSource(shader, bufsize, length, source);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -951,7 +1600,7 @@ inline void QOpenGLFunctions::glGetShaderSource(GLuint shader, GLsizei bufsize,
inline void QOpenGLFunctions::glGetUniformfv(GLuint program, GLint location, GLfloat* params)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glGetUniformfv(program, location, params);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -962,7 +1611,7 @@ inline void QOpenGLFunctions::glGetUniformfv(GLuint program, GLint location, GLf
inline void QOpenGLFunctions::glGetUniformiv(GLuint program, GLint location, GLint* params)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glGetUniformiv(program, location, params);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -973,7 +1622,7 @@ inline void QOpenGLFunctions::glGetUniformiv(GLuint program, GLint location, GLi
inline GLint QOpenGLFunctions::glGetUniformLocation(GLuint program, const char* name)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
GLint result = ::glGetUniformLocation(program, name);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -985,7 +1634,7 @@ inline GLint QOpenGLFunctions::glGetUniformLocation(GLuint program, const char*
inline void QOpenGLFunctions::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glGetVertexAttribfv(index, pname, params);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -996,7 +1645,7 @@ inline void QOpenGLFunctions::glGetVertexAttribfv(GLuint index, GLenum pname, GL
inline void QOpenGLFunctions::glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glGetVertexAttribiv(index, pname, params);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1007,7 +1656,7 @@ inline void QOpenGLFunctions::glGetVertexAttribiv(GLuint index, GLenum pname, GL
inline void QOpenGLFunctions::glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glGetVertexAttribPointerv(index, pname, pointer);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1018,7 +1667,7 @@ inline void QOpenGLFunctions::glGetVertexAttribPointerv(GLuint index, GLenum pna
inline GLboolean QOpenGLFunctions::glIsBuffer(GLuint buffer)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
GLboolean result = ::glIsBuffer(buffer);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1030,7 +1679,7 @@ inline GLboolean QOpenGLFunctions::glIsBuffer(GLuint buffer)
inline GLboolean QOpenGLFunctions::glIsFramebuffer(GLuint framebuffer)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
GLboolean result = ::glIsFramebuffer(framebuffer);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1042,7 +1691,7 @@ inline GLboolean QOpenGLFunctions::glIsFramebuffer(GLuint framebuffer)
inline GLboolean QOpenGLFunctions::glIsProgram(GLuint program)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
GLboolean result = ::glIsProgram(program);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1054,7 +1703,7 @@ inline GLboolean QOpenGLFunctions::glIsProgram(GLuint program)
inline GLboolean QOpenGLFunctions::glIsRenderbuffer(GLuint renderbuffer)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
GLboolean result = ::glIsRenderbuffer(renderbuffer);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1066,7 +1715,7 @@ inline GLboolean QOpenGLFunctions::glIsRenderbuffer(GLuint renderbuffer)
inline GLboolean QOpenGLFunctions::glIsShader(GLuint shader)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
GLboolean result = ::glIsShader(shader);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1078,7 +1727,7 @@ inline GLboolean QOpenGLFunctions::glIsShader(GLuint shader)
inline void QOpenGLFunctions::glLinkProgram(GLuint program)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glLinkProgram(program);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1089,7 +1738,7 @@ inline void QOpenGLFunctions::glLinkProgram(GLuint program)
inline void QOpenGLFunctions::glReleaseShaderCompiler()
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glReleaseShaderCompiler();
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1100,7 +1749,7 @@ inline void QOpenGLFunctions::glReleaseShaderCompiler()
inline void QOpenGLFunctions::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glRenderbufferStorage(target, internalformat, width, height);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1111,7 +1760,7 @@ inline void QOpenGLFunctions::glRenderbufferStorage(GLenum target, GLenum intern
inline void QOpenGLFunctions::glSampleCoverage(GLclampf value, GLboolean invert)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glSampleCoverage(value, invert);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1122,7 +1771,7 @@ inline void QOpenGLFunctions::glSampleCoverage(GLclampf value, GLboolean invert)
inline void QOpenGLFunctions::glShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glShaderBinary(n, shaders, binaryformat, binary, length);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1133,7 +1782,7 @@ inline void QOpenGLFunctions::glShaderBinary(GLint n, const GLuint* shaders, GLe
inline void QOpenGLFunctions::glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glShaderSource(shader, count, string, length);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1144,7 +1793,7 @@ inline void QOpenGLFunctions::glShaderSource(GLuint shader, GLsizei count, const
inline void QOpenGLFunctions::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glStencilFuncSeparate(face, func, ref, mask);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1155,7 +1804,7 @@ inline void QOpenGLFunctions::glStencilFuncSeparate(GLenum face, GLenum func, GL
inline void QOpenGLFunctions::glStencilMaskSeparate(GLenum face, GLuint mask)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glStencilMaskSeparate(face, mask);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1166,7 +1815,7 @@ inline void QOpenGLFunctions::glStencilMaskSeparate(GLenum face, GLuint mask)
inline void QOpenGLFunctions::glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glStencilOpSeparate(face, fail, zfail, zpass);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1177,7 +1826,7 @@ inline void QOpenGLFunctions::glStencilOpSeparate(GLenum face, GLenum fail, GLen
inline void QOpenGLFunctions::glUniform1f(GLint location, GLfloat x)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glUniform1f(location, x);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1188,7 +1837,7 @@ inline void QOpenGLFunctions::glUniform1f(GLint location, GLfloat x)
inline void QOpenGLFunctions::glUniform1fv(GLint location, GLsizei count, const GLfloat* v)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glUniform1fv(location, count, v);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1199,7 +1848,7 @@ inline void QOpenGLFunctions::glUniform1fv(GLint location, GLsizei count, const
inline void QOpenGLFunctions::glUniform1i(GLint location, GLint x)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glUniform1i(location, x);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1210,7 +1859,7 @@ inline void QOpenGLFunctions::glUniform1i(GLint location, GLint x)
inline void QOpenGLFunctions::glUniform1iv(GLint location, GLsizei count, const GLint* v)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glUniform1iv(location, count, v);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1221,7 +1870,7 @@ inline void QOpenGLFunctions::glUniform1iv(GLint location, GLsizei count, const
inline void QOpenGLFunctions::glUniform2f(GLint location, GLfloat x, GLfloat y)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glUniform2f(location, x, y);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1232,7 +1881,7 @@ inline void QOpenGLFunctions::glUniform2f(GLint location, GLfloat x, GLfloat y)
inline void QOpenGLFunctions::glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glUniform2fv(location, count, v);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1243,7 +1892,7 @@ inline void QOpenGLFunctions::glUniform2fv(GLint location, GLsizei count, const
inline void QOpenGLFunctions::glUniform2i(GLint location, GLint x, GLint y)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glUniform2i(location, x, y);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1254,7 +1903,7 @@ inline void QOpenGLFunctions::glUniform2i(GLint location, GLint x, GLint y)
inline void QOpenGLFunctions::glUniform2iv(GLint location, GLsizei count, const GLint* v)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glUniform2iv(location, count, v);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1265,7 +1914,7 @@ inline void QOpenGLFunctions::glUniform2iv(GLint location, GLsizei count, const
inline void QOpenGLFunctions::glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glUniform3f(location, x, y, z);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1276,7 +1925,7 @@ inline void QOpenGLFunctions::glUniform3f(GLint location, GLfloat x, GLfloat y,
inline void QOpenGLFunctions::glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glUniform3fv(location, count, v);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1287,7 +1936,7 @@ inline void QOpenGLFunctions::glUniform3fv(GLint location, GLsizei count, const
inline void QOpenGLFunctions::glUniform3i(GLint location, GLint x, GLint y, GLint z)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glUniform3i(location, x, y, z);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1298,7 +1947,7 @@ inline void QOpenGLFunctions::glUniform3i(GLint location, GLint x, GLint y, GLin
inline void QOpenGLFunctions::glUniform3iv(GLint location, GLsizei count, const GLint* v)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glUniform3iv(location, count, v);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1309,7 +1958,7 @@ inline void QOpenGLFunctions::glUniform3iv(GLint location, GLsizei count, const
inline void QOpenGLFunctions::glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glUniform4f(location, x, y, z, w);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1320,7 +1969,7 @@ inline void QOpenGLFunctions::glUniform4f(GLint location, GLfloat x, GLfloat y,
inline void QOpenGLFunctions::glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glUniform4fv(location, count, v);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1331,7 +1980,7 @@ inline void QOpenGLFunctions::glUniform4fv(GLint location, GLsizei count, const
inline void QOpenGLFunctions::glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glUniform4i(location, x, y, z, w);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1342,7 +1991,7 @@ inline void QOpenGLFunctions::glUniform4i(GLint location, GLint x, GLint y, GLin
inline void QOpenGLFunctions::glUniform4iv(GLint location, GLsizei count, const GLint* v)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glUniform4iv(location, count, v);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1353,7 +2002,7 @@ inline void QOpenGLFunctions::glUniform4iv(GLint location, GLsizei count, const
inline void QOpenGLFunctions::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glUniformMatrix2fv(location, count, transpose, value);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1364,7 +2013,7 @@ inline void QOpenGLFunctions::glUniformMatrix2fv(GLint location, GLsizei count,
inline void QOpenGLFunctions::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glUniformMatrix3fv(location, count, transpose, value);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1375,7 +2024,7 @@ inline void QOpenGLFunctions::glUniformMatrix3fv(GLint location, GLsizei count,
inline void QOpenGLFunctions::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glUniformMatrix4fv(location, count, transpose, value);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1386,7 +2035,7 @@ inline void QOpenGLFunctions::glUniformMatrix4fv(GLint location, GLsizei count,
inline void QOpenGLFunctions::glUseProgram(GLuint program)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glUseProgram(program);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1397,7 +2046,7 @@ inline void QOpenGLFunctions::glUseProgram(GLuint program)
inline void QOpenGLFunctions::glValidateProgram(GLuint program)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glValidateProgram(program);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1408,7 +2057,7 @@ inline void QOpenGLFunctions::glValidateProgram(GLuint program)
inline void QOpenGLFunctions::glVertexAttrib1f(GLuint indx, GLfloat x)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glVertexAttrib1f(indx, x);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1419,7 +2068,7 @@ inline void QOpenGLFunctions::glVertexAttrib1f(GLuint indx, GLfloat x)
inline void QOpenGLFunctions::glVertexAttrib1fv(GLuint indx, const GLfloat* values)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glVertexAttrib1fv(indx, values);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1430,7 +2079,7 @@ inline void QOpenGLFunctions::glVertexAttrib1fv(GLuint indx, const GLfloat* valu
inline void QOpenGLFunctions::glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glVertexAttrib2f(indx, x, y);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1441,7 +2090,7 @@ inline void QOpenGLFunctions::glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y
inline void QOpenGLFunctions::glVertexAttrib2fv(GLuint indx, const GLfloat* values)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glVertexAttrib2fv(indx, values);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1452,7 +2101,7 @@ inline void QOpenGLFunctions::glVertexAttrib2fv(GLuint indx, const GLfloat* valu
inline void QOpenGLFunctions::glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glVertexAttrib3f(indx, x, y, z);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1463,7 +2112,7 @@ inline void QOpenGLFunctions::glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y
inline void QOpenGLFunctions::glVertexAttrib3fv(GLuint indx, const GLfloat* values)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glVertexAttrib3fv(indx, values);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1474,7 +2123,7 @@ inline void QOpenGLFunctions::glVertexAttrib3fv(GLuint indx, const GLfloat* valu
inline void QOpenGLFunctions::glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glVertexAttrib4f(indx, x, y, z, w);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1485,7 +2134,7 @@ inline void QOpenGLFunctions::glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y
inline void QOpenGLFunctions::glVertexAttrib4fv(GLuint indx, const GLfloat* values)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glVertexAttrib4fv(indx, values);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1496,7 +2145,7 @@ inline void QOpenGLFunctions::glVertexAttrib4fv(GLuint indx, const GLfloat* valu
inline void QOpenGLFunctions::glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr)
{
-#if defined(QT_OPENGL_ES_2)
+#ifdef QT_OPENGL_ES_2
::glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
#else
Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
@@ -1505,6 +2154,24 @@ inline void QOpenGLFunctions::glVertexAttribPointer(GLuint indx, GLint size, GLe
Q_OPENGL_FUNCTIONS_DEBUG
}
+// OpenGL1, not GLES2
+
+inline void QOpenGLFunctions::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
+{
+#ifdef QT_OPENGL_ES_2
+ Q_UNUSED(target);
+ Q_UNUSED(level);
+ Q_UNUSED(pname);
+ Q_UNUSED(params);
+ // Cannot get here.
+ qFatal("QOpenGLFunctions: glGetTexLevelParameteriv not available with OpenGL ES");
+#else
+ Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr));
+ d_ptr->GetTexLevelParameteriv(target, level, pname, params);
+#endif
+ Q_OPENGL_FUNCTIONS_DEBUG
+}
+
QT_END_NAMESPACE
#endif // QT_NO_OPENGL
diff --git a/src/gui/opengl/qopenglgradientcache.cpp b/src/gui/opengl/qopenglgradientcache.cpp
index 9c312808a2..91b4d08474 100644
--- a/src/gui/opengl/qopenglgradientcache.cpp
+++ b/src/gui/opengl/qopenglgradientcache.cpp
@@ -43,6 +43,7 @@
#include <private/qdrawhelper_p.h>
#include <private/qopenglcontext_p.h>
#include <QtCore/qmutex.h>
+#include <QtGui/qopenglfunctions.h>
QT_BEGIN_NAMESPACE
@@ -91,9 +92,10 @@ void QOpenGL2GradientCache::cleanCache()
{
QMutexLocker lock(&m_mutex);
QOpenGLGradientColorTableHash::const_iterator it = cache.constBegin();
+ QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
for (; it != cache.constEnd(); ++it) {
const CacheInfo &cache_info = it.value();
- glDeleteTextures(1, &cache_info.texId);
+ funcs->glDeleteTextures(1, &cache_info.texId);
}
cache.clear();
}
@@ -129,6 +131,7 @@ GLuint QOpenGL2GradientCache::getBuffer(const QGradient &gradient, qreal opacity
GLuint QOpenGL2GradientCache::addCacheElement(quint64 hash_val, const QGradient &gradient, qreal opacity)
{
+ QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
if (cache.size() == maxCacheSize()) {
int elem_to_remove = qrand() % maxCacheSize();
quint64 key = cache.keys()[elem_to_remove];
@@ -136,7 +139,7 @@ GLuint QOpenGL2GradientCache::addCacheElement(quint64 hash_val, const QGradient
// need to call glDeleteTextures on each removed cache entry:
QOpenGLGradientColorTableHash::const_iterator it = cache.constFind(key);
do {
- glDeleteTextures(1, &it.value().texId);
+ funcs->glDeleteTextures(1, &it.value().texId);
} while (++it != cache.constEnd() && it.key() == key);
cache.remove(key); // may remove more than 1, but OK
}
@@ -144,10 +147,10 @@ GLuint QOpenGL2GradientCache::addCacheElement(quint64 hash_val, const QGradient
CacheInfo cache_entry(gradient.stops(), opacity, gradient.interpolationMode());
uint buffer[1024];
generateGradientColorTable(gradient, buffer, paletteSize(), opacity);
- glGenTextures(1, &cache_entry.texId);
- glBindTexture(GL_TEXTURE_2D, cache_entry.texId);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, paletteSize(), 1,
- 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
+ funcs->glGenTextures(1, &cache_entry.texId);
+ funcs->glBindTexture(GL_TEXTURE_2D, cache_entry.texId);
+ funcs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, paletteSize(), 1,
+ 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
return cache.insert(hash_val, cache_entry).value().texId;
}
diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp
index 63127668a5..f160b340e0 100644
--- a/src/gui/opengl/qopenglpaintengine.cpp
+++ b/src/gui/opengl/qopenglpaintengine.cpp
@@ -123,14 +123,14 @@ void QOpenGL2PaintEngineExPrivate::updateTextureFilter(GLenum target, GLenum wra
lastTextureUsed = id;
if (smoothPixmapTransform) {
- glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ funcs.glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ funcs.glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
} else {
- glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ funcs.glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ funcs.glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
- glTexParameteri(target, GL_TEXTURE_WRAP_S, wrapMode);
- glTexParameteri(target, GL_TEXTURE_WRAP_T, wrapMode);
+ funcs.glTexParameteri(target, GL_TEXTURE_WRAP_S, wrapMode);
+ funcs.glTexParameteri(target, GL_TEXTURE_WRAP_T, wrapMode);
}
@@ -204,7 +204,7 @@ void QOpenGL2PaintEngineExPrivate::updateBrushTexture()
GLuint texId = QOpenGL2GradientCache::cacheForContext(ctx)->getBuffer(*g, 1.0);
funcs.glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT);
- glBindTexture(GL_TEXTURE_2D, texId);
+ funcs.glBindTexture(GL_TEXTURE_2D, texId);
if (g->spread() == QGradient::RepeatSpread || g->type() == QGradient::ConicalGradient)
updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform);
@@ -221,7 +221,7 @@ void QOpenGL2PaintEngineExPrivate::updateBrushTexture()
currentBrushPixmap = currentBrushPixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio);
GLuint wrapMode = GL_REPEAT;
- if (QOpenGLFunctions::isES()) {
+ if (QOpenGLContext::currentContext()->isES()) {
// OpenGL ES does not support GL_REPEAT wrap modes for NPOT textures. So instead,
// we emulate GL_REPEAT by only taking the fractional part of the texture coords
// in the qopenglslTextureBrushSrcFragmentShader program.
@@ -439,43 +439,43 @@ void QOpenGL2PaintEngineExPrivate::updateCompositionMode()
// qDebug() << "QOpenGL2PaintEngineExPrivate::updateCompositionMode() - Setting GL composition mode for " << q->state()->composition_mode;
switch(q->state()->composition_mode) {
case QPainter::CompositionMode_SourceOver:
- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ funcs.glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
break;
case QPainter::CompositionMode_DestinationOver:
- glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE);
+ funcs.glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE);
break;
case QPainter::CompositionMode_Clear:
- glBlendFunc(GL_ZERO, GL_ZERO);
+ funcs.glBlendFunc(GL_ZERO, GL_ZERO);
break;
case QPainter::CompositionMode_Source:
- glBlendFunc(GL_ONE, GL_ZERO);
+ funcs.glBlendFunc(GL_ONE, GL_ZERO);
break;
case QPainter::CompositionMode_Destination:
- glBlendFunc(GL_ZERO, GL_ONE);
+ funcs.glBlendFunc(GL_ZERO, GL_ONE);
break;
case QPainter::CompositionMode_SourceIn:
- glBlendFunc(GL_DST_ALPHA, GL_ZERO);
+ funcs.glBlendFunc(GL_DST_ALPHA, GL_ZERO);
break;
case QPainter::CompositionMode_DestinationIn:
- glBlendFunc(GL_ZERO, GL_SRC_ALPHA);
+ funcs.glBlendFunc(GL_ZERO, GL_SRC_ALPHA);
break;
case QPainter::CompositionMode_SourceOut:
- glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ZERO);
+ funcs.glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ZERO);
break;
case QPainter::CompositionMode_DestinationOut:
- glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);
+ funcs.glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);
break;
case QPainter::CompositionMode_SourceAtop:
- glBlendFunc(GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ funcs.glBlendFunc(GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
break;
case QPainter::CompositionMode_DestinationAtop:
- glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_SRC_ALPHA);
+ funcs.glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_SRC_ALPHA);
break;
case QPainter::CompositionMode_Xor:
- glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ funcs.glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
break;
case QPainter::CompositionMode_Plus:
- glBlendFunc(GL_ONE, GL_ONE);
+ funcs.glBlendFunc(GL_ONE, GL_ONE);
break;
default:
qWarning("Unsupported composition mode");
@@ -524,7 +524,7 @@ void QOpenGL2PaintEngineExPrivate::drawTexture(const QOpenGLRect& dest, const QO
setCoords(staticVertexCoordinateArray, dest);
setCoords(staticTextureCoordinateArray, srcTextureRect);
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+ funcs.glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
void QOpenGL2PaintEngineEx::beginNativePainting()
@@ -541,37 +541,35 @@ void QOpenGL2PaintEngineEx::beginNativePainting()
for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i)
d->funcs.glDisableVertexAttribArray(i);
-#ifndef QT_OPENGL_ES_2
- if (!QOpenGLFunctions::isES()) {
- Q_ASSERT(QOpenGLContext::currentContext());
- const QOpenGLContext *ctx = d->ctx;
- const QSurfaceFormat &fmt = d->device->context()->format();
- if (fmt.majorVersion() < 3 || (fmt.majorVersion() == 3 && fmt.minorVersion() < 1)
- || (fmt.majorVersion() == 3 && fmt.minorVersion() == 1 && ctx->hasExtension(QByteArrayLiteral("GL_ARB_compatibility")))
- || fmt.profile() == QSurfaceFormat::CompatibilityProfile)
- {
- // be nice to people who mix OpenGL 1.x code with QPainter commands
- // by setting modelview and projection matrices to mirror the GL 1
- // paint engine
- const QTransform& mtx = state()->matrix;
-
- float mv_matrix[4][4] =
- {
- { float(mtx.m11()), float(mtx.m12()), 0, float(mtx.m13()) },
- { float(mtx.m21()), float(mtx.m22()), 0, float(mtx.m23()) },
- { 0, 0, 1, 0 },
- { float(mtx.dx()), float(mtx.dy()), 0, float(mtx.m33()) }
- };
-
- const QSize sz = d->device->size();
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0, sz.width(), sz.height(), 0, -999999, 999999);
-
- glMatrixMode(GL_MODELVIEW);
- glLoadMatrixf(&mv_matrix[0][0]);
- }
+#if !defined(QT_OPENGL_ES_2) && !defined(QT_OPENGL_DYNAMIC)
+ Q_ASSERT(QOpenGLContext::currentContext());
+ const QOpenGLContext *ctx = d->ctx;
+ const QSurfaceFormat &fmt = d->device->context()->format();
+ if (fmt.majorVersion() < 3 || (fmt.majorVersion() == 3 && fmt.minorVersion() < 1)
+ || (fmt.majorVersion() == 3 && fmt.minorVersion() == 1 && ctx->hasExtension(QByteArrayLiteral("GL_ARB_compatibility")))
+ || fmt.profile() == QSurfaceFormat::CompatibilityProfile)
+ {
+ // be nice to people who mix OpenGL 1.x code with QPainter commands
+ // by setting modelview and projection matrices to mirror the GL 1
+ // paint engine
+ const QTransform& mtx = state()->matrix;
+
+ float mv_matrix[4][4] =
+ {
+ { float(mtx.m11()), float(mtx.m12()), 0, float(mtx.m13()) },
+ { float(mtx.m21()), float(mtx.m22()), 0, float(mtx.m23()) },
+ { 0, 0, 1, 0 },
+ { float(mtx.dx()), float(mtx.dy()), 0, float(mtx.m33()) }
+ };
+
+ const QSize sz = d->device->size();
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(0, sz.width(), sz.height(), 0, -999999, 999999);
+
+ glMatrixMode(GL_MODELVIEW);
+ glLoadMatrixf(&mv_matrix[0][0]);
}
#endif // QT_OPENGL_ES_2
@@ -586,21 +584,21 @@ void QOpenGL2PaintEngineEx::beginNativePainting()
void QOpenGL2PaintEngineExPrivate::resetGLState()
{
- glDisable(GL_BLEND);
+ funcs.glDisable(GL_BLEND);
funcs.glActiveTexture(GL_TEXTURE0);
- glDisable(GL_STENCIL_TEST);
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_SCISSOR_TEST);
- glDepthMask(true);
- glDepthFunc(GL_LESS);
+ funcs.glDisable(GL_STENCIL_TEST);
+ funcs.glDisable(GL_DEPTH_TEST);
+ funcs.glDisable(GL_SCISSOR_TEST);
+ funcs.glDepthMask(true);
+ funcs.glDepthFunc(GL_LESS);
funcs.glClearDepthf(1);
- glStencilMask(0xff);
- glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
- glStencilFunc(GL_ALWAYS, 0, 0xff);
+ funcs.glStencilMask(0xff);
+ funcs.glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
+ funcs.glStencilFunc(GL_ALWAYS, 0, 0xff);
setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, false);
setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, false);
setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false);
- if (!QOpenGLFunctions::isES()) {
+ if (!QOpenGLContext::currentContext()->isES()) {
// gl_Color, corresponding to vertex attribute 3, may have been changed
float color[] = { 1.0f, 1.0f, 1.0f, 1.0f };
funcs.glVertexAttrib4fv(3, color);
@@ -755,9 +753,9 @@ void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path)
cache->primitiveType = GL_TRIANGLE_FAN;
cache->iscale = inverseScale;
#ifdef QT_OPENGL_CACHE_AS_VBOS
- glGenBuffers(1, &cache->vbo);
- glBindBuffer(GL_ARRAY_BUFFER, cache->vbo);
- glBufferData(GL_ARRAY_BUFFER, floatSizeInBytes, vertexCoordinateArray.data(), GL_STATIC_DRAW);
+ funcs.glGenBuffers(1, &cache->vbo);
+ funcs.glBindBuffer(GL_ARRAY_BUFFER, cache->vbo);
+ funcs.glBufferData(GL_ARRAY_BUFFER, floatSizeInBytes, vertexCoordinateArray.data(), GL_STATIC_DRAW);
cache->ibo = 0;
#else
cache->vertices = (float *) malloc(floatSizeInBytes);
@@ -768,12 +766,12 @@ void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path)
prepareForDraw(currentBrush.isOpaque());
#ifdef QT_OPENGL_CACHE_AS_VBOS
- glBindBuffer(GL_ARRAY_BUFFER, cache->vbo);
+ funcs.glBindBuffer(GL_ARRAY_BUFFER, cache->vbo);
setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, 0);
#else
setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, cache->vertices);
#endif
- glDrawArrays(cache->primitiveType, 0, cache->vertexCount);
+ funcs.glDrawArrays(cache->primitiveType, 0, cache->vertexCount);
} else {
// printf(" - Marking path as cachable...\n");
@@ -833,10 +831,10 @@ void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path)
cache->iscale = inverseScale;
cache->indexType = polys.indices.type();
#ifdef QT_OPENGL_CACHE_AS_VBOS
- glGenBuffers(1, &cache->vbo);
- glGenBuffers(1, &cache->ibo);
- glBindBuffer(GL_ARRAY_BUFFER, cache->vbo);
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cache->ibo);
+ funcs.glGenBuffers(1, &cache->vbo);
+ funcs.glGenBuffers(1, &cache->ibo);
+ funcs.glBindBuffer(GL_ARRAY_BUFFER, cache->vbo);
+ funcs.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cache->ibo);
if (polys.indices.type() == QVertexIndexVector::UnsignedInt)
funcs.glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(quint32) * polys.indices.size(), polys.indices.data(), GL_STATIC_DRAW);
@@ -863,21 +861,21 @@ void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path)
prepareForDraw(currentBrush.isOpaque());
#ifdef QT_OPENGL_CACHE_AS_VBOS
- glBindBuffer(GL_ARRAY_BUFFER, cache->vbo);
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cache->ibo);
+ funcs.glBindBuffer(GL_ARRAY_BUFFER, cache->vbo);
+ funcs.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cache->ibo);
setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, 0);
if (cache->indexType == QVertexIndexVector::UnsignedInt)
- glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_INT, 0);
+ funcs.glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_INT, 0);
else
- glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_SHORT, 0);
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
- glBindBuffer(GL_ARRAY_BUFFER, 0);
+ funcs.glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_SHORT, 0);
+ funcs.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
+ funcs.glBindBuffer(GL_ARRAY_BUFFER, 0);
#else
setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, cache->vertices);
if (cache->indexType == QVertexIndexVector::UnsignedInt)
- glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_INT, (qint32 *)cache->indices);
+ funcs.glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_INT, (qint32 *)cache->indices);
else
- glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_SHORT, (qint16 *)cache->indices);
+ funcs.glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_SHORT, (qint16 *)cache->indices);
#endif
} else {
@@ -904,9 +902,9 @@ void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path)
prepareForDraw(currentBrush.isOpaque());
setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, vertices.constData());
if (funcs.hasOpenGLExtension(QOpenGLExtensions::ElementIndexUint))
- glDrawElements(GL_TRIANGLES, polys.indices.size(), GL_UNSIGNED_INT, polys.indices.data());
+ funcs.glDrawElements(GL_TRIANGLES, polys.indices.size(), GL_UNSIGNED_INT, polys.indices.data());
else
- glDrawElements(GL_TRIANGLES, polys.indices.size(), GL_UNSIGNED_SHORT, polys.indices.data());
+ funcs.glDrawElements(GL_TRIANGLES, polys.indices.size(), GL_UNSIGNED_SHORT, polys.indices.data());
} else {
// We can't handle big, concave painter paths with OpenGL without stencil buffer.
qWarning("Painter path exceeds +/-32767 pixels.");
@@ -920,24 +918,24 @@ void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path)
fillStencilWithVertexArray(vertexCoordinateArray, path.hasWindingFill());
- glStencilMask(0xff);
- glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
+ funcs.glStencilMask(0xff);
+ funcs.glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
if (q->state()->clipTestEnabled) {
// Pass when high bit is set, replace stencil value with current clip
- glStencilFunc(GL_NOTEQUAL, q->state()->currentClip, GL_STENCIL_HIGH_BIT);
+ funcs.glStencilFunc(GL_NOTEQUAL, q->state()->currentClip, GL_STENCIL_HIGH_BIT);
} else if (path.hasWindingFill()) {
// Pass when any bit is set, replace stencil value with 0
- glStencilFunc(GL_NOTEQUAL, 0, 0xff);
+ funcs.glStencilFunc(GL_NOTEQUAL, 0, 0xff);
} else {
// Pass when high bit is set, replace stencil value with 0
- glStencilFunc(GL_NOTEQUAL, 0, GL_STENCIL_HIGH_BIT);
+ funcs.glStencilFunc(GL_NOTEQUAL, 0, GL_STENCIL_HIGH_BIT);
}
prepareForDraw(currentBrush.isOpaque());
// Stencil the brush onto the dest buffer
composite(vertexCoordinateArray.boundingRect());
- glStencilMask(0);
+ funcs.glStencilMask(0);
updateClipScissorTest();
}
}
@@ -954,16 +952,16 @@ void QOpenGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data,
Q_ASSERT(count || stops);
// qDebug("QOpenGL2PaintEngineExPrivate::fillStencilWithVertexArray()");
- glStencilMask(0xff); // Enable stencil writes
+ funcs.glStencilMask(0xff); // Enable stencil writes
if (dirtyStencilRegion.intersects(currentScissorBounds)) {
QVector<QRect> clearRegion = dirtyStencilRegion.intersected(currentScissorBounds).rects();
- glClearStencil(0); // Clear to zero
+ funcs.glClearStencil(0); // Clear to zero
for (int i = 0; i < clearRegion.size(); ++i) {
#ifndef QT_GL_NO_SCISSOR_TEST
setScissor(clearRegion.at(i));
#endif
- glClear(GL_STENCIL_BUFFER_BIT);
+ funcs.glClear(GL_STENCIL_BUFFER_BIT);
}
dirtyStencilRegion -= currentScissorBounds;
@@ -973,23 +971,23 @@ void QOpenGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data,
#endif
}
- glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); // Disable color writes
+ funcs.glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); // Disable color writes
useSimpleShader();
- glEnable(GL_STENCIL_TEST); // For some reason, this has to happen _after_ the simple shader is use()'d
+ funcs.glEnable(GL_STENCIL_TEST); // For some reason, this has to happen _after_ the simple shader is use()'d
if (mode == WindingFillMode) {
Q_ASSERT(stops && !count);
if (q->state()->clipTestEnabled) {
// Flatten clip values higher than current clip, and set high bit to match current clip
- glStencilFunc(GL_LEQUAL, GL_STENCIL_HIGH_BIT | q->state()->currentClip, ~GL_STENCIL_HIGH_BIT);
- glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
+ funcs.glStencilFunc(GL_LEQUAL, GL_STENCIL_HIGH_BIT | q->state()->currentClip, ~GL_STENCIL_HIGH_BIT);
+ funcs.glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
composite(bounds);
- glStencilFunc(GL_EQUAL, GL_STENCIL_HIGH_BIT, GL_STENCIL_HIGH_BIT);
+ funcs.glStencilFunc(GL_EQUAL, GL_STENCIL_HIGH_BIT, GL_STENCIL_HIGH_BIT);
} else if (!stencilClean) {
// Clear stencil buffer within bounding rect
- glStencilFunc(GL_ALWAYS, 0, 0xff);
- glStencilOp(GL_ZERO, GL_ZERO, GL_ZERO);
+ funcs.glStencilFunc(GL_ALWAYS, 0, 0xff);
+ funcs.glStencilOp(GL_ZERO, GL_ZERO, GL_ZERO);
composite(bounds);
}
@@ -997,44 +995,44 @@ void QOpenGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data,
funcs.glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_INCR_WRAP, GL_INCR_WRAP);
// Dec. for back-facing "holes"
funcs.glStencilOpSeparate(GL_BACK, GL_KEEP, GL_DECR_WRAP, GL_DECR_WRAP);
- glStencilMask(~GL_STENCIL_HIGH_BIT);
+ funcs.glStencilMask(~GL_STENCIL_HIGH_BIT);
drawVertexArrays(data, stops, stopCount, GL_TRIANGLE_FAN);
if (q->state()->clipTestEnabled) {
// Clear high bit of stencil outside of path
- glStencilFunc(GL_EQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT);
- glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
- glStencilMask(GL_STENCIL_HIGH_BIT);
+ funcs.glStencilFunc(GL_EQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT);
+ funcs.glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
+ funcs.glStencilMask(GL_STENCIL_HIGH_BIT);
composite(bounds);
}
} else if (mode == OddEvenFillMode) {
- glStencilMask(GL_STENCIL_HIGH_BIT);
- glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT); // Simply invert the stencil bit
+ funcs.glStencilMask(GL_STENCIL_HIGH_BIT);
+ funcs.glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT); // Simply invert the stencil bit
drawVertexArrays(data, stops, stopCount, GL_TRIANGLE_FAN);
} else { // TriStripStrokeFillMode
Q_ASSERT(count && !stops); // tristrips generated directly, so no vertexArray or stops
- glStencilMask(GL_STENCIL_HIGH_BIT);
+ funcs.glStencilMask(GL_STENCIL_HIGH_BIT);
#if 0
- glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT); // Simply invert the stencil bit
+ funcs.glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT); // Simply invert the stencil bit
setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, data);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, count);
+ funcs.glDrawArrays(GL_TRIANGLE_STRIP, 0, count);
#else
- glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
+ funcs.glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
if (q->state()->clipTestEnabled) {
- glStencilFunc(GL_LEQUAL, q->state()->currentClip | GL_STENCIL_HIGH_BIT,
- ~GL_STENCIL_HIGH_BIT);
+ funcs.glStencilFunc(GL_LEQUAL, q->state()->currentClip | GL_STENCIL_HIGH_BIT,
+ ~GL_STENCIL_HIGH_BIT);
} else {
- glStencilFunc(GL_ALWAYS, GL_STENCIL_HIGH_BIT, 0xff);
+ funcs.glStencilFunc(GL_ALWAYS, GL_STENCIL_HIGH_BIT, 0xff);
}
setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, data);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, count);
+ funcs.glDrawArrays(GL_TRIANGLE_STRIP, 0, count);
#endif
}
// Enable color writes & disable stencil writes
- glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+ funcs.glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
}
/*
@@ -1050,22 +1048,22 @@ void QOpenGL2PaintEngineExPrivate::resetClipIfNeeded()
Q_Q(QOpenGL2PaintEngineEx);
useSimpleShader();
- glEnable(GL_STENCIL_TEST);
- glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
+ funcs.glEnable(GL_STENCIL_TEST);
+ funcs.glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
QRectF bounds = q->state()->matrix.inverted().mapRect(QRectF(0, 0, width, height));
QOpenGLRect rect(bounds.left(), bounds.top(), bounds.right(), bounds.bottom());
// Set high bit on clip region
- glStencilFunc(GL_LEQUAL, q->state()->currentClip, 0xff);
- glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT);
- glStencilMask(GL_STENCIL_HIGH_BIT);
+ funcs.glStencilFunc(GL_LEQUAL, q->state()->currentClip, 0xff);
+ funcs.glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT);
+ funcs.glStencilMask(GL_STENCIL_HIGH_BIT);
composite(rect);
// Reset clipping to 1 and everything else to zero
- glStencilFunc(GL_NOTEQUAL, 0x01, GL_STENCIL_HIGH_BIT);
- glStencilOp(GL_ZERO, GL_REPLACE, GL_REPLACE);
- glStencilMask(0xff);
+ funcs.glStencilFunc(GL_NOTEQUAL, 0x01, GL_STENCIL_HIGH_BIT);
+ funcs.glStencilOp(GL_ZERO, GL_REPLACE, GL_REPLACE);
+ funcs.glStencilMask(0xff);
composite(rect);
q->state()->currentClip = 1;
@@ -1073,8 +1071,8 @@ void QOpenGL2PaintEngineExPrivate::resetClipIfNeeded()
maxClip = 1;
- glStencilMask(0x0);
- glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+ funcs.glStencilMask(0x0);
+ funcs.glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
}
bool QOpenGL2PaintEngineExPrivate::prepareForCachedGlyphDraw(const QFontEngineGlyphCache &cache)
@@ -1107,9 +1105,9 @@ bool QOpenGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque)
|| (q->state()->composition_mode == QPainter::CompositionMode_SourceOver
&& srcPixelsAreOpaque && !stateHasOpacity))
{
- glDisable(GL_BLEND);
+ funcs.glDisable(GL_BLEND);
} else {
- glEnable(GL_BLEND);
+ funcs.glEnable(GL_BLEND);
}
QOpenGLEngineShaderManager::OpacityMode opacityMode;
@@ -1159,7 +1157,7 @@ void QOpenGL2PaintEngineExPrivate::composite(const QOpenGLRect& boundingRect)
{
setCoords(staticVertexCoordinateArray, boundingRect);
setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, staticVertexCoordinateArray);
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+ funcs.glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
// Draws the vertex array as a set of <vertexArrayStops.size()> triangle fans.
@@ -1177,7 +1175,7 @@ void QOpenGL2PaintEngineExPrivate::drawVertexArrays(const float *data, int *stop
for (int i=previousStop; i<stop; ++i)
qDebug(" %02d: [%.2f, %.2f]", i, vertexArray.data()[i].x, vertexArray.data()[i].y);
*/
- glDrawArrays(primitive, previousStop, stop - previousStop);
+ funcs.glDrawArrays(primitive, previousStop, stop - previousStop);
previousStop = stop;
}
}
@@ -1269,7 +1267,7 @@ void QOpenGL2PaintEngineExPrivate::stroke(const QVectorPath &path, const QPen &p
if (opaque) {
prepareForDraw(opaque);
setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, stroker.vertices());
- glDrawArrays(GL_TRIANGLE_STRIP, 0, stroker.vertexCount() / 2);
+ funcs.glDrawArrays(GL_TRIANGLE_STRIP, 0, stroker.vertexCount() / 2);
// QBrush b(Qt::green);
// d->setBrush(&b);
@@ -1292,16 +1290,16 @@ void QOpenGL2PaintEngineExPrivate::stroke(const QVectorPath &path, const QPen &p
fillStencilWithVertexArray(stroker.vertices(), stroker.vertexCount() / 2,
0, 0, bounds, QOpenGL2PaintEngineExPrivate::TriStripStrokeFillMode);
- glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
+ funcs.glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
// Pass when any bit is set, replace stencil value with 0
- glStencilFunc(GL_NOTEQUAL, 0, GL_STENCIL_HIGH_BIT);
+ funcs.glStencilFunc(GL_NOTEQUAL, 0, GL_STENCIL_HIGH_BIT);
prepareForDraw(false);
// Stencil the brush onto the dest buffer
composite(bounds);
- glStencilMask(0);
+ funcs.glStencilMask(0);
updateClipScissorTest();
}
@@ -1335,12 +1333,13 @@ void QOpenGL2PaintEngineEx::renderHintsChanged()
state()->renderHintsChanged = true;
#ifndef QT_OPENGL_ES_2
- if (!QOpenGLFunctions::isES()) {
+ if (!QOpenGLContext::currentContext()->isES()) {
+ Q_D(QOpenGL2PaintEngineEx);
if ((state()->renderHints & QPainter::Antialiasing)
|| (state()->renderHints & QPainter::HighQualityAntialiasing))
- glEnable(GL_MULTISAMPLE);
+ d->funcs.glEnable(GL_MULTISAMPLE);
else
- glDisable(GL_MULTISAMPLE);
+ d->funcs.glDisable(GL_MULTISAMPLE);
}
#endif // QT_OPENGL_ES_2
@@ -1461,7 +1460,7 @@ bool QOpenGL2PaintEngineEx::drawTexture(const QRectF &dest, GLuint textureId, co
d->transferMode(ImageDrawingMode);
d->funcs.glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
- glBindTexture(GL_TEXTURE_2D, textureId);
+ d->funcs.glBindTexture(GL_TEXTURE_2D, textureId);
QOpenGLRect srcRect(src.left(), src.bottom(), src.right(), src.top());
@@ -1720,15 +1719,15 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat gly
#if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO)
if (elementIndicesVBOId == 0)
- glGenBuffers(1, &elementIndicesVBOId);
+ funcs.glGenBuffers(1, &elementIndicesVBOId);
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementIndicesVBOId);
- glBufferData(GL_ELEMENT_ARRAY_BUFFER, elementIndices.size() * sizeof(GLushort),
- elementIndices.constData(), GL_STATIC_DRAW);
+ funcs.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementIndicesVBOId);
+ funcs.glBufferData(GL_ELEMENT_ARRAY_BUFFER, elementIndices.size() * sizeof(GLushort),
+ elementIndices.constData(), GL_STATIC_DRAW);
#endif
} else {
#if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO)
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementIndicesVBOId);
+ funcs.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementIndicesVBOId);
#endif
}
@@ -1774,8 +1773,8 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat gly
opacityUniformDirty = true;
}
- glEnable(GL_BLEND);
- glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_SRC_COLOR);
+ funcs.glEnable(GL_BLEND);
+ funcs.glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_SRC_COLOR);
funcs.glBlendColor(c.redF(), c.greenF(), c.blueF(), c.alphaF());
} else {
// Other brush styles need two passes.
@@ -1790,17 +1789,17 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat gly
compositionModeDirty = false; // I can handle this myself, thank you very much
prepareForCachedGlyphDraw(*cache);
- glEnable(GL_BLEND);
- glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
+ funcs.glEnable(GL_BLEND);
+ funcs.glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
funcs.glActiveTexture(GL_TEXTURE0 + QT_MASK_TEXTURE_UNIT);
- glBindTexture(GL_TEXTURE_2D, cache->texture());
+ funcs.glBindTexture(GL_TEXTURE_2D, cache->texture());
updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, false);
#if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO)
- glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0);
+ funcs.glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0);
#else
- glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data());
+ funcs.glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data());
#endif
shaderManager->setMaskType(QOpenGLEngineShaderManager::SubPixelMaskPass2);
@@ -1814,8 +1813,8 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat gly
compositionModeDirty = false;
prepareForCachedGlyphDraw(*cache);
- glEnable(GL_BLEND);
- glBlendFunc(GL_ONE, GL_ONE);
+ funcs.glEnable(GL_BLEND);
+ funcs.glBlendFunc(GL_ONE, GL_ONE);
}
compositionModeDirty = true;
} else if (glyphFormat == QFontEngine::Format_ARGB) {
@@ -1839,27 +1838,27 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat gly
funcs.glActiveTexture(GL_TEXTURE0 + QT_MASK_TEXTURE_UNIT);
if (lastMaskTextureUsed != cache->texture()) {
- glBindTexture(GL_TEXTURE_2D, cache->texture());
+ funcs.glBindTexture(GL_TEXTURE_2D, cache->texture());
lastMaskTextureUsed = cache->texture();
}
if (cache->filterMode() != filterMode) {
if (filterMode == QOpenGLTextureGlyphCache::Linear) {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ funcs.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ funcs.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
} else {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ funcs.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ funcs.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
cache->setFilterMode(filterMode);
}
}
#if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO)
- glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0);
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
+ funcs.glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0);
+ funcs.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
#else
- glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data());
+ funcs.glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data());
#endif
}
@@ -1960,7 +1959,7 @@ void QOpenGL2PaintEngineExPrivate::drawPixmapFragments(const QPainter::PixmapFra
shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::PatternColor), col);
}
- glDrawArrays(GL_TRIANGLES, 0, 6 * fragmentCount);
+ funcs.glDrawArrays(GL_TRIANGLES, 0, 6 * fragmentCount);
}
bool QOpenGL2PaintEngineEx::begin(QPaintDevice *pdev)
@@ -2005,15 +2004,15 @@ bool QOpenGL2PaintEngineEx::begin(QPaintDevice *pdev)
d->shaderManager = new QOpenGLEngineShaderManager(d->ctx);
- glDisable(GL_STENCIL_TEST);
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_SCISSOR_TEST);
+ d->funcs.glDisable(GL_STENCIL_TEST);
+ d->funcs.glDisable(GL_DEPTH_TEST);
+ d->funcs.glDisable(GL_SCISSOR_TEST);
d->glyphCacheFormat = QFontEngine::Format_A8;
#ifndef QT_OPENGL_ES_2
- if (!QOpenGLFunctions::isES()) {
- glDisable(GL_MULTISAMPLE);
+ if (!QOpenGLContext::currentContext()->isES()) {
+ d->funcs.glDisable(GL_MULTISAMPLE);
d->glyphCacheFormat = QFontEngine::Format_A32;
d->multisamplingAlwaysEnabled = false;
} else
@@ -2071,7 +2070,7 @@ void QOpenGL2PaintEngineEx::ensureActive()
d->device->ensureActiveTarget();
d->transferMode(BrushDrawingMode);
- glViewport(0, 0, d->width, d->height);
+ d->funcs.glViewport(0, 0, d->width, d->height);
d->needsSync = false;
d->lastMaskTextureUsed = 0;
d->shaderManager->setDirty();
@@ -2086,11 +2085,11 @@ void QOpenGL2PaintEngineExPrivate::updateClipScissorTest()
{
Q_Q(QOpenGL2PaintEngineEx);
if (q->state()->clipTestEnabled) {
- glEnable(GL_STENCIL_TEST);
- glStencilFunc(GL_LEQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT);
+ funcs.glEnable(GL_STENCIL_TEST);
+ funcs.glStencilFunc(GL_LEQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT);
} else {
- glDisable(GL_STENCIL_TEST);
- glStencilFunc(GL_ALWAYS, 0, 0xff);
+ funcs.glDisable(GL_STENCIL_TEST);
+ funcs.glStencilFunc(GL_ALWAYS, 0, 0xff);
}
#ifdef QT_GL_NO_SCISSOR_TEST
@@ -2112,9 +2111,9 @@ void QOpenGL2PaintEngineExPrivate::updateClipScissorTest()
currentScissorBounds = bounds;
if (bounds == QRect(0, 0, width, height)) {
- glDisable(GL_SCISSOR_TEST);
+ funcs.glDisable(GL_SCISSOR_TEST);
} else {
- glEnable(GL_SCISSOR_TEST);
+ funcs.glEnable(GL_SCISSOR_TEST);
setScissor(bounds);
}
#endif
@@ -2130,7 +2129,7 @@ void QOpenGL2PaintEngineExPrivate::setScissor(const QRect &rect)
}
const int height = rect.height();
- glScissor(left, bottom, width, height);
+ funcs.glScissor(left, bottom, width, height);
}
void QOpenGL2PaintEngineEx::clipEnabledChanged()
@@ -2149,10 +2148,10 @@ void QOpenGL2PaintEngineExPrivate::clearClip(uint value)
{
dirtyStencilRegion -= currentScissorBounds;
- glStencilMask(0xff);
- glClearStencil(value);
- glClear(GL_STENCIL_BUFFER_BIT);
- glStencilMask(0x0);
+ funcs.glStencilMask(0xff);
+ funcs.glClearStencil(value);
+ funcs.glClear(GL_STENCIL_BUFFER_BIT);
+ funcs.glStencilMask(0x0);
q->state()->needsClipBufferClear = false;
}
@@ -2180,15 +2179,15 @@ void QOpenGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint value
clearClip(1);
if (path.isEmpty()) {
- glEnable(GL_STENCIL_TEST);
- glStencilFunc(GL_LEQUAL, value, ~GL_STENCIL_HIGH_BIT);
+ funcs.glEnable(GL_STENCIL_TEST);
+ funcs.glStencilFunc(GL_LEQUAL, value, ~GL_STENCIL_HIGH_BIT);
return;
}
if (q->state()->clipTestEnabled)
- glStencilFunc(GL_LEQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT);
+ funcs.glStencilFunc(GL_LEQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT);
else
- glStencilFunc(GL_ALWAYS, 0, 0xff);
+ funcs.glStencilFunc(GL_ALWAYS, 0, 0xff);
vertexCoordinateArray.clear();
vertexCoordinateArray.addPath(path, inverseScale, false);
@@ -2196,39 +2195,39 @@ void QOpenGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint value
if (!singlePass)
fillStencilWithVertexArray(vertexCoordinateArray, path.hasWindingFill());
- glColorMask(false, false, false, false);
- glEnable(GL_STENCIL_TEST);
+ funcs.glColorMask(false, false, false, false);
+ funcs.glEnable(GL_STENCIL_TEST);
useSimpleShader();
if (singlePass) {
// Under these conditions we can set the new stencil value in a single
// pass, by using the current value and the "new value" as the toggles
- glStencilFunc(GL_LEQUAL, referenceClipValue, ~GL_STENCIL_HIGH_BIT);
- glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT);
- glStencilMask(value ^ referenceClipValue);
+ funcs.glStencilFunc(GL_LEQUAL, referenceClipValue, ~GL_STENCIL_HIGH_BIT);
+ funcs.glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT);
+ funcs.glStencilMask(value ^ referenceClipValue);
drawVertexArrays(vertexCoordinateArray, GL_TRIANGLE_FAN);
} else {
- glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
- glStencilMask(0xff);
+ funcs.glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
+ funcs.glStencilMask(0xff);
if (!q->state()->clipTestEnabled && path.hasWindingFill()) {
// Pass when any clip bit is set, set high bit
- glStencilFunc(GL_NOTEQUAL, GL_STENCIL_HIGH_BIT, ~GL_STENCIL_HIGH_BIT);
+ funcs.glStencilFunc(GL_NOTEQUAL, GL_STENCIL_HIGH_BIT, ~GL_STENCIL_HIGH_BIT);
composite(vertexCoordinateArray.boundingRect());
}
// Pass when high bit is set, replace stencil value with new clip value
- glStencilFunc(GL_NOTEQUAL, value, GL_STENCIL_HIGH_BIT);
+ funcs.glStencilFunc(GL_NOTEQUAL, value, GL_STENCIL_HIGH_BIT);
composite(vertexCoordinateArray.boundingRect());
}
- glStencilFunc(GL_LEQUAL, value, ~GL_STENCIL_HIGH_BIT);
- glStencilMask(0);
+ funcs.glStencilFunc(GL_LEQUAL, value, ~GL_STENCIL_HIGH_BIT);
+ funcs.glStencilMask(0);
- glColorMask(true, true, true, true);
+ funcs.glColorMask(true, true, true, true);
}
void QOpenGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op)
@@ -2384,7 +2383,7 @@ void QOpenGL2PaintEngineEx::setState(QPainterState *new_state)
if (old_state == s || old_state->clipChanged) {
if (old_state && old_state != s && old_state->canRestoreClip) {
d->updateClipScissorTest();
- glDepthFunc(GL_LEQUAL);
+ d->funcs.glDepthFunc(GL_LEQUAL);
} else {
d->regenerateClip();
}
diff --git a/src/gui/opengl/qopenglproxy_win.cpp b/src/gui/opengl/qopenglproxy_win.cpp
deleted file mode 100644
index 88f3a1d11d..0000000000
--- a/src/gui/opengl/qopenglproxy_win.cpp
+++ /dev/null
@@ -1,4597 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtGui 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 Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QByteArray>
-#include <QVector>
-#include <QCoreApplication>
-#include <QLoggingCategory>
-#include <qt_windows.h>
-// Must not include QOpenGLFunctions or anything that pulls in qopengl.h.
-// Otherwise we end up with errors about inconsistent linkage.
-#include <GL/gl.h>
-#include <EGL/egl.h>
-
-#if defined(QT_OPENGL_ES) || defined(QT_OPENGL_ES_2)
-# error "Proxy GL is not compatible with static ES builds"
-#endif
-
-// This should not be an issue with the compilers used on Windows, but just in case:
-#ifndef Q_COMPILER_VARIADIC_MACROS
-# error "Proxy GL requires variadic macro support"
-#endif
-
-// Disable inconsistent dll linkage warnings. gl.h and egl.h are included and these mark
-// the egl and (w)gl functions as imported. We will mark them as exported.
-#if defined(Q_CC_MSVC)
-# pragma warning(disable : 4273)
-#elif defined(Q_CC_MINGW)
-# pragma GCC diagnostic ignored "-Wattributes"
-#endif
-
-#ifdef Q_OS_WIN64
-typedef signed long long int khronos_intptr_t;
-typedef signed long long int khronos_ssize_t;
-#else
-typedef signed long int khronos_intptr_t;
-typedef signed long int khronos_ssize_t;
-#endif
-
-typedef char GLchar;
-typedef khronos_intptr_t GLintptr;
-typedef khronos_ssize_t GLsizeiptr;
-
-Q_LOGGING_CATEGORY(qglLc, "qt.gui.openglproxy")
-
-class QAbstractWindowsOpenGL
-{
-public:
- QAbstractWindowsOpenGL();
- virtual ~QAbstractWindowsOpenGL() { }
-
- enum LibType { // must match QOpenGLFunctions::PlatformGLType
- DesktopGL = 0,
- GLES2
- };
-
- LibType libraryType() const { return m_libraryType; }
- HMODULE libraryHandle() const { return m_lib; }
- bool functionsReady() const { return m_loaded; }
-
- // WGL
- BOOL (WINAPI * CopyContext)(HGLRC src, HGLRC dst, UINT mask);
- HGLRC (WINAPI * CreateContext)(HDC dc);
- HGLRC (WINAPI * CreateLayerContext)(HDC dc, int plane);
- BOOL (WINAPI * DeleteContext)(HGLRC context);
- HGLRC (WINAPI * GetCurrentContext)();
- HDC (WINAPI * GetCurrentDC)();
- PROC (WINAPI * GetProcAddress)(LPCSTR name);
- BOOL (WINAPI * MakeCurrent)(HDC dc, HGLRC context);
- BOOL (WINAPI * ShareLists)(HGLRC context1, HGLRC context2);
- BOOL (WINAPI * UseFontBitmapsW)(HDC dc, DWORD first, DWORD count, DWORD base);
- BOOL (WINAPI * UseFontOutlinesW)(HDC dc, DWORD first, DWORD count, DWORD base, FLOAT deviation,
- FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT gmf);
- BOOL (WINAPI * DescribeLayerPlane)(HDC dc, int pixelFormat, int plane, UINT n,
- LPLAYERPLANEDESCRIPTOR planeDescriptor);
- int (WINAPI * SetLayerPaletteEntries)(HDC dc, int plane, int start, int entries,
- CONST COLORREF *colors);
- int (WINAPI * GetLayerPaletteEntries)(HDC dc, int plane, int start, int entries,
- COLORREF *color);
- BOOL (WINAPI * RealizeLayerPalette)(HDC dc, int plane, BOOL realize);
- BOOL (WINAPI * SwapLayerBuffers)(HDC dc, UINT planes);
- DWORD (WINAPI * SwapMultipleBuffers)(UINT n, CONST WGLSWAP *buffers);
-
- // EGL
- EGLint (EGLAPIENTRY * EGL_GetError)(void);
- EGLDisplay (EGLAPIENTRY * EGL_GetDisplay)(EGLNativeDisplayType display_id);
- EGLBoolean (EGLAPIENTRY * EGL_Initialize)(EGLDisplay dpy, EGLint *major, EGLint *minor);
- EGLBoolean (EGLAPIENTRY * EGL_Terminate)(EGLDisplay dpy);
- const char * (EGLAPIENTRY * EGL_QueryString)(EGLDisplay dpy, EGLint name);
- EGLBoolean (EGLAPIENTRY * EGL_GetConfigs)(EGLDisplay dpy, EGLConfig *configs,
- EGLint config_size, EGLint *num_config);
- EGLBoolean (EGLAPIENTRY * EGL_ChooseConfig)(EGLDisplay dpy, const EGLint *attrib_list,
- EGLConfig *configs, EGLint config_size,
- EGLint *num_config);
- EGLBoolean (EGLAPIENTRY * EGL_GetConfigAttrib)(EGLDisplay dpy, EGLConfig config,
- EGLint attribute, EGLint *value);
- EGLSurface (EGLAPIENTRY * EGL_CreateWindowSurface)(EGLDisplay dpy, EGLConfig config,
- EGLNativeWindowType win,
- const EGLint *attrib_list);
- EGLSurface (EGLAPIENTRY * EGL_CreatePbufferSurface)(EGLDisplay dpy, EGLConfig config,
- const EGLint *attrib_list);
- EGLSurface (EGLAPIENTRY * EGL_CreatePixmapSurface)(EGLDisplay dpy, EGLConfig config,
- EGLNativePixmapType pixmap,
- const EGLint *attrib_list);
- EGLBoolean (EGLAPIENTRY * EGL_DestroySurface)(EGLDisplay dpy, EGLSurface surface);
- EGLBoolean (EGLAPIENTRY * EGL_QuerySurface)(EGLDisplay dpy, EGLSurface surface,
- EGLint attribute, EGLint *value);
- EGLBoolean (EGLAPIENTRY * EGL_BindAPI)(EGLenum api);
- EGLenum (EGLAPIENTRY * EGL_QueryAPI)(void);
- EGLBoolean (EGLAPIENTRY * EGL_WaitClient)(void);
- EGLBoolean (EGLAPIENTRY * EGL_ReleaseThread)(void);
- EGLSurface (EGLAPIENTRY * EGL_CreatePbufferFromClientBuffer)(EGLDisplay dpy, EGLenum buftype,
- EGLClientBuffer buffer,
- EGLConfig config, const EGLint *attrib_list);
- EGLBoolean (EGLAPIENTRY * EGL_SurfaceAttrib)(EGLDisplay dpy, EGLSurface surface,
- EGLint attribute, EGLint value);
- EGLBoolean (EGLAPIENTRY * EGL_BindTexImage)(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
- EGLBoolean (EGLAPIENTRY * EGL_ReleaseTexImage)(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
- EGLBoolean (EGLAPIENTRY * EGL_SwapInterval)(EGLDisplay dpy, EGLint interval);
- EGLContext (EGLAPIENTRY * EGL_CreateContext)(EGLDisplay dpy, EGLConfig config,
- EGLContext share_context,
- const EGLint *attrib_list);
- EGLBoolean (EGLAPIENTRY * EGL_DestroyContext)(EGLDisplay dpy, EGLContext ctx);
- EGLBoolean (EGLAPIENTRY * EGL_MakeCurrent)(EGLDisplay dpy, EGLSurface draw,
- EGLSurface read, EGLContext ctx);
- EGLContext (EGLAPIENTRY * EGL_GetCurrentContext)(void);
- EGLSurface (EGLAPIENTRY * EGL_GetCurrentSurface)(EGLint readdraw);
- EGLDisplay (EGLAPIENTRY * EGL_GetCurrentDisplay)(void);
- EGLBoolean (EGLAPIENTRY * EGL_QueryContext)(EGLDisplay dpy, EGLContext ctx,
- EGLint attribute, EGLint *value);
- EGLBoolean (EGLAPIENTRY * EGL_WaitGL)(void);
- EGLBoolean (EGLAPIENTRY * EGL_WaitNative)(EGLint engine);
- EGLBoolean (EGLAPIENTRY * EGL_SwapBuffers)(EGLDisplay dpy, EGLSurface surface);
- EGLBoolean (EGLAPIENTRY * EGL_CopyBuffers)(EGLDisplay dpy, EGLSurface surface,
- EGLNativePixmapType target);
- __eglMustCastToProperFunctionPointerType (EGLAPIENTRY * EGL_GetProcAddress)(const char *procname);
-
- // OpenGL 1.0
- void (APIENTRY * Viewport)(GLint x, GLint y, GLsizei width, GLsizei height);
- void (APIENTRY * DepthRange)(GLdouble nearVal, GLdouble farVal);
- GLboolean (APIENTRY * IsEnabled)(GLenum cap);
- void (APIENTRY * GetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint *params);
- void (APIENTRY * GetTexLevelParameterfv)(GLenum target, GLint level, GLenum pname, GLfloat *params);
- void (APIENTRY * GetTexParameteriv)(GLenum target, GLenum pname, GLint *params);
- void (APIENTRY * GetTexParameterfv)(GLenum target, GLenum pname, GLfloat *params);
- void (APIENTRY * GetTexImage)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
- const GLubyte * (APIENTRY * GetString)(GLenum name);
- void (APIENTRY * GetIntegerv)(GLenum pname, GLint *params);
- void (APIENTRY * GetFloatv)(GLenum pname, GLfloat *params);
- GLenum (APIENTRY * GetError)();
- void (APIENTRY * GetDoublev)(GLenum pname, GLdouble *params);
- void (APIENTRY * GetBooleanv)(GLenum pname, GLboolean *params);
- void (APIENTRY * ReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
- void (APIENTRY * ReadBuffer)(GLenum mode);
- void (APIENTRY * PixelStorei)(GLenum pname, GLint param);
- void (APIENTRY * PixelStoref)(GLenum pname, GLfloat param);
- void (APIENTRY * DepthFunc)(GLenum func);
- void (APIENTRY * StencilOp)(GLenum fail, GLenum zfail, GLenum zpass);
- void (APIENTRY * StencilFunc)(GLenum func, GLint ref, GLuint mask);
- void (APIENTRY * LogicOp)(GLenum opcode);
- void (APIENTRY * BlendFunc)(GLenum sfactor, GLenum dfactor);
- void (APIENTRY * Flush)();
- void (APIENTRY * Finish)();
- void (APIENTRY * Enable)(GLenum cap);
- void (APIENTRY * Disable)(GLenum cap);
- void (APIENTRY * DepthMask)(GLboolean flag);
- void (APIENTRY * ColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void (APIENTRY * StencilMask)(GLuint mask);
- void (APIENTRY * ClearDepth)(GLdouble depth);
- void (APIENTRY * ClearStencil)(GLint s);
- void (APIENTRY * ClearColor)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void (APIENTRY * Clear)(GLbitfield mask);
- void (APIENTRY * DrawBuffer)(GLenum mode);
- void (APIENTRY * TexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void (APIENTRY * TexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
- void (APIENTRY * TexParameteriv)(GLenum target, GLenum pname, const GLint *params);
- void (APIENTRY * TexParameteri)(GLenum target, GLenum pname, GLint param);
- void (APIENTRY * TexParameterfv)(GLenum target, GLenum pname, const GLfloat *params);
- void (APIENTRY * TexParameterf)(GLenum target, GLenum pname, GLfloat param);
- void (APIENTRY * Scissor)(GLint x, GLint y, GLsizei width, GLsizei height);
- void (APIENTRY * PolygonMode)(GLenum face, GLenum mode);
- void (APIENTRY * PointSize)(GLfloat size);
- void (APIENTRY * LineWidth)(GLfloat width);
- void (APIENTRY * Hint)(GLenum target, GLenum mode);
- void (APIENTRY * FrontFace)(GLenum mode);
- void (APIENTRY * CullFace)(GLenum mode);
-
- void (APIENTRY * Translatef)(GLfloat x, GLfloat y, GLfloat z);
- void (APIENTRY * Translated)(GLdouble x, GLdouble y, GLdouble z);
- void (APIENTRY * Scalef)(GLfloat x, GLfloat y, GLfloat z);
- void (APIENTRY * Scaled)(GLdouble x, GLdouble y, GLdouble z);
- void (APIENTRY * Rotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
- void (APIENTRY * Rotated)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
- void (APIENTRY * PushMatrix)();
- void (APIENTRY * PopMatrix)();
- void (APIENTRY * Ortho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- void (APIENTRY * MultMatrixd)(const GLdouble *m);
- void (APIENTRY * MultMatrixf)(const GLfloat *m);
- void (APIENTRY * MatrixMode)(GLenum mode);
- void (APIENTRY * LoadMatrixd)(const GLdouble *m);
- void (APIENTRY * LoadMatrixf)(const GLfloat *m);
- void (APIENTRY * LoadIdentity)();
- void (APIENTRY * Frustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
- GLboolean (APIENTRY * IsList)(GLuint list);
- void (APIENTRY * GetTexGeniv)(GLenum coord, GLenum pname, GLint *params);
- void (APIENTRY * GetTexGenfv)(GLenum coord, GLenum pname, GLfloat *params);
- void (APIENTRY * GetTexGendv)(GLenum coord, GLenum pname, GLdouble *params);
- void (APIENTRY * GetTexEnviv)(GLenum target, GLenum pname, GLint *params);
- void (APIENTRY * GetTexEnvfv)(GLenum target, GLenum pname, GLfloat *params);
- void (APIENTRY * GetPolygonStipple)(GLubyte *mask);
- void (APIENTRY * GetPixelMapusv)(GLenum map, GLushort *values);
- void (APIENTRY * GetPixelMapuiv)(GLenum map, GLuint *values);
- void (APIENTRY * GetPixelMapfv)(GLenum map, GLfloat *values);
- void (APIENTRY * GetMaterialiv)(GLenum face, GLenum pname, GLint *params);
- void (APIENTRY * GetMaterialfv)(GLenum face, GLenum pname, GLfloat *params);
- void (APIENTRY * GetMapiv)(GLenum target, GLenum query, GLint *v);
- void (APIENTRY * GetMapfv)(GLenum target, GLenum query, GLfloat *v);
- void (APIENTRY * GetMapdv)(GLenum target, GLenum query, GLdouble *v);
- void (APIENTRY * GetLightiv)(GLenum light, GLenum pname, GLint *params);
- void (APIENTRY * GetLightfv)(GLenum light, GLenum pname, GLfloat *params);
- void (APIENTRY * GetClipPlane)(GLenum plane, GLdouble *equation);
- void (APIENTRY * DrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void (APIENTRY * CopyPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
- void (APIENTRY * PixelMapusv)(GLenum map, GLint mapsize, const GLushort *values);
- void (APIENTRY * PixelMapuiv)(GLenum map, GLint mapsize, const GLuint *values);
- void (APIENTRY * PixelMapfv)(GLenum map, GLint mapsize, const GLfloat *values);
- void (APIENTRY * PixelTransferi)(GLenum pname, GLint param);
- void (APIENTRY * PixelTransferf)(GLenum pname, GLfloat param);
- void (APIENTRY * PixelZoom)(GLfloat xfactor, GLfloat yfactor);
- void (APIENTRY * AlphaFunc)(GLenum func, GLfloat ref);
- void (APIENTRY * EvalPoint2)(GLint i, GLint j);
- void (APIENTRY * EvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
- void (APIENTRY * EvalPoint1)(GLint i);
- void (APIENTRY * EvalMesh1)(GLenum mode, GLint i1, GLint i2);
- void (APIENTRY * EvalCoord2fv)(const GLfloat *u);
- void (APIENTRY * EvalCoord2f)(GLfloat u, GLfloat v);
- void (APIENTRY * EvalCoord2dv)(const GLdouble *u);
- void (APIENTRY * EvalCoord2d)(GLdouble u, GLdouble v);
- void (APIENTRY * EvalCoord1fv)(const GLfloat *u);
- void (APIENTRY * EvalCoord1f)(GLfloat u);
- void (APIENTRY * EvalCoord1dv)(const GLdouble *u);
- void (APIENTRY * EvalCoord1d)(GLdouble u);
- void (APIENTRY * MapGrid2f)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
- void (APIENTRY * MapGrid2d)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
- void (APIENTRY * MapGrid1f)(GLint un, GLfloat u1, GLfloat u2);
- void (APIENTRY * MapGrid1d)(GLint un, GLdouble u1, GLdouble u2);
- void (APIENTRY * Map2f)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
- void (APIENTRY * Map2d)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
- void (APIENTRY * Map1f)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
- void (APIENTRY * Map1d)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
- void (APIENTRY * PushAttrib)(GLbitfield mask);
- void (APIENTRY * PopAttrib)();
- void (APIENTRY * Accum)(GLenum op, GLfloat value);
- void (APIENTRY * IndexMask)(GLuint mask);
- void (APIENTRY * ClearIndex)(GLfloat c);
- void (APIENTRY * ClearAccum)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void (APIENTRY * PushName)(GLuint name);
- void (APIENTRY * PopName)();
- void (APIENTRY * PassThrough)(GLfloat token);
- void (APIENTRY * LoadName)(GLuint name);
- void (APIENTRY * InitNames)();
- GLint (APIENTRY * RenderMode)(GLenum mode);
- void (APIENTRY * SelectBuffer)(GLsizei size, GLuint *buffer);
- void (APIENTRY * FeedbackBuffer)(GLsizei size, GLenum type, GLfloat *buffer);
- void (APIENTRY * TexGeniv)(GLenum coord, GLenum pname, const GLint *params);
- void (APIENTRY * TexGeni)(GLenum coord, GLenum pname, GLint param);
- void (APIENTRY * TexGenfv)(GLenum coord, GLenum pname, const GLfloat *params);
- void (APIENTRY * TexGenf)(GLenum coord, GLenum pname, GLfloat param);
- void (APIENTRY * TexGendv)(GLenum coord, GLenum pname, const GLdouble *params);
- void (APIENTRY * TexGend)(GLenum coord, GLenum pname, GLdouble param);
- void (APIENTRY * TexEnviv)(GLenum target, GLenum pname, const GLint *params);
- void (APIENTRY * TexEnvi)(GLenum target, GLenum pname, GLint param);
- void (APIENTRY * TexEnvfv)(GLenum target, GLenum pname, const GLfloat *params);
- void (APIENTRY * TexEnvf)(GLenum target, GLenum pname, GLfloat param);
- void (APIENTRY * ShadeModel)(GLenum mode);
- void (APIENTRY * PolygonStipple)(const GLubyte *mask);
- void (APIENTRY * Materialiv)(GLenum face, GLenum pname, const GLint *params);
- void (APIENTRY * Materiali)(GLenum face, GLenum pname, GLint param);
- void (APIENTRY * Materialfv)(GLenum face, GLenum pname, const GLfloat *params);
- void (APIENTRY * Materialf)(GLenum face, GLenum pname, GLfloat param);
- void (APIENTRY * LineStipple)(GLint factor, GLushort pattern);
- void (APIENTRY * LightModeliv)(GLenum pname, const GLint *params);
- void (APIENTRY * LightModeli)(GLenum pname, GLint param);
- void (APIENTRY * LightModelfv)(GLenum pname, const GLfloat *params);
- void (APIENTRY * LightModelf)(GLenum pname, GLfloat param);
- void (APIENTRY * Lightiv)(GLenum light, GLenum pname, const GLint *params);
- void (APIENTRY * Lighti)(GLenum light, GLenum pname, GLint param);
- void (APIENTRY * Lightfv)(GLenum light, GLenum pname, const GLfloat *params);
- void (APIENTRY * Lightf)(GLenum light, GLenum pname, GLfloat param);
- void (APIENTRY * Fogiv)(GLenum pname, const GLint *params);
- void (APIENTRY * Fogi)(GLenum pname, GLint param);
- void (APIENTRY * Fogfv)(GLenum pname, const GLfloat *params);
- void (APIENTRY * Fogf)(GLenum pname, GLfloat param);
- void (APIENTRY * ColorMaterial)(GLenum face, GLenum mode);
- void (APIENTRY * ClipPlane)(GLenum plane, const GLdouble *equation);
- void (APIENTRY * Vertex4sv)(const GLshort *v);
- void (APIENTRY * Vertex4s)(GLshort x, GLshort y, GLshort z, GLshort w);
- void (APIENTRY * Vertex4iv)(const GLint *v);
- void (APIENTRY * Vertex4i)(GLint x, GLint y, GLint z, GLint w);
- void (APIENTRY * Vertex4fv)(const GLfloat *v);
- void (APIENTRY * Vertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void (APIENTRY * Vertex4dv)(const GLdouble *v);
- void (APIENTRY * Vertex4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void (APIENTRY * Vertex3sv)(const GLshort *v);
- void (APIENTRY * Vertex3s)(GLshort x, GLshort y, GLshort z);
- void (APIENTRY * Vertex3iv)(const GLint *v);
- void (APIENTRY * Vertex3i)(GLint x, GLint y, GLint z);
- void (APIENTRY * Vertex3fv)(const GLfloat *v);
- void (APIENTRY * Vertex3f)(GLfloat x, GLfloat y, GLfloat z);
- void (APIENTRY * Vertex3dv)(const GLdouble *v);
- void (APIENTRY * Vertex3d)(GLdouble x, GLdouble y, GLdouble z);
- void (APIENTRY * Vertex2sv)(const GLshort *v);
- void (APIENTRY * Vertex2s)(GLshort x, GLshort y);
- void (APIENTRY * Vertex2iv)(const GLint *v);
- void (APIENTRY * Vertex2i)(GLint x, GLint y);
- void (APIENTRY * Vertex2fv)(const GLfloat *v);
- void (APIENTRY * Vertex2f)(GLfloat x, GLfloat y);
- void (APIENTRY * Vertex2dv)(const GLdouble *v);
- void (APIENTRY * Vertex2d)(GLdouble x, GLdouble y);
- void (APIENTRY * TexCoord4sv)(const GLshort *v);
- void (APIENTRY * TexCoord4s)(GLshort s, GLshort t, GLshort r, GLshort q);
- void (APIENTRY * TexCoord4iv)(const GLint *v);
- void (APIENTRY * TexCoord4i)(GLint s, GLint t, GLint r, GLint q);
- void (APIENTRY * TexCoord4fv)(const GLfloat *v);
- void (APIENTRY * TexCoord4f)(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
- void (APIENTRY * TexCoord4dv)(const GLdouble *v);
- void (APIENTRY * TexCoord4d)(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
- void (APIENTRY * TexCoord3sv)(const GLshort *v);
- void (APIENTRY * TexCoord3s)(GLshort s, GLshort t, GLshort r);
- void (APIENTRY * TexCoord3iv)(const GLint *v);
- void (APIENTRY * TexCoord3i)(GLint s, GLint t, GLint r);
- void (APIENTRY * TexCoord3fv)(const GLfloat *v);
- void (APIENTRY * TexCoord3f)(GLfloat s, GLfloat t, GLfloat r);
- void (APIENTRY * TexCoord3dv)(const GLdouble *v);
- void (APIENTRY * TexCoord3d)(GLdouble s, GLdouble t, GLdouble r);
- void (APIENTRY * TexCoord2sv)(const GLshort *v);
- void (APIENTRY * TexCoord2s)(GLshort s, GLshort t);
- void (APIENTRY * TexCoord2iv)(const GLint *v);
- void (APIENTRY * TexCoord2i)(GLint s, GLint t);
- void (APIENTRY * TexCoord2fv)(const GLfloat *v);
- void (APIENTRY * TexCoord2f)(GLfloat s, GLfloat t);
- void (APIENTRY * TexCoord2dv)(const GLdouble *v);
- void (APIENTRY * TexCoord2d)(GLdouble s, GLdouble t);
- void (APIENTRY * TexCoord1sv)(const GLshort *v);
- void (APIENTRY * TexCoord1s)(GLshort s);
- void (APIENTRY * TexCoord1iv)(const GLint *v);
- void (APIENTRY * TexCoord1i)(GLint s);
- void (APIENTRY * TexCoord1fv)(const GLfloat *v);
- void (APIENTRY * TexCoord1f)(GLfloat s);
- void (APIENTRY * TexCoord1dv)(const GLdouble *v);
- void (APIENTRY * TexCoord1d)(GLdouble s);
- void (APIENTRY * Rectsv)(const GLshort *v1, const GLshort *v2);
- void (APIENTRY * Rects)(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
- void (APIENTRY * Rectiv)(const GLint *v1, const GLint *v2);
- void (APIENTRY * Recti)(GLint x1, GLint y1, GLint x2, GLint y2);
- void (APIENTRY * Rectfv)(const GLfloat *v1, const GLfloat *v2);
- void (APIENTRY * Rectf)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
- void (APIENTRY * Rectdv)(const GLdouble *v1, const GLdouble *v2);
- void (APIENTRY * Rectd)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
- void (APIENTRY * RasterPos4sv)(const GLshort *v);
- void (APIENTRY * RasterPos4s)(GLshort x, GLshort y, GLshort z, GLshort w);
- void (APIENTRY * RasterPos4iv)(const GLint *v);
- void (APIENTRY * RasterPos4i)(GLint x, GLint y, GLint z, GLint w);
- void (APIENTRY * RasterPos4fv)(const GLfloat *v);
- void (APIENTRY * RasterPos4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void (APIENTRY * RasterPos4dv)(const GLdouble *v);
- void (APIENTRY * RasterPos4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
- void (APIENTRY * RasterPos3sv)(const GLshort *v);
- void (APIENTRY * RasterPos3s)(GLshort x, GLshort y, GLshort z);
- void (APIENTRY * RasterPos3iv)(const GLint *v);
- void (APIENTRY * RasterPos3i)(GLint x, GLint y, GLint z);
- void (APIENTRY * RasterPos3fv)(const GLfloat *v);
- void (APIENTRY * RasterPos3f)(GLfloat x, GLfloat y, GLfloat z);
- void (APIENTRY * RasterPos3dv)(const GLdouble *v);
- void (APIENTRY * RasterPos3d)(GLdouble x, GLdouble y, GLdouble z);
- void (APIENTRY * RasterPos2sv)(const GLshort *v);
- void (APIENTRY * RasterPos2s)(GLshort x, GLshort y);
- void (APIENTRY * RasterPos2iv)(const GLint *v);
- void (APIENTRY * RasterPos2i)(GLint x, GLint y);
- void (APIENTRY * RasterPos2fv)(const GLfloat *v);
- void (APIENTRY * RasterPos2f)(GLfloat x, GLfloat y);
- void (APIENTRY * RasterPos2dv)(const GLdouble *v);
- void (APIENTRY * RasterPos2d)(GLdouble x, GLdouble y);
- void (APIENTRY * Normal3sv)(const GLshort *v);
- void (APIENTRY * Normal3s)(GLshort nx, GLshort ny, GLshort nz);
- void (APIENTRY * Normal3iv)(const GLint *v);
- void (APIENTRY * Normal3i)(GLint nx, GLint ny, GLint nz);
- void (APIENTRY * Normal3fv)(const GLfloat *v);
- void (APIENTRY * Normal3f)(GLfloat nx, GLfloat ny, GLfloat nz);
- void (APIENTRY * Normal3dv)(const GLdouble *v);
- void (APIENTRY * Normal3d)(GLdouble nx, GLdouble ny, GLdouble nz);
- void (APIENTRY * Normal3bv)(const GLbyte *v);
- void (APIENTRY * Normal3b)(GLbyte nx, GLbyte ny, GLbyte nz);
- void (APIENTRY * Indexsv)(const GLshort *c);
- void (APIENTRY * Indexs)(GLshort c);
- void (APIENTRY * Indexiv)(const GLint *c);
- void (APIENTRY * Indexi)(GLint c);
- void (APIENTRY * Indexfv)(const GLfloat *c);
- void (APIENTRY * Indexf)(GLfloat c);
- void (APIENTRY * Indexdv)(const GLdouble *c);
- void (APIENTRY * Indexd)(GLdouble c);
- void (APIENTRY * End)();
- void (APIENTRY * EdgeFlagv)(const GLboolean *flag);
- void (APIENTRY * EdgeFlag)(GLboolean flag);
- void (APIENTRY * Color4usv)(const GLushort *v);
- void (APIENTRY * Color4us)(GLushort red, GLushort green, GLushort blue, GLushort alpha);
- void (APIENTRY * Color4uiv)(const GLuint *v);
- void (APIENTRY * Color4ui)(GLuint red, GLuint green, GLuint blue, GLuint alpha);
- void (APIENTRY * Color4ubv)(const GLubyte *v);
- void (APIENTRY * Color4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
- void (APIENTRY * Color4sv)(const GLshort *v);
- void (APIENTRY * Color4s)(GLshort red, GLshort green, GLshort blue, GLshort alpha);
- void (APIENTRY * Color4iv)(const GLint *v);
- void (APIENTRY * Color4i)(GLint red, GLint green, GLint blue, GLint alpha);
- void (APIENTRY * Color4fv)(const GLfloat *v);
- void (APIENTRY * Color4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
- void (APIENTRY * Color4dv)(const GLdouble *v);
- void (APIENTRY * Color4d)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
- void (APIENTRY * Color4bv)(const GLbyte *v);
- void (APIENTRY * Color4b)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
- void (APIENTRY * Color3usv)(const GLushort *v);
- void (APIENTRY * Color3us)(GLushort red, GLushort green, GLushort blue);
- void (APIENTRY * Color3uiv)(const GLuint *v);
- void (APIENTRY * Color3ui)(GLuint red, GLuint green, GLuint blue);
- void (APIENTRY * Color3ubv)(const GLubyte *v);
- void (APIENTRY * Color3ub)(GLubyte red, GLubyte green, GLubyte blue);
- void (APIENTRY * Color3sv)(const GLshort *v);
- void (APIENTRY * Color3s)(GLshort red, GLshort green, GLshort blue);
- void (APIENTRY * Color3iv)(const GLint *v);
- void (APIENTRY * Color3i)(GLint red, GLint green, GLint blue);
- void (APIENTRY * Color3fv)(const GLfloat *v);
- void (APIENTRY * Color3f)(GLfloat red, GLfloat green, GLfloat blue);
- void (APIENTRY * Color3dv)(const GLdouble *v);
- void (APIENTRY * Color3d)(GLdouble red, GLdouble green, GLdouble blue);
- void (APIENTRY * Color3bv)(const GLbyte *v);
- void (APIENTRY * Color3b)(GLbyte red, GLbyte green, GLbyte blue);
- void (APIENTRY * Bitmap)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
- void (APIENTRY * Begin)(GLenum mode);
- void (APIENTRY * ListBase)(GLuint base);
- GLuint (APIENTRY * GenLists)(GLsizei range);
- void (APIENTRY * DeleteLists)(GLuint list, GLsizei range);
- void (APIENTRY * CallLists)(GLsizei n, GLenum type, const GLvoid *lists);
- void (APIENTRY * CallList)(GLuint list);
- void (APIENTRY * EndList)();
- void (APIENTRY * NewList)(GLuint list, GLenum mode);
-
- // OpenGL 1.1
- void (APIENTRY * Indexubv)(const GLubyte *c);
- void (APIENTRY * Indexub)(GLubyte c);
- GLboolean (APIENTRY * IsTexture)(GLuint texture);
- void (APIENTRY * GenTextures)(GLsizei n, GLuint *textures);
- void (APIENTRY * DeleteTextures)(GLsizei n, const GLuint *textures);
- void (APIENTRY * BindTexture)(GLenum target, GLuint texture);
- void (APIENTRY * TexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
- void (APIENTRY * TexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
- void (APIENTRY * CopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void (APIENTRY * CopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
- void (APIENTRY * CopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void (APIENTRY * CopyTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
- void (APIENTRY * PolygonOffset)(GLfloat factor, GLfloat units);
- void (APIENTRY * GetPointerv)(GLenum pname, GLvoid* *params);
- void (APIENTRY * DrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
- void (APIENTRY * DrawArrays)(GLenum mode, GLint first, GLsizei count);
-
- void (APIENTRY * PushClientAttrib)(GLbitfield mask);
- void (APIENTRY * PopClientAttrib)();
- void (APIENTRY * PrioritizeTextures)(GLsizei n, const GLuint *textures, const GLfloat *priorities);
- GLboolean (APIENTRY * AreTexturesResident)(GLsizei n, const GLuint *textures, GLboolean *residences);
- void (APIENTRY * VertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void (APIENTRY * TexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void (APIENTRY * NormalPointer)(GLenum type, GLsizei stride, const GLvoid *pointer);
- void (APIENTRY * InterleavedArrays)(GLenum format, GLsizei stride, const GLvoid *pointer);
- void (APIENTRY * IndexPointer)(GLenum type, GLsizei stride, const GLvoid *pointer);
- void (APIENTRY * EnableClientState)(GLenum array);
- void (APIENTRY * EdgeFlagPointer)(GLsizei stride, const GLvoid *pointer);
- void (APIENTRY * DisableClientState)(GLenum array);
- void (APIENTRY * ColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
- void (APIENTRY * ArrayElement)(GLint i);
-
- // OpenGL ES 2.0
- void (APIENTRY * ActiveTexture)(GLenum texture);
- void (APIENTRY * AttachShader)(GLuint program, GLuint shader);
- void (APIENTRY * BindAttribLocation)(GLuint program, GLuint index, const GLchar* name);
- void (APIENTRY * BindBuffer)(GLenum target, GLuint buffer);
- void (APIENTRY * BindFramebuffer)(GLenum target, GLuint framebuffer);
- void (APIENTRY * BindRenderbuffer)(GLenum target, GLuint renderbuffer);
- void (APIENTRY * BlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
- void (APIENTRY * BlendEquation)(GLenum mode);
- void (APIENTRY * BlendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha);
- void (APIENTRY * BlendFuncSeparate)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
- void (APIENTRY * BufferData)(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
- void (APIENTRY * BufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
- GLenum (APIENTRY * CheckFramebufferStatus)(GLenum target);
- void (APIENTRY * ClearDepthf)(GLclampf depth);
- void (APIENTRY * CompileShader)(GLuint shader);
- void (APIENTRY * CompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);
- void (APIENTRY * CompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);
- GLuint (APIENTRY * CreateProgram)(void);
- GLuint (APIENTRY * CreateShader)(GLenum type);
- void (APIENTRY * DeleteBuffers)(GLsizei n, const GLuint* buffers);
- void (APIENTRY * DeleteFramebuffers)(GLsizei n, const GLuint* framebuffers);
- void (APIENTRY * DeleteProgram)(GLuint program);
- void (APIENTRY * DeleteRenderbuffers)(GLsizei n, const GLuint* renderbuffers);
- void (APIENTRY * DeleteShader)(GLuint shader);
- void (APIENTRY * DepthRangef)(GLclampf zNear, GLclampf zFar);
- void (APIENTRY * DetachShader)(GLuint program, GLuint shader);
- void (APIENTRY * DisableVertexAttribArray)(GLuint index);
- void (APIENTRY * EnableVertexAttribArray)(GLuint index);
- void (APIENTRY * FramebufferRenderbuffer)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void (APIENTRY * FramebufferTexture2D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void (APIENTRY * GenBuffers)(GLsizei n, GLuint* buffers);
- void (APIENTRY * GenerateMipmap)(GLenum target);
- void (APIENTRY * GenFramebuffers)(GLsizei n, GLuint* framebuffers);
- void (APIENTRY * GenRenderbuffers)(GLsizei n, GLuint* renderbuffers);
- void (APIENTRY * GetActiveAttrib)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
- void (APIENTRY * GetActiveUniform)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
- void (APIENTRY * GetAttachedShaders)(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
- int (APIENTRY * GetAttribLocation)(GLuint program, const GLchar* name);
- void (APIENTRY * GetBufferParameteriv)(GLenum target, GLenum pname, GLint* params);
- void (APIENTRY * GetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint* params);
- void (APIENTRY * GetProgramiv)(GLuint program, GLenum pname, GLint* params);
- void (APIENTRY * GetProgramInfoLog)(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
- void (APIENTRY * GetRenderbufferParameteriv)(GLenum target, GLenum pname, GLint* params);
- void (APIENTRY * GetShaderiv)(GLuint shader, GLenum pname, GLint* params);
- void (APIENTRY * GetShaderInfoLog)(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
- void (APIENTRY * GetShaderPrecisionFormat)(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
- void (APIENTRY * GetShaderSource)(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
- void (APIENTRY * GetUniformfv)(GLuint program, GLint location, GLfloat* params);
- void (APIENTRY * GetUniformiv)(GLuint program, GLint location, GLint* params);
- int (APIENTRY * GetUniformLocation)(GLuint program, const GLchar* name);
- void (APIENTRY * GetVertexAttribfv)(GLuint index, GLenum pname, GLfloat* params);
- void (APIENTRY * GetVertexAttribiv)(GLuint index, GLenum pname, GLint* params);
- void (APIENTRY * GetVertexAttribPointerv)(GLuint index, GLenum pname, GLvoid** pointer);
- GLboolean (APIENTRY * IsBuffer)(GLuint buffer);
- GLboolean (APIENTRY * IsFramebuffer)(GLuint framebuffer);
- GLboolean (APIENTRY * IsProgram)(GLuint program);
- GLboolean (APIENTRY * IsRenderbuffer)(GLuint renderbuffer);
- GLboolean (APIENTRY * IsShader)(GLuint shader);
- void (APIENTRY * LinkProgram)(GLuint program);
- void (APIENTRY * ReleaseShaderCompiler)(void);
- void (APIENTRY * RenderbufferStorage)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void (APIENTRY * SampleCoverage)(GLclampf value, GLboolean invert);
- void (APIENTRY * ShaderBinary)(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
- void (APIENTRY * ShaderSource)(GLuint shader, GLsizei count, const GLchar* *string, const GLint* length);
- void (APIENTRY * StencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask);
- void (APIENTRY * StencilMaskSeparate)(GLenum face, GLuint mask);
- void (APIENTRY * StencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
- void (APIENTRY * Uniform1f)(GLint location, GLfloat x);
- void (APIENTRY * Uniform1fv)(GLint location, GLsizei count, const GLfloat* v);
- void (APIENTRY * Uniform1i)(GLint location, GLint x);
- void (APIENTRY * Uniform1iv)(GLint location, GLsizei count, const GLint* v);
- void (APIENTRY * Uniform2f)(GLint location, GLfloat x, GLfloat y);
- void (APIENTRY * Uniform2fv)(GLint location, GLsizei count, const GLfloat* v);
- void (APIENTRY * Uniform2i)(GLint location, GLint x, GLint y);
- void (APIENTRY * Uniform2iv)(GLint location, GLsizei count, const GLint* v);
- void (APIENTRY * Uniform3f)(GLint location, GLfloat x, GLfloat y, GLfloat z);
- void (APIENTRY * Uniform3fv)(GLint location, GLsizei count, const GLfloat* v);
- void (APIENTRY * Uniform3i)(GLint location, GLint x, GLint y, GLint z);
- void (APIENTRY * Uniform3iv)(GLint location, GLsizei count, const GLint* v);
- void (APIENTRY * Uniform4f)(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void (APIENTRY * Uniform4fv)(GLint location, GLsizei count, const GLfloat* v);
- void (APIENTRY * Uniform4i)(GLint location, GLint x, GLint y, GLint z, GLint w);
- void (APIENTRY * Uniform4iv)(GLint location, GLsizei count, const GLint* v);
- void (APIENTRY * UniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
- void (APIENTRY * UniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
- void (APIENTRY * UniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
- void (APIENTRY * UseProgram)(GLuint program);
- void (APIENTRY * ValidateProgram)(GLuint program);
- void (APIENTRY * VertexAttrib1f)(GLuint indx, GLfloat x);
- void (APIENTRY * VertexAttrib1fv)(GLuint indx, const GLfloat* values);
- void (APIENTRY * VertexAttrib2f)(GLuint indx, GLfloat x, GLfloat y);
- void (APIENTRY * VertexAttrib2fv)(GLuint indx, const GLfloat* values);
- void (APIENTRY * VertexAttrib3f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
- void (APIENTRY * VertexAttrib3fv)(GLuint indx, const GLfloat* values);
- void (APIENTRY * VertexAttrib4f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void (APIENTRY * VertexAttrib4fv)(GLuint indx, const GLfloat* values);
- void (APIENTRY * VertexAttribPointer)(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
-
-protected:
- HMODULE m_lib;
- LibType m_libraryType;
- bool m_loaded;
-};
-
-class QWindowsOpenGL : public QAbstractWindowsOpenGL
-{
-public:
- QWindowsOpenGL();
- ~QWindowsOpenGL();
-
-private:
- bool load(const char *glName, const char *eglName);
- void unload();
-
- void resolve();
-
- void resolveWGL();
- void resolveEGL();
- void resolveGLCommon();
- void resolveGL11();
- void resolveGLES2();
-
- FARPROC resolveFunc(const char *name);
- FARPROC resolveEglFunc(const char *name);
-
- bool testDesktopGL();
-
- HMODULE m_eglLib;
-};
-
-static QString qgl_windowsErrorMessage(unsigned long errorCode)
-{
- QString rc = QString::fromLatin1("#%1: ").arg(errorCode);
- ushort *lpMsgBuf;
-
- const int len = FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, errorCode, 0, (LPTSTR)&lpMsgBuf, 0, NULL);
- if (len) {
- rc += QString::fromUtf16(lpMsgBuf, len);
- LocalFree(lpMsgBuf);
- } else {
- rc += QString::fromLatin1("<unknown error>");
- }
- return rc;
-}
-
-static HMODULE qgl_loadLib(const char *name, bool warnOnFail = true)
-{
- HMODULE lib = LoadLibraryA(name);
-
- if (lib)
- return lib;
-
- if (warnOnFail) {
- QString msg = qgl_windowsErrorMessage(GetLastError());
- qCWarning(qglLc, "Failed to load %s: %s", name, qPrintable(msg));
- }
-
- return 0;
-}
-
-QWindowsOpenGL::QWindowsOpenGL()
- : m_eglLib(0)
-{
- enum RequestedLib {
- Unknown,
- Desktop,
- GLES
- } req = Unknown;
-
- // Check if the application has requested a certain implementation.
- if (QCoreApplication::testAttribute(Qt::AA_UseDesktopOpenGL))
- req = Desktop;
- else if (QCoreApplication::testAttribute(Qt::AA_UseOpenGLES))
- req = GLES;
-
- // Check if an implementation is forced through the environment variable.
- QByteArray requested = qgetenv("QT_OPENGL");
- if (requested == QByteArrayLiteral("desktop"))
- req = Desktop;
- else if (requested == QByteArrayLiteral("angle"))
- req = GLES;
-
- bool desktopTested = false;
- if (req == Unknown) {
- // No explicit request. Start testing. opengl32.dll is preferred. Angle is the fallback.
- desktopTested = true;
- if (testDesktopGL())
- req = Desktop;
- else
- req = GLES;
- }
-
- Q_ASSERT(req != Unknown);
-
- if (req == GLES) {
- qCDebug(qglLc, "Using Angle");
-#ifdef QT_DEBUG
- m_loaded = load("libglesv2d.dll", "libegld.dll");
-#else
- m_loaded = load("libglesv2.dll", "libegl.dll");
-#endif
- if (m_loaded) {
- m_libraryType = QWindowsOpenGL::GLES2;
- } else {
- // Could not load Angle. Try opengl32.dll.
- if (!desktopTested && testDesktopGL())
- req = Desktop;
- }
- }
-
- if (req == Desktop) {
- qCDebug(qglLc, "Using desktop OpenGL");
- m_loaded = load("opengl32.dll", 0);
- if (m_loaded)
- m_libraryType = QWindowsOpenGL::DesktopGL;
- }
-
- if (m_loaded)
- resolve();
-
- // When no library is loaded, keep on running. All EGL/WGL/GL functions will
- // return 0 in this case without further errors. It is up to the clients
- // (application code, Qt Quick, etc.) to act when eglInitialize() and
- // friends fail, i.e. when QOpenGLContext::create() returns false due to the
- // platform plugin's failure to create a platform context.
-}
-
-QWindowsOpenGL::~QWindowsOpenGL()
-{
- unload();
-}
-
-bool QWindowsOpenGL::load(const char *glName, const char *eglName)
-{
- qCDebug(qglLc, "Loading %s %s", glName, eglName ? eglName : "");
-
- bool result = true;
-
- if (glName) {
- m_lib = qgl_loadLib(glName);
- result &= m_lib != 0;
- }
-
- if (eglName) {
- m_eglLib = qgl_loadLib(eglName);
- result &= m_eglLib != 0;
- }
-
- if (!result)
- unload();
-
- return result;
-}
-
-void QWindowsOpenGL::unload()
-{
- if (m_lib) {
- FreeLibrary(m_lib);
- m_lib = 0;
- }
- if (m_eglLib) {
- FreeLibrary(m_eglLib);
- m_eglLib = 0;
- }
- m_loaded = false;
-}
-
-FARPROC QWindowsOpenGL::resolveFunc(const char *name)
-{
- FARPROC proc = m_lib ? ::GetProcAddress(m_lib, name) : 0;
- if (!proc)
- qCDebug(qglLc, "Failed to resolve GL function %s", name);
- return proc;
-}
-
-FARPROC QWindowsOpenGL::resolveEglFunc(const char *name)
-{
- FARPROC proc = m_eglLib ? ::GetProcAddress(m_eglLib, name) : 0;
- if (!proc)
- qCDebug(qglLc, "Failed to resolve EGL function %s", name);
- return proc;
-}
-
-void QWindowsOpenGL::resolveWGL()
-{
- CopyContext = reinterpret_cast<BOOL (WINAPI *)(HGLRC, HGLRC, UINT)>(resolveFunc("wglCopyContext"));
- CreateContext = reinterpret_cast<HGLRC (WINAPI *)(HDC)>(resolveFunc("wglCreateContext"));
- CreateLayerContext = reinterpret_cast<HGLRC (WINAPI *)(HDC, int)>(resolveFunc("wglCreateLayerContext"));
- DeleteContext = reinterpret_cast<BOOL (WINAPI *)(HGLRC)>(resolveFunc("wglDeleteContext"));
- GetCurrentContext = reinterpret_cast<HGLRC (WINAPI *)()>(resolveFunc("wglGetCurrentContext"));
- GetCurrentDC = reinterpret_cast<HDC (WINAPI *)()>(resolveFunc("wglGetCurrentDC"));
- GetProcAddress = reinterpret_cast<PROC (WINAPI *)(LPCSTR)>(resolveFunc("wglGetProcAddress"));
- MakeCurrent = reinterpret_cast<BOOL (WINAPI *)(HDC, HGLRC)>(resolveFunc("wglMakeCurrent"));
- ShareLists = reinterpret_cast<BOOL (WINAPI *)(HGLRC, HGLRC)>(resolveFunc("wglShareLists"));
- UseFontBitmapsW = reinterpret_cast<BOOL (WINAPI *)(HDC, DWORD, DWORD, DWORD)>(resolveFunc("wglUseFontBitmapsW"));
- UseFontOutlinesW = reinterpret_cast<BOOL (WINAPI *)(HDC, DWORD, DWORD, DWORD, FLOAT, FLOAT, int, LPGLYPHMETRICSFLOAT)>(resolveFunc("wglUseFontOutlinesW"));
- DescribeLayerPlane = reinterpret_cast<BOOL (WINAPI *)(HDC, int, int, UINT, LPLAYERPLANEDESCRIPTOR)>(resolveFunc("wglDescribeLayerPlane"));
- SetLayerPaletteEntries = reinterpret_cast<int (WINAPI *)(HDC, int, int, int, CONST COLORREF *)>(resolveFunc("wglSetLayerPaletteEntries"));
- GetLayerPaletteEntries = reinterpret_cast<int (WINAPI *)(HDC, int, int, int, COLORREF *)>(resolveFunc("wglGetLayerPaletteEntries"));
- RealizeLayerPalette = reinterpret_cast<BOOL (WINAPI *)(HDC, int, BOOL)>(resolveFunc("wglRealizeLayerPalette"));
- SwapLayerBuffers = reinterpret_cast<BOOL (WINAPI *)(HDC, UINT)>(resolveFunc("wglSwapLayerBuffers"));
- SwapMultipleBuffers = reinterpret_cast<DWORD (WINAPI *)(UINT, CONST WGLSWAP *)>(resolveFunc("wglSwapMultipleBuffers"));
-}
-
-void QWindowsOpenGL::resolveEGL()
-{
- EGL_GetError = reinterpret_cast<EGLint (EGLAPIENTRY *)(void)>(resolveEglFunc("eglGetError"));
- EGL_GetDisplay = reinterpret_cast<EGLDisplay (EGLAPIENTRY *)(EGLNativeDisplayType)>(resolveEglFunc("eglGetDisplay"));
- EGL_Initialize = reinterpret_cast<EGLBoolean (EGLAPIENTRY *)(EGLDisplay, EGLint *, EGLint *)>(resolveEglFunc("eglInitialize"));
- EGL_Terminate = reinterpret_cast<EGLBoolean (EGLAPIENTRY *)(EGLDisplay)>(resolveEglFunc("eglTerminate"));
- EGL_QueryString = reinterpret_cast<const char * (EGLAPIENTRY *)(EGLDisplay, EGLint)>(resolveEglFunc("eglQueryString"));
- EGL_GetConfigs = reinterpret_cast<EGLBoolean (EGLAPIENTRY * )(EGLDisplay, EGLConfig *, EGLint, EGLint *)>(resolveEglFunc("eglGetConfigs"));
- EGL_ChooseConfig = reinterpret_cast<EGLBoolean (EGLAPIENTRY *)(EGLDisplay, const EGLint *, EGLConfig *, EGLint, EGLint *)>(resolveEglFunc("eglChooseConfig"));
- EGL_GetConfigAttrib = reinterpret_cast<EGLBoolean (EGLAPIENTRY *)(EGLDisplay, EGLConfig, EGLint, EGLint *)>(resolveEglFunc("eglGetConfigAttrib"));
- EGL_CreateWindowSurface = reinterpret_cast<EGLSurface (EGLAPIENTRY *)(EGLDisplay, EGLConfig, EGLNativeWindowType, const EGLint *)>(resolveEglFunc("eglCreateWindowSurface"));
- EGL_CreatePbufferSurface = reinterpret_cast<EGLSurface (EGLAPIENTRY *)(EGLDisplay , EGLConfig, const EGLint *)>(resolveEglFunc("eglCreatePbufferSurface"));
- EGL_CreatePixmapSurface = reinterpret_cast<EGLSurface (EGLAPIENTRY * )(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType , const EGLint *)>(resolveEglFunc("eglCreatePixmapSurface"));
- EGL_DestroySurface = reinterpret_cast<EGLBoolean (EGLAPIENTRY *)(EGLDisplay , EGLSurface )>(resolveEglFunc("eglDestroySurface"));
- EGL_QuerySurface = reinterpret_cast<EGLBoolean (EGLAPIENTRY * )(EGLDisplay , EGLSurface , EGLint , EGLint *)>(resolveEglFunc("eglQuerySurface"));
- EGL_BindAPI = reinterpret_cast<EGLBoolean (EGLAPIENTRY * )(EGLenum )>(resolveEglFunc("eglBindAPI"));
- EGL_QueryAPI = reinterpret_cast<EGLenum (EGLAPIENTRY *)(void)>(resolveEglFunc("eglQueryAPI"));
- EGL_WaitClient = reinterpret_cast<EGLBoolean (EGLAPIENTRY *)(void)>(resolveEglFunc("eglWaitClient"));
- EGL_ReleaseThread = reinterpret_cast<EGLBoolean (EGLAPIENTRY *)(void)>(resolveEglFunc("eglReleaseThread"));
- EGL_CreatePbufferFromClientBuffer = reinterpret_cast<EGLSurface (EGLAPIENTRY * )(EGLDisplay , EGLenum , EGLClientBuffer , EGLConfig , const EGLint *)>(resolveEglFunc("eglCreatePbufferFromClientBuffer"));
- EGL_SurfaceAttrib = reinterpret_cast<EGLBoolean (EGLAPIENTRY *)(EGLDisplay , EGLSurface , EGLint , EGLint )>(resolveEglFunc("eglSurfaceAttrib"));
- EGL_BindTexImage = reinterpret_cast<EGLBoolean (EGLAPIENTRY * )(EGLDisplay, EGLSurface , EGLint )>(resolveEglFunc("eglBindTexImage"));
- EGL_ReleaseTexImage = reinterpret_cast<EGLBoolean (EGLAPIENTRY *)(EGLDisplay, EGLSurface , EGLint)>(resolveEglFunc("eglReleaseTexImage"));
- EGL_SwapInterval = reinterpret_cast<EGLBoolean (EGLAPIENTRY *)(EGLDisplay , EGLint )>(resolveEglFunc("eglSwapInterval"));
- EGL_CreateContext = reinterpret_cast<EGLContext (EGLAPIENTRY *)(EGLDisplay , EGLConfig , EGLContext , const EGLint *)>(resolveEglFunc("eglCreateContext"));
- EGL_DestroyContext = reinterpret_cast<EGLBoolean (EGLAPIENTRY *)(EGLDisplay, EGLContext)>(resolveEglFunc("eglDestroyContext"));
- EGL_MakeCurrent = reinterpret_cast<EGLBoolean (EGLAPIENTRY *)(EGLDisplay , EGLSurface , EGLSurface , EGLContext )>(resolveEglFunc("eglMakeCurrent"));
- EGL_GetCurrentContext = reinterpret_cast<EGLContext (EGLAPIENTRY *)(void)>(resolveEglFunc("eglGetCurrentContext"));
- EGL_GetCurrentSurface = reinterpret_cast<EGLSurface (EGLAPIENTRY *)(EGLint )>(resolveEglFunc("eglGetCurrentSurface"));
- EGL_GetCurrentDisplay = reinterpret_cast<EGLDisplay (EGLAPIENTRY *)(void)>(resolveEglFunc("eglGetCurrentDisplay"));
- EGL_QueryContext = reinterpret_cast<EGLBoolean (EGLAPIENTRY *)(EGLDisplay , EGLContext , EGLint , EGLint *)>(resolveEglFunc("eglQueryContext"));
- EGL_WaitGL = reinterpret_cast<EGLBoolean (EGLAPIENTRY *)(void)>(resolveEglFunc("eglWaitGL"));
- EGL_WaitNative = reinterpret_cast<EGLBoolean (EGLAPIENTRY *)(EGLint )>(resolveEglFunc("eglWaitNative"));
- EGL_SwapBuffers = reinterpret_cast<EGLBoolean (EGLAPIENTRY *)(EGLDisplay , EGLSurface)>(resolveEglFunc("eglSwapBuffers"));
- EGL_CopyBuffers = reinterpret_cast<EGLBoolean (EGLAPIENTRY *)(EGLDisplay , EGLSurface , EGLNativePixmapType )>(resolveEglFunc("eglCopyBuffers"));
- EGL_GetProcAddress = reinterpret_cast<__eglMustCastToProperFunctionPointerType (EGLAPIENTRY * )(const char *)>(resolveEglFunc("eglGetProcAddress"));
-}
-
-void QWindowsOpenGL::resolveGLCommon()
-{
- Viewport = reinterpret_cast<void (APIENTRY *)(GLint , GLint , GLsizei , GLsizei )>(resolveFunc("glViewport"));
- IsEnabled = reinterpret_cast<GLboolean (APIENTRY *)(GLenum )>(resolveFunc("glIsEnabled"));
- GetTexParameteriv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLint *)>(resolveFunc("glGetTexParameteriv"));
- GetTexParameterfv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLfloat *)>(resolveFunc("glGetTexParameterfv"));
- GetString = reinterpret_cast<const GLubyte * (APIENTRY *)(GLenum )>(resolveFunc("glGetString"));
- GetIntegerv = reinterpret_cast<void (APIENTRY *)(GLenum , GLint *)>(resolveFunc("glGetIntegerv"));
- GetFloatv = reinterpret_cast<void (APIENTRY *)(GLenum , GLfloat *)>(resolveFunc("glGetFloatv"));
- GetError = reinterpret_cast<GLenum (APIENTRY *)()>(resolveFunc("glGetError"));
- GetBooleanv = reinterpret_cast<void (APIENTRY *)(GLenum , GLboolean *)>(resolveFunc("glGetBooleanv"));
- ReadPixels = reinterpret_cast<void (APIENTRY *)(GLint , GLint , GLsizei , GLsizei , GLenum , GLenum , GLvoid *)>(resolveFunc("glReadPixels"));
- PixelStorei = reinterpret_cast<void (APIENTRY *)(GLenum , GLint )>(resolveFunc("glPixelStorei"));
- DepthFunc = reinterpret_cast<void (APIENTRY *)(GLenum )>(resolveFunc("glDepthFunc"));
- StencilOp = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLenum )>(resolveFunc("glStencilOp"));
- StencilFunc = reinterpret_cast<void (APIENTRY *)(GLenum , GLint , GLuint )>(resolveFunc("glStencilFunc"));
- BlendFunc = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum )>(resolveFunc("glBlendFunc"));
- Flush = reinterpret_cast<void (APIENTRY *)()>(resolveFunc("glFlush"));
- Finish = reinterpret_cast<void (APIENTRY *)()>(resolveFunc("glFinish"));
- Enable = reinterpret_cast<void (APIENTRY *)(GLenum )>(resolveFunc("glEnable"));
- Disable = reinterpret_cast<void (APIENTRY *)(GLenum )>(resolveFunc("glDisable"));
- DepthMask = reinterpret_cast<void (APIENTRY *)(GLboolean )>(resolveFunc("glDepthMask"));
- ColorMask = reinterpret_cast<void (APIENTRY *)(GLboolean , GLboolean , GLboolean , GLboolean )>(resolveFunc("glColorMask"));
- StencilMask = reinterpret_cast<void (APIENTRY *)(GLuint )>(resolveFunc("glStencilMask"));
- ClearStencil = reinterpret_cast<void (APIENTRY *)(GLint )>(resolveFunc("glClearStencil"));
- ClearColor = reinterpret_cast<void (APIENTRY *)(GLfloat , GLfloat , GLfloat , GLfloat )>(resolveFunc("glClearColor"));
- Clear = reinterpret_cast<void (APIENTRY *)(GLbitfield )>(resolveFunc("glClear"));
- TexImage2D = reinterpret_cast<void (APIENTRY *)(GLenum , GLint , GLint , GLsizei , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(resolveFunc("glTexImage2D"));
- TexParameteriv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , const GLint *)>(resolveFunc("glTexParameteriv"));
- TexParameteri = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLint )>(resolveFunc("glTexParameteri"));
- TexParameterfv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , const GLfloat *)>(resolveFunc("glTexParameterfv"));
- TexParameterf = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLfloat )>(resolveFunc("glTexParameterf"));
- Scissor = reinterpret_cast<void (APIENTRY *)(GLint , GLint , GLsizei , GLsizei )>(resolveFunc("glScissor"));
- LineWidth = reinterpret_cast<void (APIENTRY *)(GLfloat )>(resolveFunc("glLineWidth"));
- Hint = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum )>(resolveFunc("glHint"));
- FrontFace = reinterpret_cast<void (APIENTRY *)(GLenum )>(resolveFunc("glFrontFace"));
- CullFace = reinterpret_cast<void (APIENTRY *)(GLenum )>(resolveFunc("glCullFace"));
-
- IsTexture = reinterpret_cast<GLboolean (APIENTRY *)(GLuint )>(resolveFunc("glIsTexture"));
- GenTextures = reinterpret_cast<void (APIENTRY *)(GLsizei , GLuint *)>(resolveFunc("glGenTextures"));
- DeleteTextures = reinterpret_cast<void (APIENTRY *)(GLsizei , const GLuint *)>(resolveFunc("glDeleteTextures"));
- BindTexture = reinterpret_cast<void (APIENTRY *)(GLenum , GLuint )>(resolveFunc("glBindTexture"));
- TexSubImage2D = reinterpret_cast<void (APIENTRY *)(GLenum , GLint , GLint , GLint , GLsizei , GLsizei , GLenum , GLenum , const GLvoid *)>(resolveFunc("glTexSubImage2D"));
- CopyTexSubImage2D = reinterpret_cast<void (APIENTRY *)(GLenum , GLint , GLint , GLint , GLint , GLint , GLsizei , GLsizei )>(resolveFunc("glCopyTexSubImage2D"));
- CopyTexImage2D = reinterpret_cast<void (APIENTRY *)(GLenum , GLint , GLenum , GLint , GLint , GLsizei , GLsizei , GLint )>(resolveFunc("glCopyTexImage2D"));
- PolygonOffset = reinterpret_cast<void (APIENTRY *)(GLfloat , GLfloat )>(resolveFunc("glPolygonOffset"));
- DrawElements = reinterpret_cast<void (APIENTRY *)(GLenum , GLsizei , GLenum , const GLvoid *)>(resolveFunc("glDrawElements"));
- DrawArrays = reinterpret_cast<void (APIENTRY *)(GLenum , GLint , GLsizei )>(resolveFunc("glDrawArrays"));
-}
-
-void QWindowsOpenGL::resolveGL11()
-{
- DepthRange = reinterpret_cast<void (APIENTRY *)(GLdouble , GLdouble )>(resolveFunc("glDepthRange"));
- GetTexImage = reinterpret_cast<void (APIENTRY *)(GLenum , GLint , GLenum , GLenum , GLvoid *)>(resolveFunc("glGetTexImage"));
- LogicOp = reinterpret_cast<void (APIENTRY *)(GLenum )>(resolveFunc("glLogicOp"));
- ClearDepth = reinterpret_cast<void (APIENTRY *)(GLdouble )>(resolveFunc("glClearDepth"));
- PolygonMode = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum )>(resolveFunc("glPolygonMode"));
- PointSize = reinterpret_cast<void (APIENTRY *)(GLfloat )>(resolveFunc("glPointSize"));
- GetTexLevelParameteriv = reinterpret_cast<void (APIENTRY *)(GLenum , GLint , GLenum , GLint *)>(resolveFunc("glGetTexLevelParameteriv"));
- GetTexLevelParameterfv = reinterpret_cast<void (APIENTRY *)(GLenum , GLint , GLenum , GLfloat *)>(resolveFunc("glGetTexLevelParameterfv"));
- GetDoublev = reinterpret_cast<void (APIENTRY *)(GLenum , GLdouble *)>(resolveFunc("glGetDoublev"));
- PixelStoref = reinterpret_cast<void (APIENTRY *)(GLenum , GLfloat )>(resolveFunc("glPixelStoref"));
- ReadBuffer = reinterpret_cast<void (APIENTRY *)(GLenum )>(resolveFunc("glReadBuffer"));
- DrawBuffer = reinterpret_cast<void (APIENTRY *)(GLenum )>(resolveFunc("glDrawBuffer"));
- TexImage1D = reinterpret_cast<void (APIENTRY *)(GLenum , GLint , GLint , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(resolveFunc("glTexImage1D"));
-
- Translatef = reinterpret_cast<void (APIENTRY *)(GLfloat , GLfloat , GLfloat )>(resolveFunc("glTranslatef"));
- Translated = reinterpret_cast<void (APIENTRY *)(GLdouble , GLdouble , GLdouble )>(resolveFunc("glTranslated"));
- Scalef = reinterpret_cast<void (APIENTRY *)(GLfloat , GLfloat , GLfloat )>(resolveFunc("glScalef"));
- Scaled = reinterpret_cast<void (APIENTRY *)(GLdouble , GLdouble , GLdouble )>(resolveFunc("glScaled"));
- Rotatef = reinterpret_cast<void (APIENTRY *)(GLfloat , GLfloat , GLfloat , GLfloat )>(resolveFunc("glRotatef"));
- Rotated = reinterpret_cast<void (APIENTRY *)(GLdouble , GLdouble , GLdouble , GLdouble )>(resolveFunc("glRotated"));
- PushMatrix = reinterpret_cast<void (APIENTRY *)()>(resolveFunc("glPushMatrix"));
- PopMatrix = reinterpret_cast<void (APIENTRY *)()>(resolveFunc("glPopMatrix"));
- Ortho = reinterpret_cast<void (APIENTRY *)(GLdouble , GLdouble , GLdouble , GLdouble , GLdouble , GLdouble )>(resolveFunc("glOrtho"));
- MultMatrixd = reinterpret_cast<void (APIENTRY *)(const GLdouble *)>(resolveFunc("glMultMatrixd"));
- MultMatrixf = reinterpret_cast<void (APIENTRY *)(const GLfloat *)>(resolveFunc("glMultMatrixf"));
- MatrixMode = reinterpret_cast<void (APIENTRY *)(GLenum )>(resolveFunc("glMatrixMode"));
- LoadMatrixd = reinterpret_cast<void (APIENTRY *)(const GLdouble *)>(resolveFunc("glLoadMatrixd"));
- LoadMatrixf = reinterpret_cast<void (APIENTRY *)(const GLfloat *)>(resolveFunc("glLoadMatrixf"));
- LoadIdentity = reinterpret_cast<void (APIENTRY *)()>(resolveFunc("glLoadIdentity"));
- Frustum = reinterpret_cast<void (APIENTRY *)(GLdouble , GLdouble , GLdouble , GLdouble , GLdouble , GLdouble )>(resolveFunc("glFrustum"));
- IsList = reinterpret_cast<GLboolean (APIENTRY *)(GLuint )>(resolveFunc("glIsList"));
- GetTexGeniv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLint *)>(resolveFunc("glGetTexGeniv"));
- GetTexGenfv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLfloat *)>(resolveFunc("glGetTexGenfv"));
- GetTexGendv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLdouble *)>(resolveFunc("glGetTexGendv"));
- GetTexEnviv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLint *)>(resolveFunc("glGetTexEnviv"));
- GetTexEnvfv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLfloat *)>(resolveFunc("glGetTexEnvfv"));
- GetPolygonStipple = reinterpret_cast<void (APIENTRY *)(GLubyte *)>(resolveFunc("glGetPolygonStipple"));
- GetPixelMapusv = reinterpret_cast<void (APIENTRY *)(GLenum , GLushort *)>(resolveFunc("glGetPixelMapusv"));
- GetPixelMapuiv = reinterpret_cast<void (APIENTRY *)(GLenum , GLuint *)>(resolveFunc("glGetPixelMapuiv"));
- GetPixelMapfv = reinterpret_cast<void (APIENTRY *)(GLenum , GLfloat *)>(resolveFunc("glGetPixelMapfv"));
- GetMaterialiv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLint *)>(resolveFunc("glGetMaterialiv"));
- GetMaterialfv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLfloat *)>(resolveFunc("glGetMaterialfv"));
- GetMapiv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLint *)>(resolveFunc("glGetMapiv"));
- GetMapfv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLfloat *)>(resolveFunc("glGetMapfv"));
- GetMapdv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLdouble *)>(resolveFunc("glGetMapdv"));
- GetLightiv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLint *)>(resolveFunc("glGetLightiv"));
- GetLightfv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLfloat *)>(resolveFunc("glGetLightfv"));
- GetClipPlane = reinterpret_cast<void (APIENTRY *)(GLenum , GLdouble *)>(resolveFunc("glGetClipPlane"));
- DrawPixels = reinterpret_cast<void (APIENTRY *)(GLsizei , GLsizei , GLenum , GLenum , const GLvoid *)>(resolveFunc("glDrawPixels"));
- CopyPixels = reinterpret_cast<void (APIENTRY *)(GLint , GLint , GLsizei , GLsizei , GLenum )>(resolveFunc("glCopyPixels"));
- PixelMapusv = reinterpret_cast<void (APIENTRY *)(GLenum , GLint , const GLushort *)>(resolveFunc("glPixelMapusv"));
- PixelMapuiv = reinterpret_cast<void (APIENTRY *)(GLenum , GLint , const GLuint *)>(resolveFunc("glPixelMapuiv"));
- PixelMapfv = reinterpret_cast<void (APIENTRY *)(GLenum , GLint , const GLfloat *)>(resolveFunc("glPixelMapfv"));
- PixelTransferi = reinterpret_cast<void (APIENTRY *)(GLenum , GLint )>(resolveFunc("glPixelTransferi"));
- PixelTransferf = reinterpret_cast<void (APIENTRY *)(GLenum , GLfloat )>(resolveFunc("glPixelTransferf"));
- PixelZoom = reinterpret_cast<void (APIENTRY *)(GLfloat , GLfloat )>(resolveFunc("glPixelZoom"));
- AlphaFunc = reinterpret_cast<void (APIENTRY *)(GLenum , GLfloat )>(resolveFunc("glAlphaFunc"));
- EvalPoint2 = reinterpret_cast<void (APIENTRY *)(GLint , GLint )>(resolveFunc("glEvalPoint2"));
- EvalMesh2 = reinterpret_cast<void (APIENTRY *)(GLenum , GLint , GLint , GLint , GLint )>(resolveFunc("glEvalMesh2"));
- EvalPoint1 = reinterpret_cast<void (APIENTRY *)(GLint )>(resolveFunc("glEvalPoint1"));
- EvalMesh1 = reinterpret_cast<void (APIENTRY *)(GLenum , GLint , GLint )>(resolveFunc("glEvalMesh1"));
- EvalCoord2fv = reinterpret_cast<void (APIENTRY *)(const GLfloat *)>(resolveFunc("glEvalCoord2fv"));
- EvalCoord2f = reinterpret_cast<void (APIENTRY *)(GLfloat , GLfloat )>(resolveFunc("glEvalCoord2f"));
- EvalCoord2dv = reinterpret_cast<void (APIENTRY *)(const GLdouble *)>(resolveFunc("glEvalCoord2dv"));
- EvalCoord2d = reinterpret_cast<void (APIENTRY *)(GLdouble , GLdouble )>(resolveFunc("glEvalCoord2d"));
- EvalCoord1fv = reinterpret_cast<void (APIENTRY *)(const GLfloat *)>(resolveFunc("glEvalCoord1fv"));
- EvalCoord1f = reinterpret_cast<void (APIENTRY *)(GLfloat )>(resolveFunc("glEvalCoord1f"));
- EvalCoord1dv = reinterpret_cast<void (APIENTRY *)(const GLdouble *)>(resolveFunc("glEvalCoord1dv"));
- EvalCoord1d = reinterpret_cast<void (APIENTRY *)(GLdouble )>(resolveFunc("glEvalCoord1d"));
- MapGrid2f = reinterpret_cast<void (APIENTRY *)(GLint , GLfloat , GLfloat , GLint , GLfloat , GLfloat )>(resolveFunc("glMapGrid2f"));
- MapGrid2d = reinterpret_cast<void (APIENTRY *)(GLint , GLdouble , GLdouble , GLint , GLdouble , GLdouble )>(resolveFunc("glMapGrid2d"));
- MapGrid1f = reinterpret_cast<void (APIENTRY *)(GLint , GLfloat , GLfloat )>(resolveFunc("glMapGrid1f"));
- MapGrid1d = reinterpret_cast<void (APIENTRY *)(GLint , GLdouble , GLdouble )>(resolveFunc("glMapGrid1d"));
- Map2f = reinterpret_cast<void (APIENTRY *)(GLenum , GLfloat , GLfloat , GLint , GLint , GLfloat , GLfloat , GLint , GLint , const GLfloat *)>(resolveFunc("glMap2f"));
- Map2d = reinterpret_cast<void (APIENTRY *)(GLenum , GLdouble , GLdouble , GLint , GLint , GLdouble , GLdouble , GLint , GLint , const GLdouble *)>(resolveFunc("glMap2d"));
- Map1f = reinterpret_cast<void (APIENTRY *)(GLenum , GLfloat , GLfloat , GLint , GLint , const GLfloat *)>(resolveFunc("glMap1f"));
- Map1d = reinterpret_cast<void (APIENTRY *)(GLenum , GLdouble , GLdouble , GLint , GLint , const GLdouble *)>(resolveFunc("glMap1d"));
- PushAttrib = reinterpret_cast<void (APIENTRY *)(GLbitfield )>(resolveFunc("glPushAttrib"));
- PopAttrib = reinterpret_cast<void (APIENTRY *)()>(resolveFunc("glPopAttrib"));
- Accum = reinterpret_cast<void (APIENTRY *)(GLenum , GLfloat )>(resolveFunc("glAccum"));
- IndexMask = reinterpret_cast<void (APIENTRY *)(GLuint )>(resolveFunc("glIndexMask"));
- ClearIndex = reinterpret_cast<void (APIENTRY *)(GLfloat )>(resolveFunc("glClearIndex"));
- ClearAccum = reinterpret_cast<void (APIENTRY *)(GLfloat , GLfloat , GLfloat , GLfloat )>(resolveFunc("glClearAccum"));
- PushName = reinterpret_cast<void (APIENTRY *)(GLuint )>(resolveFunc("glPushName"));
- PopName = reinterpret_cast<void (APIENTRY *)()>(resolveFunc("glPopName"));
- PassThrough = reinterpret_cast<void (APIENTRY *)(GLfloat )>(resolveFunc("glPassThrough"));
- LoadName = reinterpret_cast<void (APIENTRY *)(GLuint )>(resolveFunc("glLoadName"));
- InitNames = reinterpret_cast<void (APIENTRY *)()>(resolveFunc("glInitNames"));
- RenderMode = reinterpret_cast<GLint (APIENTRY *)(GLenum )>(resolveFunc("glRenderMode"));
- SelectBuffer = reinterpret_cast<void (APIENTRY *)(GLsizei , GLuint *)>(resolveFunc("glSelectBuffer"));
- FeedbackBuffer = reinterpret_cast<void (APIENTRY *)(GLsizei , GLenum , GLfloat *)>(resolveFunc("glFeedbackBuffer"));
- TexGeniv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , const GLint *)>(resolveFunc("glTexGeniv"));
- TexGeni = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLint )>(resolveFunc("glTexGeni"));
- TexGenfv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , const GLfloat *)>(resolveFunc("glTexGenfv"));
- TexGenf = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLfloat )>(resolveFunc("glTexGenf"));
- TexGendv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , const GLdouble *)>(resolveFunc("glTexGendv"));
- TexGend = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLdouble )>(resolveFunc("glTexGend"));
- TexEnviv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , const GLint *)>(resolveFunc("glTexEnviv"));
- TexEnvi = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLint )>(resolveFunc("glTexEnvi"));
- TexEnvfv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , const GLfloat *)>(resolveFunc("glTexEnvfv"));
- TexEnvf = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLfloat )>(resolveFunc("glTexEnvf"));
- ShadeModel = reinterpret_cast<void (APIENTRY *)(GLenum )>(resolveFunc("glShadeModel"));
- PolygonStipple = reinterpret_cast<void (APIENTRY *)(const GLubyte *)>(resolveFunc("glPolygonStipple"));
- Materialiv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , const GLint *)>(resolveFunc("glMaterialiv"));
- Materiali = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLint )>(resolveFunc("glMateriali"));
- Materialfv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , const GLfloat *)>(resolveFunc("glMaterialfv"));
- Materialf = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLfloat )>(resolveFunc("glMaterialf"));
- LineStipple = reinterpret_cast<void (APIENTRY *)(GLint , GLushort )>(resolveFunc("glLineStipple"));
- LightModeliv = reinterpret_cast<void (APIENTRY *)(GLenum , const GLint *)>(resolveFunc("glLightModeliv"));
- LightModeli = reinterpret_cast<void (APIENTRY *)(GLenum , GLint )>(resolveFunc("glLightModeli"));
- LightModelfv = reinterpret_cast<void (APIENTRY *)(GLenum , const GLfloat *)>(resolveFunc("glLightModelfv"));
- LightModelf = reinterpret_cast<void (APIENTRY *)(GLenum , GLfloat )>(resolveFunc("glLightModelf"));
- Lightiv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , const GLint *)>(resolveFunc("glLightiv"));
- Lighti = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLint )>(resolveFunc("glLighti"));
- Lightfv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , const GLfloat *)>(resolveFunc("glLightfv"));
- Lightf = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLfloat )>(resolveFunc("glLightf"));
- Fogiv = reinterpret_cast<void (APIENTRY *)(GLenum , const GLint *)>(resolveFunc("glFogiv"));
- Fogi = reinterpret_cast<void (APIENTRY *)(GLenum , GLint )>(resolveFunc("glFogi"));
- Fogfv = reinterpret_cast<void (APIENTRY *)(GLenum , const GLfloat *)>(resolveFunc("glFogfv"));
- Fogf = reinterpret_cast<void (APIENTRY *)(GLenum , GLfloat )>(resolveFunc("glFogf"));
- ColorMaterial = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum )>(resolveFunc("glColorMaterial"));
- ClipPlane = reinterpret_cast<void (APIENTRY *)(GLenum , const GLdouble *)>(resolveFunc("glClipPlane"));
- Vertex4sv = reinterpret_cast<void (APIENTRY *)(const GLshort *)>(resolveFunc("glVertex4sv"));
- Vertex4s = reinterpret_cast<void (APIENTRY *)(GLshort , GLshort , GLshort , GLshort )>(resolveFunc("glVertex4s"));
- Vertex4iv = reinterpret_cast<void (APIENTRY *)(const GLint *)>(resolveFunc("glVertex4iv"));
- Vertex4i = reinterpret_cast<void (APIENTRY *)(GLint , GLint , GLint , GLint )>(resolveFunc("glVertex4i"));
- Vertex4fv = reinterpret_cast<void (APIENTRY *)(const GLfloat *)>(resolveFunc("glVertex4fv"));
- Vertex4f = reinterpret_cast<void (APIENTRY *)(GLfloat , GLfloat , GLfloat , GLfloat )>(resolveFunc("glVertex4f"));
- Vertex4dv = reinterpret_cast<void (APIENTRY *)(const GLdouble *)>(resolveFunc("glVertex4dv"));
- Vertex4d = reinterpret_cast<void (APIENTRY *)(GLdouble , GLdouble , GLdouble , GLdouble )>(resolveFunc("glVertex4d"));
- Vertex3sv = reinterpret_cast<void (APIENTRY *)(const GLshort *)>(resolveFunc("glVertex3sv"));
- Vertex3s = reinterpret_cast<void (APIENTRY *)(GLshort , GLshort , GLshort )>(resolveFunc("glVertex3s"));
- Vertex3iv = reinterpret_cast<void (APIENTRY *)(const GLint *)>(resolveFunc("glVertex3iv"));
- Vertex3i = reinterpret_cast<void (APIENTRY *)(GLint , GLint , GLint )>(resolveFunc("glVertex3i"));
- Vertex3fv = reinterpret_cast<void (APIENTRY *)(const GLfloat *)>(resolveFunc("glVertex3fv"));
- Vertex3f = reinterpret_cast<void (APIENTRY *)(GLfloat , GLfloat , GLfloat )>(resolveFunc("glVertex3f"));
- Vertex3dv = reinterpret_cast<void (APIENTRY *)(const GLdouble *)>(resolveFunc("glVertex3dv"));
- Vertex3d = reinterpret_cast<void (APIENTRY *)(GLdouble , GLdouble , GLdouble )>(resolveFunc("glVertex3d"));
- Vertex2sv = reinterpret_cast<void (APIENTRY *)(const GLshort *)>(resolveFunc("glVertex2sv"));
- Vertex2s = reinterpret_cast<void (APIENTRY *)(GLshort , GLshort )>(resolveFunc("glVertex2s"));
- Vertex2iv = reinterpret_cast<void (APIENTRY *)(const GLint *)>(resolveFunc("glVertex2iv"));
- Vertex2i = reinterpret_cast<void (APIENTRY *)(GLint , GLint )>(resolveFunc("glVertex2i"));
- Vertex2fv = reinterpret_cast<void (APIENTRY *)(const GLfloat *)>(resolveFunc("glVertex2fv"));
- Vertex2f = reinterpret_cast<void (APIENTRY *)(GLfloat , GLfloat )>(resolveFunc("glVertex2f"));
- Vertex2dv = reinterpret_cast<void (APIENTRY *)(const GLdouble *)>(resolveFunc("glVertex2dv"));
- Vertex2d = reinterpret_cast<void (APIENTRY *)(GLdouble , GLdouble )>(resolveFunc("glVertex2d"));
- TexCoord4sv = reinterpret_cast<void (APIENTRY *)(const GLshort *)>(resolveFunc("glTexCoord4sv"));
- TexCoord4s = reinterpret_cast<void (APIENTRY *)(GLshort , GLshort , GLshort , GLshort )>(resolveFunc("glTexCoord4s"));
- TexCoord4iv = reinterpret_cast<void (APIENTRY *)(const GLint *)>(resolveFunc("glTexCoord4iv"));
- TexCoord4i = reinterpret_cast<void (APIENTRY *)(GLint , GLint , GLint , GLint )>(resolveFunc("glTexCoord4i"));
- TexCoord4fv = reinterpret_cast<void (APIENTRY *)(const GLfloat *)>(resolveFunc("glTexCoord4fv"));
- TexCoord4f = reinterpret_cast<void (APIENTRY *)(GLfloat , GLfloat , GLfloat , GLfloat )>(resolveFunc("glTexCoord4f"));
- TexCoord4dv = reinterpret_cast<void (APIENTRY *)(const GLdouble *)>(resolveFunc("glTexCoord4dv"));
- TexCoord4d = reinterpret_cast<void (APIENTRY *)(GLdouble , GLdouble , GLdouble , GLdouble )>(resolveFunc("glTexCoord4d"));
- TexCoord3sv = reinterpret_cast<void (APIENTRY *)(const GLshort *)>(resolveFunc("glTexCoord3sv"));
- TexCoord3s = reinterpret_cast<void (APIENTRY *)(GLshort , GLshort , GLshort )>(resolveFunc("glTexCoord3s"));
- TexCoord3iv = reinterpret_cast<void (APIENTRY *)(const GLint *)>(resolveFunc("glTexCoord3iv"));
- TexCoord3i = reinterpret_cast<void (APIENTRY *)(GLint , GLint , GLint )>(resolveFunc("glTexCoord3i"));
- TexCoord3fv = reinterpret_cast<void (APIENTRY *)(const GLfloat *)>(resolveFunc("glTexCoord3fv"));
- TexCoord3f = reinterpret_cast<void (APIENTRY *)(GLfloat , GLfloat , GLfloat )>(resolveFunc("glTexCoord3f"));
- TexCoord3dv = reinterpret_cast<void (APIENTRY *)(const GLdouble *)>(resolveFunc("glTexCoord3dv"));
- TexCoord3d = reinterpret_cast<void (APIENTRY *)(GLdouble , GLdouble , GLdouble )>(resolveFunc("glTexCoord3d"));
- TexCoord2sv = reinterpret_cast<void (APIENTRY *)(const GLshort *)>(resolveFunc("glTexCoord2sv"));
- TexCoord2s = reinterpret_cast<void (APIENTRY *)(GLshort , GLshort )>(resolveFunc("glTexCoord2s"));
- TexCoord2iv = reinterpret_cast<void (APIENTRY *)(const GLint *)>(resolveFunc("glTexCoord2iv"));
- TexCoord2i = reinterpret_cast<void (APIENTRY *)(GLint , GLint )>(resolveFunc("glTexCoord2i"));
- TexCoord2fv = reinterpret_cast<void (APIENTRY *)(const GLfloat *)>(resolveFunc("glTexCoord2fv"));
- TexCoord2f = reinterpret_cast<void (APIENTRY *)(GLfloat , GLfloat )>(resolveFunc("glTexCoord2f"));
- TexCoord2dv = reinterpret_cast<void (APIENTRY *)(const GLdouble *)>(resolveFunc("glTexCoord2dv"));
- TexCoord2d = reinterpret_cast<void (APIENTRY *)(GLdouble , GLdouble )>(resolveFunc("glTexCoord2d"));
- TexCoord1sv = reinterpret_cast<void (APIENTRY *)(const GLshort *)>(resolveFunc("glTexCoord1sv"));
- TexCoord1s = reinterpret_cast<void (APIENTRY *)(GLshort )>(resolveFunc("glTexCoord1s"));
- TexCoord1iv = reinterpret_cast<void (APIENTRY *)(const GLint *)>(resolveFunc("glTexCoord1iv"));
- TexCoord1i = reinterpret_cast<void (APIENTRY *)(GLint )>(resolveFunc("glTexCoord1i"));
- TexCoord1fv = reinterpret_cast<void (APIENTRY *)(const GLfloat *)>(resolveFunc("glTexCoord1fv"));
- TexCoord1f = reinterpret_cast<void (APIENTRY *)(GLfloat )>(resolveFunc("glTexCoord1f"));
- TexCoord1dv = reinterpret_cast<void (APIENTRY *)(const GLdouble *)>(resolveFunc("glTexCoord1dv"));
- TexCoord1d = reinterpret_cast<void (APIENTRY *)(GLdouble )>(resolveFunc("glTexCoord1d"));
- Rectsv = reinterpret_cast<void (APIENTRY *)(const GLshort *, const GLshort *)>(resolveFunc("glRectsv"));
- Rects = reinterpret_cast<void (APIENTRY *)(GLshort , GLshort , GLshort , GLshort )>(resolveFunc("glRects"));
- Rectiv = reinterpret_cast<void (APIENTRY *)(const GLint *, const GLint *)>(resolveFunc("glRectiv"));
- Recti = reinterpret_cast<void (APIENTRY *)(GLint , GLint , GLint , GLint )>(resolveFunc("glRecti"));
- Rectfv = reinterpret_cast<void (APIENTRY *)(const GLfloat *, const GLfloat *)>(resolveFunc("glRectfv"));
- Rectf = reinterpret_cast<void (APIENTRY *)(GLfloat , GLfloat , GLfloat , GLfloat )>(resolveFunc("glRectf"));
- Rectdv = reinterpret_cast<void (APIENTRY *)(const GLdouble *, const GLdouble *)>(resolveFunc("glRectdv"));
- Rectd = reinterpret_cast<void (APIENTRY *)(GLdouble , GLdouble , GLdouble , GLdouble )>(resolveFunc("glRectd"));
- RasterPos4sv = reinterpret_cast<void (APIENTRY *)(const GLshort *)>(resolveFunc("glRasterPos4sv"));
- RasterPos4s = reinterpret_cast<void (APIENTRY *)(GLshort , GLshort , GLshort , GLshort )>(resolveFunc("glRasterPos4s"));
- RasterPos4iv = reinterpret_cast<void (APIENTRY *)(const GLint *)>(resolveFunc("glRasterPos4iv"));
- RasterPos4i = reinterpret_cast<void (APIENTRY *)(GLint , GLint , GLint , GLint )>(resolveFunc("glRasterPos4i"));
- RasterPos4fv = reinterpret_cast<void (APIENTRY *)(const GLfloat *)>(resolveFunc("glRasterPos4fv"));
- RasterPos4f = reinterpret_cast<void (APIENTRY *)(GLfloat , GLfloat , GLfloat , GLfloat )>(resolveFunc("glRasterPos4f"));
- RasterPos4dv = reinterpret_cast<void (APIENTRY *)(const GLdouble *)>(resolveFunc("glRasterPos4dv"));
- RasterPos4d = reinterpret_cast<void (APIENTRY *)(GLdouble , GLdouble , GLdouble , GLdouble )>(resolveFunc("glRasterPos4d"));
- RasterPos3sv = reinterpret_cast<void (APIENTRY *)(const GLshort *)>(resolveFunc("glRasterPos3sv"));
- RasterPos3s = reinterpret_cast<void (APIENTRY *)(GLshort , GLshort , GLshort )>(resolveFunc("glRasterPos3s"));
- RasterPos3iv = reinterpret_cast<void (APIENTRY *)(const GLint *)>(resolveFunc("glRasterPos3iv"));
- RasterPos3i = reinterpret_cast<void (APIENTRY *)(GLint , GLint , GLint )>(resolveFunc("glRasterPos3i"));
- RasterPos3fv = reinterpret_cast<void (APIENTRY *)(const GLfloat *)>(resolveFunc("glRasterPos3fv"));
- RasterPos3f = reinterpret_cast<void (APIENTRY *)(GLfloat , GLfloat , GLfloat )>(resolveFunc("glRasterPos3f"));
- RasterPos3dv = reinterpret_cast<void (APIENTRY *)(const GLdouble *)>(resolveFunc("glRasterPos3dv"));
- RasterPos3d = reinterpret_cast<void (APIENTRY *)(GLdouble , GLdouble , GLdouble )>(resolveFunc("glRasterPos3d"));
- RasterPos2sv = reinterpret_cast<void (APIENTRY *)(const GLshort *)>(resolveFunc("glRasterPos2sv"));
- RasterPos2s = reinterpret_cast<void (APIENTRY *)(GLshort , GLshort )>(resolveFunc("glRasterPos2s"));
- RasterPos2iv = reinterpret_cast<void (APIENTRY *)(const GLint *)>(resolveFunc("glRasterPos2iv"));
- RasterPos2i = reinterpret_cast<void (APIENTRY *)(GLint , GLint )>(resolveFunc("glRasterPos2i"));
- RasterPos2fv = reinterpret_cast<void (APIENTRY *)(const GLfloat *)>(resolveFunc("glRasterPos2fv"));
- RasterPos2f = reinterpret_cast<void (APIENTRY *)(GLfloat , GLfloat )>(resolveFunc("glRasterPos2f"));
- RasterPos2dv = reinterpret_cast<void (APIENTRY *)(const GLdouble *)>(resolveFunc("glRasterPos2dv"));
- RasterPos2d = reinterpret_cast<void (APIENTRY *)(GLdouble , GLdouble )>(resolveFunc("glRasterPos2d"));
- Normal3sv = reinterpret_cast<void (APIENTRY *)(const GLshort *)>(resolveFunc("glNormal3sv"));
- Normal3s = reinterpret_cast<void (APIENTRY *)(GLshort , GLshort , GLshort )>(resolveFunc("glNormal3s"));
- Normal3iv = reinterpret_cast<void (APIENTRY *)(const GLint *)>(resolveFunc("glNormal3iv"));
- Normal3i = reinterpret_cast<void (APIENTRY *)(GLint , GLint , GLint )>(resolveFunc("glNormal3i"));
- Normal3fv = reinterpret_cast<void (APIENTRY *)(const GLfloat *)>(resolveFunc("glNormal3fv"));
- Normal3f = reinterpret_cast<void (APIENTRY *)(GLfloat , GLfloat , GLfloat )>(resolveFunc("glNormal3f"));
- Normal3dv = reinterpret_cast<void (APIENTRY *)(const GLdouble *)>(resolveFunc("glNormal3dv"));
- Normal3d = reinterpret_cast<void (APIENTRY *)(GLdouble , GLdouble , GLdouble )>(resolveFunc("glNormal3d"));
- Normal3bv = reinterpret_cast<void (APIENTRY *)(const GLbyte *)>(resolveFunc("glNormal3bv"));
- Normal3b = reinterpret_cast<void (APIENTRY *)(GLbyte , GLbyte , GLbyte )>(resolveFunc("glNormal3b"));
- Indexsv = reinterpret_cast<void (APIENTRY *)(const GLshort *)>(resolveFunc("glIndexsv"));
- Indexs = reinterpret_cast<void (APIENTRY *)(GLshort )>(resolveFunc("glIndexs"));
- Indexiv = reinterpret_cast<void (APIENTRY *)(const GLint *)>(resolveFunc("glIndexiv"));
- Indexi = reinterpret_cast<void (APIENTRY *)(GLint )>(resolveFunc("glIndexi"));
- Indexfv = reinterpret_cast<void (APIENTRY *)(const GLfloat *)>(resolveFunc("glIndexfv"));
- Indexf = reinterpret_cast<void (APIENTRY *)(GLfloat )>(resolveFunc("glIndexf"));
- Indexdv = reinterpret_cast<void (APIENTRY *)(const GLdouble *)>(resolveFunc("glIndexdv"));
- Indexd = reinterpret_cast<void (APIENTRY *)(GLdouble )>(resolveFunc("glIndexd"));
- End = reinterpret_cast<void (APIENTRY *)()>(resolveFunc("glEnd"));
- EdgeFlagv = reinterpret_cast<void (APIENTRY *)(const GLboolean *)>(resolveFunc("glEdgeFlagv"));
- EdgeFlag = reinterpret_cast<void (APIENTRY *)(GLboolean )>(resolveFunc("glEdgeFlag"));
- Color4usv = reinterpret_cast<void (APIENTRY *)(const GLushort *)>(resolveFunc("glColor4usv"));
- Color4us = reinterpret_cast<void (APIENTRY *)(GLushort , GLushort , GLushort , GLushort )>(resolveFunc("glColor4us"));
- Color4uiv = reinterpret_cast<void (APIENTRY *)(const GLuint *)>(resolveFunc("glColor4uiv"));
- Color4ui = reinterpret_cast<void (APIENTRY *)(GLuint , GLuint , GLuint , GLuint )>(resolveFunc("glColor4ui"));
- Color4ubv = reinterpret_cast<void (APIENTRY *)(const GLubyte *)>(resolveFunc("glColor4ubv"));
- Color4ub = reinterpret_cast<void (APIENTRY *)(GLubyte , GLubyte , GLubyte , GLubyte )>(resolveFunc("glColor4ub"));
- Color4sv = reinterpret_cast<void (APIENTRY *)(const GLshort *)>(resolveFunc("glColor4sv"));
- Color4s = reinterpret_cast<void (APIENTRY *)(GLshort , GLshort , GLshort , GLshort )>(resolveFunc("glColor4s"));
- Color4iv = reinterpret_cast<void (APIENTRY *)(const GLint *)>(resolveFunc("glColor4iv"));
- Color4i = reinterpret_cast<void (APIENTRY *)(GLint , GLint , GLint , GLint )>(resolveFunc("glColor4i"));
- Color4fv = reinterpret_cast<void (APIENTRY *)(const GLfloat *)>(resolveFunc("glColor4fv"));
- Color4f = reinterpret_cast<void (APIENTRY *)(GLfloat , GLfloat , GLfloat , GLfloat )>(resolveFunc("glColor4f"));
- Color4dv = reinterpret_cast<void (APIENTRY *)(const GLdouble *)>(resolveFunc("glColor4dv"));
- Color4d = reinterpret_cast<void (APIENTRY *)(GLdouble , GLdouble , GLdouble , GLdouble )>(resolveFunc("glColor4d"));
- Color4bv = reinterpret_cast<void (APIENTRY *)(const GLbyte *)>(resolveFunc("glColor4bv"));
- Color4b = reinterpret_cast<void (APIENTRY *)(GLbyte , GLbyte , GLbyte , GLbyte )>(resolveFunc("glColor4b"));
- Color3usv = reinterpret_cast<void (APIENTRY *)(const GLushort *)>(resolveFunc("glColor3usv"));
- Color3us = reinterpret_cast<void (APIENTRY *)(GLushort , GLushort , GLushort )>(resolveFunc("glColor3us"));
- Color3uiv = reinterpret_cast<void (APIENTRY *)(const GLuint *)>(resolveFunc("glColor3uiv"));
- Color3ui = reinterpret_cast<void (APIENTRY *)(GLuint , GLuint , GLuint )>(resolveFunc("glColor3ui"));
- Color3ubv = reinterpret_cast<void (APIENTRY *)(const GLubyte *)>(resolveFunc("glColor3ubv"));
- Color3ub = reinterpret_cast<void (APIENTRY *)(GLubyte , GLubyte , GLubyte )>(resolveFunc("glColor3ub"));
- Color3sv = reinterpret_cast<void (APIENTRY *)(const GLshort *)>(resolveFunc("glColor3sv"));
- Color3s = reinterpret_cast<void (APIENTRY *)(GLshort , GLshort , GLshort )>(resolveFunc("glColor3s"));
- Color3iv = reinterpret_cast<void (APIENTRY *)(const GLint *)>(resolveFunc("glColor3iv"));
- Color3i = reinterpret_cast<void (APIENTRY *)(GLint , GLint , GLint )>(resolveFunc("glColor3i"));
- Color3fv = reinterpret_cast<void (APIENTRY *)(const GLfloat *)>(resolveFunc("glColor3fv"));
- Color3f = reinterpret_cast<void (APIENTRY *)(GLfloat , GLfloat , GLfloat )>(resolveFunc("glColor3f"));
- Color3dv = reinterpret_cast<void (APIENTRY *)(const GLdouble *)>(resolveFunc("glColor3dv"));
- Color3d = reinterpret_cast<void (APIENTRY *)(GLdouble , GLdouble , GLdouble )>(resolveFunc("glColor3d"));
- Color3bv = reinterpret_cast<void (APIENTRY *)(const GLbyte *)>(resolveFunc("glColor3bv"));
- Color3b = reinterpret_cast<void (APIENTRY *)(GLbyte , GLbyte , GLbyte )>(resolveFunc("glColor3b"));
- Bitmap = reinterpret_cast<void (APIENTRY *)(GLsizei , GLsizei , GLfloat , GLfloat , GLfloat , GLfloat , const GLubyte *)>(resolveFunc("glBitmap"));
- Begin = reinterpret_cast<void (APIENTRY *)(GLenum )>(resolveFunc("glBegin"));
- ListBase = reinterpret_cast<void (APIENTRY *)(GLuint )>(resolveFunc("glListBase"));
- GenLists = reinterpret_cast<GLuint (APIENTRY *)(GLsizei )>(resolveFunc("glGenLists"));
- DeleteLists = reinterpret_cast<void (APIENTRY *)(GLuint , GLsizei )>(resolveFunc("glDeleteLists"));
- CallLists = reinterpret_cast<void (APIENTRY *)(GLsizei , GLenum , const GLvoid *)>(resolveFunc("glCallLists"));
- CallList = reinterpret_cast<void (APIENTRY *)(GLuint )>(resolveFunc("glCallList"));
- EndList = reinterpret_cast<void (APIENTRY *)()>(resolveFunc("glEndList"));
- NewList = reinterpret_cast<void (APIENTRY *)(GLuint , GLenum )>(resolveFunc("glNewList"));
-
- Indexubv = reinterpret_cast<void (APIENTRY *)(const GLubyte *)>(resolveFunc("glIndexubv"));
- Indexub = reinterpret_cast<void (APIENTRY *)(GLubyte )>(resolveFunc("glIndexub"));
- TexSubImage1D = reinterpret_cast<void (APIENTRY *)(GLenum , GLint , GLint , GLsizei , GLenum , GLenum , const GLvoid *)>(resolveFunc("glTexSubImage1D"));
- CopyTexSubImage1D = reinterpret_cast<void (APIENTRY *)(GLenum , GLint , GLint , GLint , GLint , GLsizei )>(resolveFunc("glCopyTexSubImage1D"));
- CopyTexImage1D = reinterpret_cast<void (APIENTRY *)(GLenum , GLint , GLenum , GLint , GLint , GLsizei , GLint )>(resolveFunc("glCopyTexImage1D"));
- GetPointerv = reinterpret_cast<void (APIENTRY *)(GLenum , GLvoid* *)>(resolveFunc("glGetPointerv"));
-
- PushClientAttrib = reinterpret_cast<void (APIENTRY *)(GLbitfield )>(resolveFunc("glPushClientAttrib"));
- PopClientAttrib = reinterpret_cast<void (APIENTRY *)()>(resolveFunc("glPopClientAttrib"));
- PrioritizeTextures = reinterpret_cast<void (APIENTRY *)(GLsizei , const GLuint *, const GLfloat *)>(resolveFunc("glPrioritizeTextures"));
- AreTexturesResident = reinterpret_cast<GLboolean (APIENTRY *)(GLsizei , const GLuint *, GLboolean *)>(resolveFunc("glAreTexturesResident"));
- VertexPointer = reinterpret_cast<void (APIENTRY *)(GLint , GLenum , GLsizei , const GLvoid *)>(resolveFunc("glVertexPointer"));
- TexCoordPointer = reinterpret_cast<void (APIENTRY *)(GLint , GLenum , GLsizei , const GLvoid *)>(resolveFunc("glTexCoordPointer"));
- NormalPointer = reinterpret_cast<void (APIENTRY *)(GLenum , GLsizei , const GLvoid *)>(resolveFunc("glNormalPointer"));
- InterleavedArrays = reinterpret_cast<void (APIENTRY *)(GLenum , GLsizei , const GLvoid *)>(resolveFunc("glInterleavedArrays"));
- IndexPointer = reinterpret_cast<void (APIENTRY *)(GLenum , GLsizei , const GLvoid *)>(resolveFunc("glIndexPointer"));
- EnableClientState = reinterpret_cast<void (APIENTRY *)(GLenum )>(resolveFunc("glEnableClientState"));
- EdgeFlagPointer = reinterpret_cast<void (APIENTRY *)(GLsizei , const GLvoid *)>(resolveFunc("glEdgeFlagPointer"));
- DisableClientState = reinterpret_cast<void (APIENTRY *)(GLenum )>(resolveFunc("glDisableClientState"));
- ColorPointer = reinterpret_cast<void (APIENTRY *)(GLint , GLenum , GLsizei , const GLvoid *)>(resolveFunc("glColorPointer"));
- ArrayElement = reinterpret_cast<void (APIENTRY *)(GLint )>(resolveFunc("glArrayElement"));
-}
-
-void QWindowsOpenGL::resolveGLES2()
-{
- ActiveTexture = reinterpret_cast<void (APIENTRY *)(GLenum)>(resolveFunc("glActiveTexture"));
- AttachShader = reinterpret_cast<void (APIENTRY *)(GLuint , GLuint )>(resolveFunc("glAttachShader"));
- BindAttribLocation = reinterpret_cast<void (APIENTRY *)(GLuint , GLuint , const GLchar* )>(resolveFunc("glBindAttribLocation"));
- BindBuffer = reinterpret_cast<void (APIENTRY *)(GLenum , GLuint )>(resolveFunc("glBindBuffer"));
- BindFramebuffer = reinterpret_cast<void (APIENTRY *)(GLenum , GLuint )>(resolveFunc("glBindFramebuffer"));
- BindRenderbuffer = reinterpret_cast<void (APIENTRY *)(GLenum , GLuint )>(resolveFunc("glBindRenderbuffer"));
- BlendColor = reinterpret_cast<void (APIENTRY *)(GLclampf , GLclampf , GLclampf , GLclampf )>(resolveFunc("glBlendColor"));
- BlendEquation = reinterpret_cast<void (APIENTRY *)(GLenum )>(resolveFunc("glBlendEquation"));
- BlendEquationSeparate = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum )>(resolveFunc("glBlendEquationSeparate"));
- BlendFuncSeparate = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLenum , GLenum )>(resolveFunc("glBlendFuncSeparate"));
- BufferData = reinterpret_cast<void (APIENTRY *)(GLenum , GLsizeiptr , const GLvoid* , GLenum )>(resolveFunc("glBufferData"));
- BufferSubData = reinterpret_cast<void (APIENTRY *)(GLenum , GLintptr , GLsizeiptr , const GLvoid* )>(resolveFunc("glBufferSubData"));
- CheckFramebufferStatus = reinterpret_cast<GLenum (APIENTRY *)(GLenum )>(resolveFunc("glCheckFramebufferStatus"));
- ClearDepthf = reinterpret_cast<void (APIENTRY *)(GLclampf )>(resolveFunc("glClearDepthf"));
- CompileShader = reinterpret_cast<void (APIENTRY *)(GLuint )>(resolveFunc("glCompileShader"));
- CompressedTexImage2D = reinterpret_cast<void (APIENTRY *)(GLenum , GLint , GLenum , GLsizei , GLsizei, GLint, GLsizei, const GLvoid* )>(resolveFunc("glCompressedTexImage2D"));
- CompressedTexSubImage2D = reinterpret_cast<void (APIENTRY *)(GLenum , GLint , GLint , GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid* )>(resolveFunc("glCompressedTexSubImage2D"));
- CreateProgram = reinterpret_cast<GLuint (APIENTRY *)(void)>(resolveFunc("glCreateProgram"));
- CreateShader = reinterpret_cast<GLuint (APIENTRY *)(GLenum )>(resolveFunc("glCreateShader"));
- DeleteBuffers = reinterpret_cast<void (APIENTRY *)(GLsizei , const GLuint*)>(resolveFunc("glDeleteBuffers"));
- DeleteFramebuffers = reinterpret_cast<void (APIENTRY *)(GLsizei , const GLuint* )>(resolveFunc("glDeleteFramebuffers"));
- DeleteProgram = reinterpret_cast<void (APIENTRY *)(GLuint )>(resolveFunc("glDeleteProgram"));
- DeleteRenderbuffers = reinterpret_cast<void (APIENTRY *)(GLsizei , const GLuint* )>(resolveFunc("glDeleteRenderbuffers"));
- DeleteShader = reinterpret_cast<void (APIENTRY *)(GLuint )>(resolveFunc("glDeleteShader"));
- DepthRangef = reinterpret_cast<void (APIENTRY *)(GLclampf , GLclampf )>(resolveFunc("glDepthRangef"));
- DetachShader = reinterpret_cast<void (APIENTRY *)(GLuint , GLuint )>(resolveFunc("glDetachShader"));
- DisableVertexAttribArray = reinterpret_cast<void (APIENTRY *)(GLuint )>(resolveFunc("glDisableVertexAttribArray"));
- EnableVertexAttribArray = reinterpret_cast<void (APIENTRY *)(GLuint )>(resolveFunc("glEnableVertexAttribArray"));
- FramebufferRenderbuffer = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLenum , GLuint )>(resolveFunc("glFramebufferRenderbuffer"));
- FramebufferTexture2D = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLenum , GLuint , GLint )>(resolveFunc("glFramebufferTexture2D"));
- GenBuffers = reinterpret_cast<void (APIENTRY *)(GLsizei , GLuint* )>(resolveFunc("glGenBuffers"));
- GenerateMipmap = reinterpret_cast<void (APIENTRY *)(GLenum )>(resolveFunc("glGenerateMipmap"));
- GenFramebuffers = reinterpret_cast<void (APIENTRY *)(GLsizei , GLuint* )>(resolveFunc("glGenFramebuffers"));
- GenRenderbuffers = reinterpret_cast<void (APIENTRY *)(GLsizei , GLuint* )>(resolveFunc("glGenRenderbuffers"));
- GetActiveAttrib = reinterpret_cast<void (APIENTRY *)(GLuint , GLuint , GLsizei , GLsizei* , GLint* , GLenum* , GLchar* )>(resolveFunc("glGetActiveAttrib"));
- GetActiveUniform = reinterpret_cast<void (APIENTRY *)(GLuint , GLuint , GLsizei , GLsizei* , GLint* , GLenum* , GLchar* )>(resolveFunc("glGetActiveUniform"));
- GetAttachedShaders = reinterpret_cast<void (APIENTRY *)(GLuint , GLsizei , GLsizei*, GLuint* )>(resolveFunc("glGetAttachedShaders"));
- GetAttribLocation = reinterpret_cast<int (APIENTRY *)(GLuint , const GLchar* )>(resolveFunc("glGetAttribLocation"));
- GetBufferParameteriv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLint* )>(resolveFunc("glGetBufferParameteriv"));
- GetFramebufferAttachmentParameteriv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum, GLenum , GLint* )>(resolveFunc("glGetFramebufferAttachmentParameteriv"));
- GetProgramiv = reinterpret_cast<void (APIENTRY *)(GLuint , GLenum , GLint* )>(resolveFunc("glGetProgramiv"));
- GetProgramInfoLog = reinterpret_cast<void (APIENTRY *)(GLuint , GLsizei , GLsizei* , GLchar* )>(resolveFunc("glGetProgramInfoLog"));
- GetRenderbufferParameteriv = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLint* )>(resolveFunc("glGetRenderbufferParameteriv"));
- GetShaderiv = reinterpret_cast<void (APIENTRY *)(GLuint , GLenum , GLint* )>(resolveFunc("glGetShaderiv"));
- GetShaderInfoLog = reinterpret_cast<void (APIENTRY *)(GLuint , GLsizei , GLsizei*, GLchar*)>(resolveFunc("glGetShaderInfoLog"));
- GetShaderPrecisionFormat = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLint* , GLint* )>(resolveFunc("glGetShaderPrecisionFormat"));
- GetShaderSource = reinterpret_cast<void (APIENTRY *)(GLuint , GLsizei , GLsizei* , GLchar* )>(resolveFunc("glGetShaderSource"));
- GetUniformfv = reinterpret_cast<void (APIENTRY *)(GLuint , GLint , GLfloat*)>(resolveFunc("glGetUniformfv"));
- GetUniformiv = reinterpret_cast<void (APIENTRY *)(GLuint , GLint , GLint*)>(resolveFunc("glGetUniformiv"));
- GetUniformLocation = reinterpret_cast<int (APIENTRY *)(GLuint , const GLchar* )>(resolveFunc("glGetUniformLocation"));
- GetVertexAttribfv = reinterpret_cast<void (APIENTRY *)(GLuint , GLenum , GLfloat* )>(resolveFunc("glGetVertexAttribfv"));
- GetVertexAttribiv = reinterpret_cast<void (APIENTRY *)(GLuint , GLenum , GLint* )>(resolveFunc("glGetVertexAttribiv"));
- GetVertexAttribPointerv = reinterpret_cast<void (APIENTRY *)(GLuint , GLenum , GLvoid** pointer)>(resolveFunc("glGetVertexAttribPointerv"));
- IsBuffer = reinterpret_cast<GLboolean (APIENTRY *)(GLuint )>(resolveFunc("glIsBuffer"));
- IsFramebuffer = reinterpret_cast<GLboolean (APIENTRY *)(GLuint )>(resolveFunc("glIsFramebuffer"));
- IsProgram = reinterpret_cast<GLboolean (APIENTRY *)(GLuint )>(resolveFunc("glIsProgram"));
- IsRenderbuffer = reinterpret_cast<GLboolean (APIENTRY *)(GLuint )>(resolveFunc("glIsRenderbuffer"));
- IsShader = reinterpret_cast<GLboolean (APIENTRY *)(GLuint )>(resolveFunc("glIsShader"));
- LinkProgram = reinterpret_cast<void (APIENTRY *)(GLuint )>(resolveFunc("glLinkProgram"));
- ReleaseShaderCompiler = reinterpret_cast<void (APIENTRY *)(void)>(resolveFunc("glReleaseShaderCompiler"));
- RenderbufferStorage = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLsizei , GLsizei )>(resolveFunc("glRenderbufferStorage"));
- SampleCoverage = reinterpret_cast<void (APIENTRY *)(GLclampf , GLboolean )>(resolveFunc("glSampleCoverage"));
- ShaderBinary = reinterpret_cast<void (APIENTRY *)(GLsizei , const GLuint*, GLenum , const GLvoid* , GLsizei )>(resolveFunc("glShaderBinary"));
- ShaderSource = reinterpret_cast<void (APIENTRY *)(GLuint , GLsizei , const GLchar* *, const GLint* )>(resolveFunc("glShaderSource"));
- StencilFuncSeparate = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLint , GLuint )>(resolveFunc("glStencilFuncSeparate"));
- StencilMaskSeparate = reinterpret_cast<void (APIENTRY *)(GLenum , GLuint )>(resolveFunc("glStencilMaskSeparate"));
- StencilOpSeparate = reinterpret_cast<void (APIENTRY *)(GLenum , GLenum , GLenum , GLenum )>(resolveFunc("glStencilOpSeparate"));
- Uniform1f = reinterpret_cast<void (APIENTRY *)(GLint , GLfloat )>(resolveFunc("glUniform1f"));
- Uniform1fv = reinterpret_cast<void (APIENTRY *)(GLint , GLsizei , const GLfloat* )>(resolveFunc("glUniform1fv"));
- Uniform1i = reinterpret_cast<void (APIENTRY *)(GLint , GLint )>(resolveFunc("glUniform1i"));
- Uniform1iv = reinterpret_cast<void (APIENTRY *)(GLint , GLsizei , const GLint* )>(resolveFunc("glUniform1iv"));
- Uniform2f = reinterpret_cast<void (APIENTRY *)(GLint , GLfloat , GLfloat )>(resolveFunc("glUniform2f"));
- Uniform2fv = reinterpret_cast<void (APIENTRY *)(GLint , GLsizei , const GLfloat* )>(resolveFunc("glUniform2fv"));
- Uniform2i = reinterpret_cast<void (APIENTRY *)(GLint , GLint , GLint )>(resolveFunc("glUniform2i"));
- Uniform2iv = reinterpret_cast<void (APIENTRY *)(GLint , GLsizei , const GLint* )>(resolveFunc("glUniform2iv"));
- Uniform3f = reinterpret_cast<void (APIENTRY *)(GLint , GLfloat , GLfloat , GLfloat )>(resolveFunc("glUniform3f"));
- Uniform3fv = reinterpret_cast<void (APIENTRY *)(GLint , GLsizei , const GLfloat* )>(resolveFunc("glUniform3fv"));
- Uniform3i = reinterpret_cast<void (APIENTRY *)(GLint , GLint , GLint , GLint )>(resolveFunc("glUniform3i"));
- Uniform3iv = reinterpret_cast<void (APIENTRY *)(GLint , GLsizei , const GLint* )>(resolveFunc("glUniform3iv"));
- Uniform4f = reinterpret_cast<void (APIENTRY *)(GLint , GLfloat , GLfloat , GLfloat , GLfloat )>(resolveFunc("glUniform4f"));
- Uniform4fv = reinterpret_cast<void (APIENTRY *)(GLint , GLsizei , const GLfloat* )>(resolveFunc("glUniform4fv"));
- Uniform4i = reinterpret_cast<void (APIENTRY *)(GLint , GLint , GLint , GLint , GLint )>(resolveFunc("glUniform4i"));
- Uniform4iv = reinterpret_cast<void (APIENTRY *)(GLint , GLsizei , const GLint* )>(resolveFunc("glUniform4iv"));
- UniformMatrix2fv = reinterpret_cast<void (APIENTRY *)(GLint , GLsizei , GLboolean , const GLfloat* )>(resolveFunc("glUniformMatrix2fv"));
- UniformMatrix3fv = reinterpret_cast<void (APIENTRY *)(GLint , GLsizei , GLboolean , const GLfloat* )>(resolveFunc("glUniformMatrix3fv"));
- UniformMatrix4fv = reinterpret_cast<void (APIENTRY *)(GLint , GLsizei , GLboolean , const GLfloat* )>(resolveFunc("glUniformMatrix4fv"));
- UseProgram = reinterpret_cast<void (APIENTRY *)(GLuint )>(resolveFunc("glUseProgram"));
- ValidateProgram = reinterpret_cast<void (APIENTRY *)(GLuint )>(resolveFunc("glValidateProgram"));
- VertexAttrib1f = reinterpret_cast<void (APIENTRY *)(GLuint , GLfloat )>(resolveFunc("glVertexAttrib1f"));
- VertexAttrib1fv = reinterpret_cast<void (APIENTRY *)(GLuint , const GLfloat* )>(resolveFunc("glVertexAttrib1fv"));
- VertexAttrib2f = reinterpret_cast<void (APIENTRY *)(GLuint , GLfloat , GLfloat )>(resolveFunc("glVertexAttrib2f"));
- VertexAttrib2fv = reinterpret_cast<void (APIENTRY *)(GLuint , const GLfloat* )>(resolveFunc("glVertexAttrib2fv"));
- VertexAttrib3f = reinterpret_cast<void (APIENTRY *)(GLuint , GLfloat , GLfloat , GLfloat )>(resolveFunc("glVertexAttrib3f"));
- VertexAttrib3fv = reinterpret_cast<void (APIENTRY *)(GLuint , const GLfloat* )>(resolveFunc("glVertexAttrib3fv"));
- VertexAttrib4f = reinterpret_cast<void (APIENTRY *)(GLuint , GLfloat , GLfloat , GLfloat , GLfloat )>(resolveFunc("glVertexAttrib4f"));
- VertexAttrib4fv = reinterpret_cast<void (APIENTRY *)(GLuint , const GLfloat* )>(resolveFunc("glVertexAttrib4fv"));
- VertexAttribPointer = reinterpret_cast<void (APIENTRY *)(GLuint , GLint, GLenum, GLboolean, GLsizei, const GLvoid* )>(resolveFunc("glVertexAttribPointer"));
-}
-
-void QWindowsOpenGL::resolve()
-{
- switch (libraryType()) {
- case DesktopGL:
- resolveWGL();
- resolveGLCommon();
- resolveGL11();
- break;
-
- case GLES2:
- resolveEGL();
- resolveGLCommon();
- resolveGLES2();
- break;
-
- default:
- Q_ASSERT_X(0, "QWindowsOpenGL", "Nothing to resolve");
- break;
- }
-}
-
-bool QWindowsOpenGL::testDesktopGL()
-{
- HMODULE lib = 0;
- HWND wnd = 0;
- HDC dc = 0;
- HGLRC context = 0;
- LPCTSTR className = L"qtopenglproxytest";
-
- HGLRC (WINAPI * CreateContext)(HDC dc) = 0;
- BOOL (WINAPI * DeleteContext)(HGLRC context) = 0;
- BOOL (WINAPI * MakeCurrent)(HDC dc, HGLRC context) = 0;
- PROC (WINAPI * WGL_GetProcAddress)(LPCSTR name) = 0;
-
- bool result = false;
-
- // Test #1: Load opengl32.dll and try to resolve an OpenGL 2 function.
- // This will typically fail on systems that do not have a real OpenGL driver.
- lib = qgl_loadLib("opengl32.dll", false);
- if (lib) {
- CreateContext = reinterpret_cast<HGLRC (WINAPI *)(HDC)>(::GetProcAddress(lib, "wglCreateContext"));
- if (!CreateContext)
- goto cleanup;
- DeleteContext = reinterpret_cast<BOOL (WINAPI *)(HGLRC)>(::GetProcAddress(lib, "wglDeleteContext"));
- if (!DeleteContext)
- goto cleanup;
- MakeCurrent = reinterpret_cast<BOOL (WINAPI *)(HDC, HGLRC)>(::GetProcAddress(lib, "wglMakeCurrent"));
- if (!MakeCurrent)
- goto cleanup;
- WGL_GetProcAddress = reinterpret_cast<PROC (WINAPI *)(LPCSTR)>(::GetProcAddress(lib, "wglGetProcAddress"));
- if (!WGL_GetProcAddress)
- goto cleanup;
-
- WNDCLASS wclass;
- wclass.cbClsExtra = 0;
- wclass.cbWndExtra = 0;
- wclass.hInstance = (HINSTANCE) GetModuleHandle(0);
- wclass.hIcon = 0;
- wclass.hCursor = 0;
- wclass.hbrBackground = (HBRUSH) (COLOR_BACKGROUND);
- wclass.lpszMenuName = 0;
- wclass.lpfnWndProc = DefWindowProc;
- wclass.lpszClassName = className;
- wclass.style = CS_OWNDC;
- if (!RegisterClass(&wclass))
- goto cleanup;
- wnd = CreateWindow(className, L"qtopenglproxytest", WS_OVERLAPPED,
- 0, 0, 640, 480, 0, 0, wclass.hInstance, 0);
- if (!wnd)
- goto cleanup;
- dc = GetDC(wnd);
- if (!dc)
- goto cleanup;
-
- PIXELFORMATDESCRIPTOR pfd;
- memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR));
- pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
- pfd.nVersion = 1;
- pfd.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | PFD_GENERIC_FORMAT;
- pfd.iPixelType = PFD_TYPE_RGBA;
- // Use the GDI functions. Under the hood this will call the wgl variants in opengl32.dll.
- int pixelFormat = ChoosePixelFormat(dc, &pfd);
- if (!pixelFormat)
- goto cleanup;
- if (!SetPixelFormat(dc, pixelFormat, &pfd))
- goto cleanup;
- context = CreateContext(dc);
- if (!context)
- goto cleanup;
- if (!MakeCurrent(dc, context))
- goto cleanup;
-
- // Now that there is finally a context current, try doing something useful.
- if (WGL_GetProcAddress("glCreateShader")) {
- result = true;
- qCDebug(qglLc, "OpenGL 2 entry points available");
- } else {
- qCDebug(qglLc, "OpenGL 2 entry points not found");
- }
- } else {
- qCDebug(qglLc, "Failed to load opengl32.dll");
- }
-
-cleanup:
- if (MakeCurrent)
- MakeCurrent(0, 0);
- if (context)
- DeleteContext(context);
- if (dc && wnd)
- ReleaseDC(wnd, dc);
- if (wnd)
- DestroyWindow(wnd);
- UnregisterClass(className, GetModuleHandle(0));
- if (lib)
- FreeLibrary(lib);
-
- return result;
-}
-
-class QWindowsOpenGLList
-{
-public:
- QWindowsOpenGLList();
- ~QWindowsOpenGLList();
- QVector<QAbstractWindowsOpenGL *> list;
-};
-
-QWindowsOpenGLList::QWindowsOpenGLList()
-{
- // For now there is always one OpenGL ( + winsys interface) loaded.
- // This may change in the future.
- list.append(new QWindowsOpenGL);
-}
-
-QWindowsOpenGLList::~QWindowsOpenGLList()
-{
- qDeleteAll(list);
-}
-
-// Use Q_GLOBAL_STATIC and perform initialization in the constructor to be
-// thread safe.
-Q_GLOBAL_STATIC(QWindowsOpenGLList, gl)
-
-static inline QAbstractWindowsOpenGL *qgl_choose()
-{
- return gl()->list[0];
-}
-
-// functionsReady() -> the DLL is there but some functions were not resolved. This is fatal.
-// !functionsReady() -> could not load a GL implementation. No error message in this case.
-#define GLWARN(g, func, prefix) \
- { \
- if (g->functionsReady()) \
- qFatal("Qt OpenGL: Attempted to call unresolved function %s%s. " \
- "This is likely caused by making OpenGL-only calls with an OpenGL ES implementation (Angle).", \
- prefix, #func); \
- }
-
-#define GLCALLV(func, ...) \
- { \
- QAbstractWindowsOpenGL *g = qgl_choose(); \
- if (g->func) \
- g->func(__VA_ARGS__); \
- else \
- GLWARN(g, func, "gl") \
- }
-
-#define GLCALL(func, ...) \
- { \
- QAbstractWindowsOpenGL *g = qgl_choose(); \
- if (g->func) \
- return g->func(__VA_ARGS__); \
- GLWARN(g, func, "gl") \
- return 0; \
- }
-
-#define WGLCALL(func, ...) \
- { \
- QAbstractWindowsOpenGL *g = qgl_choose(); \
- if (g->func) \
- return g->func(__VA_ARGS__); \
- GLWARN(g, func, "wgl") \
- return 0; \
- }
-
-#define EGLCALL(func, ...) \
- { \
- QAbstractWindowsOpenGL *g = qgl_choose(); \
- if (g->EGL_##func) \
- return g->EGL_##func(__VA_ARGS__); \
- GLWARN(g, func, "egl") \
- return 0; \
- }
-
-
-extern "C" {
-
-// WGL
-
-Q_DECL_EXPORT BOOL WINAPI wglCopyContext(HGLRC src, HGLRC dst, UINT mask)
-{
- WGLCALL(CopyContext, src, dst, mask);
-}
-
-Q_DECL_EXPORT HGLRC WINAPI wglCreateContext(HDC dc)
-{
- WGLCALL(CreateContext, dc);
-}
-
-Q_DECL_EXPORT HGLRC WINAPI wglCreateLayerContext(HDC dc, int plane)
-{
- WGLCALL(CreateLayerContext, dc, plane);
-}
-
-Q_DECL_EXPORT BOOL WINAPI wglDeleteContext(HGLRC context)
-{
- WGLCALL(DeleteContext, context);
-}
-
-Q_DECL_EXPORT HGLRC WINAPI wglGetCurrentContext(VOID)
-{
- WGLCALL(GetCurrentContext);
-}
-
-Q_DECL_EXPORT HDC WINAPI wglGetCurrentDC(VOID)
-{
- WGLCALL(GetCurrentDC);
-}
-
-Q_DECL_EXPORT PROC WINAPI wglGetProcAddress(LPCSTR name)
-{
- WGLCALL(GetProcAddress, name);
-}
-
-Q_DECL_EXPORT BOOL WINAPI wglMakeCurrent(HDC dc, HGLRC context)
-{
- WGLCALL(MakeCurrent, dc, context);
-}
-
-Q_DECL_EXPORT BOOL WINAPI wglShareLists(HGLRC context1, HGLRC context2)
-{
- WGLCALL(ShareLists, context1, context2);
-}
-
-Q_DECL_EXPORT BOOL WINAPI wglUseFontBitmapsW(HDC dc, DWORD first, DWORD count, DWORD base)
-{
- WGLCALL(UseFontBitmapsW, dc, first, count, base);
-}
-
-Q_DECL_EXPORT BOOL WINAPI wglUseFontOutlinesW(HDC dc, DWORD first, DWORD count, DWORD base, FLOAT deviation,
- FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT gmf)
-{
- WGLCALL(UseFontOutlinesW, dc, first, count, base, deviation, extrusion, format, gmf);
-}
-
-Q_DECL_EXPORT BOOL WINAPI wglDescribeLayerPlane(HDC dc, int pixelFormat, int plane, UINT n,
- LPLAYERPLANEDESCRIPTOR planeDescriptor)
-{
- WGLCALL(DescribeLayerPlane, dc, pixelFormat, plane, n, planeDescriptor);
-}
-
-Q_DECL_EXPORT int WINAPI wglSetLayerPaletteEntries(HDC dc, int plane, int start, int entries,
- CONST COLORREF *colors)
-{
- WGLCALL(SetLayerPaletteEntries, dc, plane, start, entries, colors);
-}
-
-Q_DECL_EXPORT int WINAPI wglGetLayerPaletteEntries(HDC dc, int plane, int start, int entries,
- COLORREF *color)
-{
- WGLCALL(GetLayerPaletteEntries, dc, plane, start, entries, color);
-}
-
-Q_DECL_EXPORT BOOL WINAPI wglRealizeLayerPalette(HDC dc, int plane, BOOL realize)
-{
- WGLCALL(RealizeLayerPalette, dc, plane, realize);
-}
-
-Q_DECL_EXPORT BOOL WINAPI wglSwapLayerBuffers(HDC dc, UINT planes)
-{
- WGLCALL(SwapLayerBuffers, dc, planes);
-}
-
-Q_DECL_EXPORT DWORD WINAPI wglSwapMultipleBuffers(UINT n, CONST WGLSWAP *buffers)
-{
- WGLCALL(SwapMultipleBuffers, n, buffers);
-}
-
-// EGL
-
-Q_DECL_EXPORT EGLint EGLAPIENTRY eglGetError(void)
-{
- EGLCALL(GetError);
-}
-
-Q_DECL_EXPORT EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id)
-{
- EGLCALL(GetDisplay, display_id);
-}
-
-Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
-{
- EGLCALL(Initialize, dpy, major, minor);
-}
-
-Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy)
-{
- EGLCALL(Terminate, dpy);
-}
-
-Q_DECL_EXPORT const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name)
-{
- EGLCALL(QueryString, dpy, name);
-}
-
-Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs,
- EGLint config_size, EGLint *num_config)
-{
- EGLCALL(GetConfigs, dpy, configs, config_size, num_config);
-}
-
-Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list,
- EGLConfig *configs, EGLint config_size,
- EGLint *num_config)
-{
- EGLCALL(ChooseConfig, dpy, attrib_list, configs, config_size, num_config);
-}
-
-Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
- EGLint attribute, EGLint *value)
-{
- EGLCALL(GetConfigAttrib, dpy, config, attribute, value);
-}
-
-Q_DECL_EXPORT EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
- EGLNativeWindowType win,
- const EGLint *attrib_list)
-{
- EGLCALL(CreateWindowSurface, dpy, config, win, attrib_list);
-}
-
-Q_DECL_EXPORT EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
- const EGLint *attrib_list)
-{
- EGLCALL(CreatePbufferSurface, dpy, config, attrib_list);
-}
-
-Q_DECL_EXPORT EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
- EGLNativePixmapType pixmap,
- const EGLint *attrib_list)
-{
- EGLCALL(CreatePixmapSurface, dpy, config, pixmap, attrib_list);
-}
-
-Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
-{
- EGLCALL(DestroySurface, dpy, surface);
-}
-
-Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface,
- EGLint attribute, EGLint *value)
-{
- EGLCALL(QuerySurface, dpy, surface, attribute, value);
-}
-
-Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api)
-{
- EGLCALL(BindAPI, api);
-}
-
-Q_DECL_EXPORT EGLenum EGLAPIENTRY eglQueryAPI(void)
-{
- EGLCALL(QueryAPI);
-}
-
-Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglWaitClient(void)
-{
- EGLCALL(WaitClient);
-}
-
-Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglReleaseThread(void)
-{
- EGLCALL(ReleaseThread);
-}
-
-Q_DECL_EXPORT EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(
- EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
- EGLConfig config, const EGLint *attrib_list)
-{
- EGLCALL(CreatePbufferFromClientBuffer, dpy, buftype, buffer, config, attrib_list);
-}
-
-Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface,
- EGLint attribute, EGLint value)
-{
- EGLCALL(SurfaceAttrib, dpy, surface, attribute, value);
-}
-
-Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
-{
- EGLCALL(BindTexImage, dpy, surface, buffer);
-}
-
-Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
-{
- EGLCALL(ReleaseTexImage, dpy, surface, buffer);
-}
-
-Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval)
-{
- EGLCALL(SwapInterval, dpy, interval);
-}
-
-Q_DECL_EXPORT EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config,
- EGLContext share_context,
- const EGLint *attrib_list)
-{
- EGLCALL(CreateContext, dpy, config, share_context, attrib_list);
-}
-
-Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
-{
- EGLCALL(DestroyContext, dpy, ctx);
-}
-
-Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw,
- EGLSurface read, EGLContext ctx)
-{
- EGLCALL(MakeCurrent, dpy, draw, read, ctx);
-}
-
-Q_DECL_EXPORT EGLContext EGLAPIENTRY eglGetCurrentContext(void)
-{
- EGLCALL(GetCurrentContext);
-}
-
-Q_DECL_EXPORT EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw)
-{
- EGLCALL(GetCurrentSurface, readdraw);
-}
-
-Q_DECL_EXPORT EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void)
-{
- EGLCALL(GetCurrentDisplay);
-}
-
-Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx,
- EGLint attribute, EGLint *value)
-{
- EGLCALL(QueryContext, dpy, ctx, attribute, value);
-}
-
-Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglWaitGL(void)
-{
- EGLCALL(WaitGL);
-}
-
-Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine)
-{
- EGLCALL(WaitNative, engine);
-}
-
-Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
-{
- EGLCALL(SwapBuffers, dpy, surface);
-}
-
-Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface,
- EGLNativePixmapType target)
-{
- EGLCALL(CopyBuffers, dpy, surface, target);
-}
-
-// OpenGL
-
-Q_DECL_EXPORT void APIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- GLCALLV(Viewport, x, y, width, height);
-}
-
-Q_DECL_EXPORT void APIENTRY glDepthRange(GLdouble nearVal, GLdouble farVal)
-{
- if (qgl_choose()->libraryType() == QAbstractWindowsOpenGL::DesktopGL) {
- GLCALLV(DepthRange, nearVal, farVal);
- } else {
- GLCALLV(DepthRangef, nearVal, farVal);
- }
-}
-
-Q_DECL_EXPORT GLboolean APIENTRY glIsEnabled(GLenum cap)
-{
- GLCALL(IsEnabled, cap);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
-{
- GLCALLV(GetTexLevelParameteriv, target, level, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
-{
- GLCALLV(GetTexLevelParameterfv, target, level, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- GLCALLV(GetTexParameteriv, target, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- GLCALLV(GetTexParameterfv, target, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
-{
- GLCALLV(GetTexImage, target, level, format, type, pixels);
-}
-
-Q_DECL_EXPORT const GLubyte * APIENTRY glGetString(GLenum name)
-{
- GLCALL(GetString, name);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetIntegerv(GLenum pname, GLint *params)
-{
- GLCALLV(GetIntegerv, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetFloatv(GLenum pname, GLfloat *params)
-{
- GLCALLV(GetFloatv, pname, params);
-}
-
-Q_DECL_EXPORT GLenum APIENTRY glGetError()
-{
- GLCALL(GetError);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetDoublev(GLenum pname, GLdouble *params)
-{
- GLCALLV(GetDoublev, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetBooleanv(GLenum pname, GLboolean *params)
-{
- GLCALLV(GetBooleanv, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-{
- GLCALLV(ReadPixels, x, y, width, height, format, type, pixels);
-}
-
-Q_DECL_EXPORT void APIENTRY glReadBuffer(GLenum mode)
-{
- GLCALLV(ReadBuffer, mode);
-}
-
-Q_DECL_EXPORT void APIENTRY glPixelStorei(GLenum pname, GLint param)
-{
- GLCALLV(PixelStorei, pname, param);
-}
-
-Q_DECL_EXPORT void APIENTRY glPixelStoref(GLenum pname, GLfloat param)
-{
- GLCALLV(PixelStoref, pname, param);
-}
-
-Q_DECL_EXPORT void APIENTRY glDepthFunc(GLenum func)
-{
- GLCALLV(DepthFunc, func);
-}
-
-Q_DECL_EXPORT void APIENTRY glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- GLCALLV(StencilOp, fail, zfail, zpass);
-}
-
-Q_DECL_EXPORT void APIENTRY glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- GLCALLV(StencilFunc, func, ref, mask);
-}
-
-Q_DECL_EXPORT void APIENTRY glLogicOp(GLenum opcode)
-{
- GLCALLV(LogicOp, opcode);
-}
-
-Q_DECL_EXPORT void APIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- GLCALLV(BlendFunc, sfactor, dfactor);
-}
-
-Q_DECL_EXPORT void APIENTRY glFlush()
-{
- GLCALLV(Flush);
-}
-
-Q_DECL_EXPORT void APIENTRY glFinish()
-{
- GLCALLV(Finish);
-}
-
-Q_DECL_EXPORT void APIENTRY glEnable(GLenum cap)
-{
- GLCALLV(Enable, cap);
-}
-
-Q_DECL_EXPORT void APIENTRY glDisable(GLenum cap)
-{
- GLCALLV(Disable, cap);
-}
-
-Q_DECL_EXPORT void APIENTRY glDepthMask(GLboolean flag)
-{
- GLCALLV(DepthMask, flag);
-}
-
-Q_DECL_EXPORT void APIENTRY glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- GLCALLV(ColorMask, red, green, blue, alpha);
-}
-
-Q_DECL_EXPORT void APIENTRY glStencilMask(GLuint mask)
-{
- GLCALLV(StencilMask, mask);
-}
-
-Q_DECL_EXPORT void APIENTRY glClearDepth(GLdouble depth)
-{
- if (qgl_choose()->libraryType() == QAbstractWindowsOpenGL::DesktopGL) {
- GLCALLV(ClearDepth, depth);
- } else {
- GLCALLV(ClearDepthf, depth);
- }
-}
-
-Q_DECL_EXPORT void APIENTRY glClearStencil(GLint s)
-{
- GLCALLV(ClearStencil, s);
-}
-
-Q_DECL_EXPORT void APIENTRY glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- GLCALLV(ClearColor, red, green, blue, alpha);
-}
-
-Q_DECL_EXPORT void APIENTRY glClear(GLbitfield mask)
-{
- GLCALLV(Clear, mask);
-}
-
-Q_DECL_EXPORT void APIENTRY glDrawBuffer(GLenum mode)
-{
- GLCALLV(DrawBuffer, mode);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- GLCALLV(TexImage2D, target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- GLCALLV(TexImage1D, target, level, internalformat, width, border, format, type, pixels);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- GLCALLV(TexParameteriv, target, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- GLCALLV(TexParameteri, target, pname, param);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- GLCALLV(TexParameterfv, target, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- GLCALLV(TexParameterf, target, pname, param);
-}
-
-Q_DECL_EXPORT void APIENTRY glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- GLCALLV(Scissor, x, y, width, height);
-}
-
-Q_DECL_EXPORT void APIENTRY glPolygonMode(GLenum face, GLenum mode)
-{
- GLCALLV(PolygonMode, face, mode);
-}
-
-Q_DECL_EXPORT void APIENTRY glPointSize(GLfloat size)
-{
- GLCALLV(PointSize, size);
-}
-
-Q_DECL_EXPORT void APIENTRY glLineWidth(GLfloat width)
-{
- GLCALLV(LineWidth, width);
-}
-
-Q_DECL_EXPORT void APIENTRY glHint(GLenum target, GLenum mode)
-{
- GLCALLV(Hint, target, mode);
-}
-
-Q_DECL_EXPORT void APIENTRY glFrontFace(GLenum mode)
-{
- GLCALLV(FrontFace, mode);
-}
-
-Q_DECL_EXPORT void APIENTRY glCullFace(GLenum mode)
-{
- GLCALLV(CullFace, mode);
-}
-
-Q_DECL_EXPORT void APIENTRY glTranslatef(GLfloat x, GLfloat y, GLfloat z)
-{
- GLCALLV(Translatef, x, y, z);
-}
-
-Q_DECL_EXPORT void APIENTRY glTranslated(GLdouble x, GLdouble y, GLdouble z)
-{
- GLCALLV(Translated, x, y, z);
-}
-
-Q_DECL_EXPORT void APIENTRY glScalef(GLfloat x, GLfloat y, GLfloat z)
-{
- GLCALLV(Scalef, x, y, z);
-}
-
-Q_DECL_EXPORT void APIENTRY glScaled(GLdouble x, GLdouble y, GLdouble z)
-{
- GLCALLV(Scaled, x, y, z);
-}
-
-Q_DECL_EXPORT void APIENTRY glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
- GLCALLV(Rotatef, angle, x, y, z);
-}
-
-Q_DECL_EXPORT void APIENTRY glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
-{
- GLCALLV(Rotated, angle, x, y, z);
-}
-
-Q_DECL_EXPORT void APIENTRY glPushMatrix()
-{
- GLCALLV(PushMatrix);
-}
-
-Q_DECL_EXPORT void APIENTRY glPopMatrix()
-{
- GLCALLV(PopMatrix);
-}
-
-Q_DECL_EXPORT void APIENTRY glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- GLCALLV(Ortho, left, right, bottom, top, zNear, zFar);
-}
-
-Q_DECL_EXPORT void APIENTRY glMultMatrixd(const GLdouble *m)
-{
- GLCALLV(MultMatrixd, m);
-}
-
-Q_DECL_EXPORT void APIENTRY glMultMatrixf(const GLfloat *m)
-{
- GLCALLV(MultMatrixf, m);
-}
-
-Q_DECL_EXPORT void APIENTRY glMatrixMode(GLenum mode)
-{
- GLCALLV(MatrixMode, mode);
-}
-
-Q_DECL_EXPORT void APIENTRY glLoadMatrixd(const GLdouble *m)
-{
- GLCALLV(LoadMatrixd, m);
-}
-
-Q_DECL_EXPORT void APIENTRY glLoadMatrixf(const GLfloat *m)
-{
- GLCALLV(LoadMatrixf, m);
-}
-
-Q_DECL_EXPORT void APIENTRY glLoadIdentity()
-{
- GLCALLV(LoadIdentity);
-}
-
-Q_DECL_EXPORT void APIENTRY glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
-{
- GLCALLV(Frustum, left, right, bottom, top, zNear, zFar);
-}
-
-Q_DECL_EXPORT GLboolean APIENTRY glIsList(GLuint list)
-{
- GLCALL(IsList, list);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetTexGeniv(GLenum coord, GLenum pname, GLint *params)
-{
- GLCALLV(GetTexGeniv, coord, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
-{
- GLCALLV(GetTexGenfv, coord, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params)
-{
- GLCALLV(GetTexGendv, coord, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetTexEnviv(GLenum target, GLenum pname, GLint *params)
-{
- GLCALLV(GetTexEnviv, target, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
-{
- GLCALLV(GetTexEnvfv, target, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetPolygonStipple(GLubyte *mask)
-{
- GLCALLV(GetPolygonStipple, mask);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetPixelMapusv(GLenum map, GLushort *values)
-{
- GLCALLV(GetPixelMapusv, map, values);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetPixelMapuiv(GLenum map, GLuint *values)
-{
- GLCALLV(GetPixelMapuiv, map, values);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetPixelMapfv(GLenum map, GLfloat *values)
-{
- GLCALLV(GetPixelMapfv, map, values);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetMaterialiv(GLenum face, GLenum pname, GLint *params)
-{
- GLCALLV(GetMaterialiv, face, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
-{
- GLCALLV(GetMaterialfv, face, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetMapiv(GLenum target, GLenum query, GLint *v)
-{
- GLCALLV(GetMapiv, target, query, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetMapfv(GLenum target, GLenum query, GLfloat *v)
-{
- GLCALLV(GetMapfv, target, query, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetMapdv(GLenum target, GLenum query, GLdouble *v)
-{
- GLCALLV(GetMapdv, target, query, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetLightiv(GLenum light, GLenum pname, GLint *params)
-{
- GLCALLV(GetLightiv, light, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetLightfv(GLenum light, GLenum pname, GLfloat *params)
-{
- GLCALLV(GetLightfv, light, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetClipPlane(GLenum plane, GLdouble *equation)
-{
- GLCALLV(GetClipPlane, plane, equation);
-}
-
-Q_DECL_EXPORT void APIENTRY glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- GLCALLV(DrawPixels, width, height, format, type, pixels);
-}
-
-Q_DECL_EXPORT void APIENTRY glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
-{
- GLCALLV(CopyPixels, x, y, width, height, type);
-}
-
-Q_DECL_EXPORT void APIENTRY glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
-{
- GLCALLV(PixelMapusv, map, mapsize, values);
-}
-
-Q_DECL_EXPORT void APIENTRY glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values)
-{
- GLCALLV(PixelMapuiv, map, mapsize, values);
-}
-
-Q_DECL_EXPORT void APIENTRY glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
-{
- GLCALLV(PixelMapfv, map, mapsize, values);
-}
-
-Q_DECL_EXPORT void APIENTRY glPixelTransferi(GLenum pname, GLint param)
-{
- GLCALLV(PixelTransferi, pname, param);
-}
-
-Q_DECL_EXPORT void APIENTRY glPixelTransferf(GLenum pname, GLfloat param)
-{
- GLCALLV(PixelTransferf, pname, param);
-}
-
-Q_DECL_EXPORT void APIENTRY glPixelZoom(GLfloat xfactor, GLfloat yfactor)
-{
- GLCALLV(PixelZoom, xfactor, yfactor);
-}
-
-Q_DECL_EXPORT void APIENTRY glAlphaFunc(GLenum func, GLfloat ref)
-{
- GLCALLV(AlphaFunc, func, ref);
-}
-
-Q_DECL_EXPORT void APIENTRY glEvalPoint2(GLint i, GLint j)
-{
- GLCALLV(EvalPoint2, i, j);
-}
-
-Q_DECL_EXPORT void APIENTRY glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
-{
- GLCALLV(EvalMesh2, mode, i1, i2, j1, j2);
-}
-
-Q_DECL_EXPORT void APIENTRY glEvalPoint1(GLint i)
-{
- GLCALLV(EvalPoint1, i);
-}
-
-Q_DECL_EXPORT void APIENTRY glEvalMesh1(GLenum mode, GLint i1, GLint i2)
-{
- GLCALLV(EvalMesh1, mode, i1, i2);
-}
-
-Q_DECL_EXPORT void APIENTRY glEvalCoord2fv(const GLfloat *u)
-{
- GLCALLV(EvalCoord2fv, u);
-}
-
-Q_DECL_EXPORT void APIENTRY glEvalCoord2f(GLfloat u, GLfloat v)
-{
- GLCALLV(EvalCoord2f, u, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glEvalCoord2dv(const GLdouble *u)
-{
- GLCALLV(EvalCoord2dv, u);
-}
-
-Q_DECL_EXPORT void APIENTRY glEvalCoord2d(GLdouble u, GLdouble v)
-{
- GLCALLV(EvalCoord2d, u, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glEvalCoord1fv(const GLfloat *u)
-{
- GLCALLV(EvalCoord1fv, u);
-}
-
-Q_DECL_EXPORT void APIENTRY glEvalCoord1f(GLfloat u)
-{
- GLCALLV(EvalCoord1f, u);
-}
-
-Q_DECL_EXPORT void APIENTRY glEvalCoord1dv(const GLdouble *u)
-{
- GLCALLV(EvalCoord1dv, u);
-}
-
-Q_DECL_EXPORT void APIENTRY glEvalCoord1d(GLdouble u)
-{
- GLCALLV(EvalCoord1d, u);
-}
-
-Q_DECL_EXPORT void APIENTRY glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)
-{
- GLCALLV(MapGrid2f, un, u1, u2, vn, v1, v2);
-}
-
-Q_DECL_EXPORT void APIENTRY glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)
-{
- GLCALLV(MapGrid2d, un, u1, u2, vn, v1, v2);
-}
-
-Q_DECL_EXPORT void APIENTRY glMapGrid1f(GLint un, GLfloat u1, GLfloat u2)
-{
- GLCALLV(MapGrid1f, un, u1, u2);
-}
-
-Q_DECL_EXPORT void APIENTRY glMapGrid1d(GLint un, GLdouble u1, GLdouble u2)
-{
- GLCALLV(MapGrid1d, un, u1, u2);
-}
-
-Q_DECL_EXPORT void APIENTRY glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points)
-{
- GLCALLV(Map2f, target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-Q_DECL_EXPORT void APIENTRY glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points)
-{
- GLCALLV(Map2d, target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-}
-
-Q_DECL_EXPORT void APIENTRY glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points)
-{
- GLCALLV(Map1f, target, u1, u2, stride, order, points);
-}
-
-Q_DECL_EXPORT void APIENTRY glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points)
-{
- GLCALLV(Map1d, target, u1, u2, stride, order, points);
-}
-
-Q_DECL_EXPORT void APIENTRY glPushAttrib(GLbitfield mask)
-{
- GLCALLV(PushAttrib, mask);
-}
-
-Q_DECL_EXPORT void APIENTRY glPopAttrib()
-{
- GLCALLV(PopAttrib);
-}
-
-Q_DECL_EXPORT void APIENTRY glAccum(GLenum op, GLfloat value)
-{
- GLCALLV(Accum, op, value);
-}
-
-Q_DECL_EXPORT void APIENTRY glIndexMask(GLuint mask)
-{
- GLCALLV(IndexMask, mask);
-}
-
-Q_DECL_EXPORT void APIENTRY glClearIndex(GLfloat c)
-{
- GLCALLV(ClearIndex, c);
-}
-
-Q_DECL_EXPORT void APIENTRY glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- GLCALLV(ClearAccum, red, green, blue, alpha);
-}
-
-Q_DECL_EXPORT void APIENTRY glPushName(GLuint name)
-{
- GLCALLV(PushName, name);
-}
-
-Q_DECL_EXPORT void APIENTRY glPopName()
-{
- GLCALLV(PopName);
-}
-
-Q_DECL_EXPORT void APIENTRY glPassThrough(GLfloat token)
-{
- GLCALLV(PassThrough, token);
-}
-
-Q_DECL_EXPORT void APIENTRY glLoadName(GLuint name)
-{
- GLCALLV(LoadName, name);
-}
-
-Q_DECL_EXPORT void APIENTRY glInitNames()
-{
- GLCALLV(InitNames);
-}
-
-Q_DECL_EXPORT GLint APIENTRY glRenderMode(GLenum mode)
-{
- GLCALL(RenderMode, mode);
-}
-
-Q_DECL_EXPORT void APIENTRY glSelectBuffer(GLsizei size, GLuint *buffer)
-{
- GLCALLV(SelectBuffer, size, buffer);
-}
-
-Q_DECL_EXPORT void APIENTRY glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer)
-{
- GLCALLV(FeedbackBuffer, size, type, buffer);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexGeniv(GLenum coord, GLenum pname, const GLint *params)
-{
- GLCALLV(TexGeniv, coord, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexGeni(GLenum coord, GLenum pname, GLint param)
-{
- GLCALLV(TexGeni, coord, pname, param);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
-{
- GLCALLV(TexGenfv, coord, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexGenf(GLenum coord, GLenum pname, GLfloat param)
-{
- GLCALLV(TexGenf, coord, pname, param);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexGendv(GLenum coord, GLenum pname, const GLdouble *params)
-{
- GLCALLV(TexGendv, coord, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexGend(GLenum coord, GLenum pname, GLdouble param)
-{
- GLCALLV(TexGend, coord, pname, param);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexEnviv(GLenum target, GLenum pname, const GLint *params)
-{
- GLCALLV(TexEnviv, target, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexEnvi(GLenum target, GLenum pname, GLint param)
-{
- GLCALLV(TexEnvi, target, pname, param);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- GLCALLV(TexEnvfv, target, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexEnvf(GLenum target, GLenum pname, GLfloat param)
-{
- GLCALLV(TexEnvf, target, pname, param);
-}
-
-Q_DECL_EXPORT void APIENTRY glShadeModel(GLenum mode)
-{
- GLCALLV(ShadeModel, mode);
-}
-
-Q_DECL_EXPORT void APIENTRY glPolygonStipple(const GLubyte *mask)
-{
- GLCALLV(PolygonStipple, mask);
-}
-
-Q_DECL_EXPORT void APIENTRY glMaterialiv(GLenum face, GLenum pname, const GLint *params)
-{
- GLCALLV(Materialiv, face, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glMateriali(GLenum face, GLenum pname, GLint param)
-{
- GLCALLV(Materiali, face, pname, param);
-}
-
-Q_DECL_EXPORT void APIENTRY glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
-{
- GLCALLV(Materialfv, face, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glMaterialf(GLenum face, GLenum pname, GLfloat param)
-{
- GLCALLV(Materialf, face, pname, param);
-}
-
-Q_DECL_EXPORT void APIENTRY glLineStipple(GLint factor, GLushort pattern)
-{
- GLCALLV(LineStipple, factor, pattern);
-}
-
-Q_DECL_EXPORT void APIENTRY glLightModeliv(GLenum pname, const GLint *params)
-{
- GLCALLV(LightModeliv, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glLightModeli(GLenum pname, GLint param)
-{
- GLCALLV(LightModeli, pname, param);
-}
-
-Q_DECL_EXPORT void APIENTRY glLightModelfv(GLenum pname, const GLfloat *params)
-{
- GLCALLV(LightModelfv, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glLightModelf(GLenum pname, GLfloat param)
-{
- GLCALLV(LightModelf, pname, param);
-}
-
-Q_DECL_EXPORT void APIENTRY glLightiv(GLenum light, GLenum pname, const GLint *params)
-{
- GLCALLV(Lightiv, light, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glLighti(GLenum light, GLenum pname, GLint param)
-{
- GLCALLV(Lighti, light, pname, param);
-}
-
-Q_DECL_EXPORT void APIENTRY glLightfv(GLenum light, GLenum pname, const GLfloat *params)
-{
- GLCALLV(Lightfv, light, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glLightf(GLenum light, GLenum pname, GLfloat param)
-{
- GLCALLV(Lightf, light, pname, param);
-}
-
-Q_DECL_EXPORT void APIENTRY glFogiv(GLenum pname, const GLint *params)
-{
- GLCALLV(Fogiv, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glFogi(GLenum pname, GLint param)
-{
- GLCALLV(Fogi, pname, param);
-}
-
-Q_DECL_EXPORT void APIENTRY glFogfv(GLenum pname, const GLfloat *params)
-{
- GLCALLV(Fogfv, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glFogf(GLenum pname, GLfloat param)
-{
- GLCALLV(Fogf, pname, param);
-}
-
-Q_DECL_EXPORT void APIENTRY glColorMaterial(GLenum face, GLenum mode)
-{
- GLCALLV(ColorMaterial, face, mode);
-}
-
-Q_DECL_EXPORT void APIENTRY glClipPlane(GLenum plane, const GLdouble *equation)
-{
- GLCALLV(ClipPlane, plane, equation);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertex4sv(const GLshort *v)
-{
- GLCALLV(Vertex4sv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- GLCALLV(Vertex4s, x, y, z, w);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertex4iv(const GLint *v)
-{
- GLCALLV(Vertex4iv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertex4i(GLint x, GLint y, GLint z, GLint w)
-{
- GLCALLV(Vertex4i, x, y, z, w);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertex4fv(const GLfloat *v)
-{
- GLCALLV(Vertex4fv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- GLCALLV(Vertex4f, x, y, z, w);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertex4dv(const GLdouble *v)
-{
- GLCALLV(Vertex4dv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- GLCALLV(Vertex4d, x, y, z, w);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertex3sv(const GLshort *v)
-{
- GLCALLV(Vertex3sv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertex3s(GLshort x, GLshort y, GLshort z)
-{
- GLCALLV(Vertex3s, x, y, z);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertex3iv(const GLint *v)
-{
- GLCALLV(Vertex3iv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertex3i(GLint x, GLint y, GLint z)
-{
- GLCALLV(Vertex3i, x, y, z);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertex3fv(const GLfloat *v)
-{
- GLCALLV(Vertex3fv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertex3f(GLfloat x, GLfloat y, GLfloat z)
-{
- GLCALLV(Vertex3f, x, y, z);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertex3dv(const GLdouble *v)
-{
- GLCALLV(Vertex3dv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertex3d(GLdouble x, GLdouble y, GLdouble z)
-{
- GLCALLV(Vertex3d, x, y, z);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertex2sv(const GLshort *v)
-{
- GLCALLV(Vertex2sv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertex2s(GLshort x, GLshort y)
-{
- GLCALLV(Vertex2s, x, y);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertex2iv(const GLint *v)
-{
- GLCALLV(Vertex2iv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertex2i(GLint x, GLint y)
-{
- GLCALLV(Vertex2i, x, y);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertex2fv(const GLfloat *v)
-{
- GLCALLV(Vertex2fv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertex2f(GLfloat x, GLfloat y)
-{
- GLCALLV(Vertex2f, x, y);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertex2dv(const GLdouble *v)
-{
- GLCALLV(Vertex2dv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertex2d(GLdouble x, GLdouble y)
-{
- GLCALLV(Vertex2d, x, y);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord4sv(const GLshort *v)
-{
- GLCALLV(TexCoord4sv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q)
-{
- GLCALLV(TexCoord4s, s, t, r, q);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord4iv(const GLint *v)
-{
- GLCALLV(TexCoord4iv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord4i(GLint s, GLint t, GLint r, GLint q)
-{
- GLCALLV(TexCoord4i, s, t, r, q);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord4fv(const GLfloat *v)
-{
- GLCALLV(TexCoord4fv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- GLCALLV(TexCoord4f, s, t, r, q);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord4dv(const GLdouble *v)
-{
- GLCALLV(TexCoord4dv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q)
-{
- GLCALLV(TexCoord4d, s, t, r, q);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord3sv(const GLshort *v)
-{
- GLCALLV(TexCoord3sv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord3s(GLshort s, GLshort t, GLshort r)
-{
- GLCALLV(TexCoord3s, s, t, r);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord3iv(const GLint *v)
-{
- GLCALLV(TexCoord3iv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord3i(GLint s, GLint t, GLint r)
-{
- GLCALLV(TexCoord3i, s, t, r);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord3fv(const GLfloat *v)
-{
- GLCALLV(TexCoord3fv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord3f(GLfloat s, GLfloat t, GLfloat r)
-{
- GLCALLV(TexCoord3f, s, t, r);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord3dv(const GLdouble *v)
-{
- GLCALLV(TexCoord3dv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord3d(GLdouble s, GLdouble t, GLdouble r)
-{
- GLCALLV(TexCoord3d, s, t, r);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord2sv(const GLshort *v)
-{
- GLCALLV(TexCoord2sv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord2s(GLshort s, GLshort t)
-{
- GLCALLV(TexCoord2s, s, t);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord2iv(const GLint *v)
-{
- GLCALLV(TexCoord2iv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord2i(GLint s, GLint t)
-{
- GLCALLV(TexCoord2i, s, t);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord2fv(const GLfloat *v)
-{
- GLCALLV(TexCoord2fv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord2f(GLfloat s, GLfloat t)
-{
- GLCALLV(TexCoord2f, s, t);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord2dv(const GLdouble *v)
-{
- GLCALLV(TexCoord2dv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord2d(GLdouble s, GLdouble t)
-{
- GLCALLV(TexCoord2d, s, t);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord1sv(const GLshort *v)
-{
- GLCALLV(TexCoord1sv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord1s(GLshort s)
-{
- GLCALLV(TexCoord1s, s);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord1iv(const GLint *v)
-{
- GLCALLV(TexCoord1iv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord1i(GLint s)
-{
- GLCALLV(TexCoord1i, s);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord1fv(const GLfloat *v)
-{
- GLCALLV(TexCoord1fv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord1f(GLfloat s)
-{
- GLCALLV(TexCoord1f, s);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord1dv(const GLdouble *v)
-{
- GLCALLV(TexCoord1dv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoord1d(GLdouble s)
-{
- GLCALLV(TexCoord1d, s);
-}
-
-Q_DECL_EXPORT void APIENTRY glRectsv(const GLshort *v1, const GLshort *v2)
-{
- GLCALLV(Rectsv, v1, v2);
-}
-
-Q_DECL_EXPORT void APIENTRY glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
-{
- GLCALLV(Rects, x1, y1, x2, y2);
-}
-
-Q_DECL_EXPORT void APIENTRY glRectiv(const GLint *v1, const GLint *v2)
-{
- GLCALLV(Rectiv, v1, v2);
-}
-
-Q_DECL_EXPORT void APIENTRY glRecti(GLint x1, GLint y1, GLint x2, GLint y2)
-{
- GLCALLV(Recti, x1, y1, x2, y2);
-}
-
-Q_DECL_EXPORT void APIENTRY glRectfv(const GLfloat *v1, const GLfloat *v2)
-{
- GLCALLV(Rectfv, v1, v2);
-}
-
-Q_DECL_EXPORT void APIENTRY glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
-{
- GLCALLV(Rectf, x1, y1, x2, y2);
-}
-
-Q_DECL_EXPORT void APIENTRY glRectdv(const GLdouble *v1, const GLdouble *v2)
-{
- GLCALLV(Rectdv, v1, v2);
-}
-
-Q_DECL_EXPORT void APIENTRY glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
-{
- GLCALLV(Rectd, x1, y1, x2, y2);
-}
-
-Q_DECL_EXPORT void APIENTRY glRasterPos4sv(const GLshort *v)
-{
- GLCALLV(RasterPos4sv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
-{
- GLCALLV(RasterPos4s, x, y, z, w);
-}
-
-Q_DECL_EXPORT void APIENTRY glRasterPos4iv(const GLint *v)
-{
- GLCALLV(RasterPos4iv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glRasterPos4i(GLint x, GLint y, GLint z, GLint w)
-{
- GLCALLV(RasterPos4i, x, y, z, w);
-}
-
-Q_DECL_EXPORT void APIENTRY glRasterPos4fv(const GLfloat *v)
-{
- GLCALLV(RasterPos4fv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- GLCALLV(RasterPos4f, x, y, z, w);
-}
-
-Q_DECL_EXPORT void APIENTRY glRasterPos4dv(const GLdouble *v)
-{
- GLCALLV(RasterPos4dv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
-{
- GLCALLV(RasterPos4d, x, y, z, w);
-}
-
-Q_DECL_EXPORT void APIENTRY glRasterPos3sv(const GLshort *v)
-{
- GLCALLV(RasterPos3sv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glRasterPos3s(GLshort x, GLshort y, GLshort z)
-{
- GLCALLV(RasterPos3s, x, y, z);
-}
-
-Q_DECL_EXPORT void APIENTRY glRasterPos3iv(const GLint *v)
-{
- GLCALLV(RasterPos3iv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glRasterPos3i(GLint x, GLint y, GLint z)
-{
- GLCALLV(RasterPos3i, x, y, z);
-}
-
-Q_DECL_EXPORT void APIENTRY glRasterPos3fv(const GLfloat *v)
-{
- GLCALLV(RasterPos3fv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glRasterPos3f(GLfloat x, GLfloat y, GLfloat z)
-{
- GLCALLV(RasterPos3f, x, y, z);
-}
-
-Q_DECL_EXPORT void APIENTRY glRasterPos3dv(const GLdouble *v)
-{
- GLCALLV(RasterPos3dv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glRasterPos3d(GLdouble x, GLdouble y, GLdouble z)
-{
- GLCALLV(RasterPos3d, x, y, z);
-}
-
-Q_DECL_EXPORT void APIENTRY glRasterPos2sv(const GLshort *v)
-{
- GLCALLV(RasterPos2sv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glRasterPos2s(GLshort x, GLshort y)
-{
- GLCALLV(RasterPos2s, x, y);
-}
-
-Q_DECL_EXPORT void APIENTRY glRasterPos2iv(const GLint *v)
-{
- GLCALLV(RasterPos2iv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glRasterPos2i(GLint x, GLint y)
-{
- GLCALLV(RasterPos2i, x, y);
-}
-
-Q_DECL_EXPORT void APIENTRY glRasterPos2fv(const GLfloat *v)
-{
- GLCALLV(RasterPos2fv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glRasterPos2f(GLfloat x, GLfloat y)
-{
- GLCALLV(RasterPos2f, x, y);
-}
-
-Q_DECL_EXPORT void APIENTRY glRasterPos2dv(const GLdouble *v)
-{
- GLCALLV(RasterPos2dv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glRasterPos2d(GLdouble x, GLdouble y)
-{
- GLCALLV(RasterPos2d, x, y);
-}
-
-Q_DECL_EXPORT void APIENTRY glNormal3sv(const GLshort *v)
-{
- GLCALLV(Normal3sv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glNormal3s(GLshort nx, GLshort ny, GLshort nz)
-{
- GLCALLV(Normal3s, nx, ny, nz);
-}
-
-Q_DECL_EXPORT void APIENTRY glNormal3iv(const GLint *v)
-{
- GLCALLV(Normal3iv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glNormal3i(GLint nx, GLint ny, GLint nz)
-{
- GLCALLV(Normal3i, nx, ny, nz);
-}
-
-Q_DECL_EXPORT void APIENTRY glNormal3fv(const GLfloat *v)
-{
- GLCALLV(Normal3fv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
-{
- GLCALLV(Normal3f, nx, ny, nz);
-}
-
-Q_DECL_EXPORT void APIENTRY glNormal3dv(const GLdouble *v)
-{
- GLCALLV(Normal3dv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz)
-{
- GLCALLV(Normal3d, nx, ny, nz);
-}
-
-Q_DECL_EXPORT void APIENTRY glNormal3bv(const GLbyte *v)
-{
- GLCALLV(Normal3bv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz)
-{
- GLCALLV(Normal3b, nx, ny, nz);
-}
-
-Q_DECL_EXPORT void APIENTRY glIndexsv(const GLshort *c)
-{
- GLCALLV(Indexsv, c);
-}
-
-Q_DECL_EXPORT void APIENTRY glIndexs(GLshort c)
-{
- GLCALLV(Indexs, c);
-}
-
-Q_DECL_EXPORT void APIENTRY glIndexiv(const GLint *c)
-{
- GLCALLV(Indexiv, c);
-}
-
-Q_DECL_EXPORT void APIENTRY glIndexi(GLint c)
-{
- GLCALLV(Indexi, c);
-}
-
-Q_DECL_EXPORT void APIENTRY glIndexfv(const GLfloat *c)
-{
- GLCALLV(Indexfv, c);
-}
-
-Q_DECL_EXPORT void APIENTRY glIndexf(GLfloat c)
-{
- GLCALLV(Indexf, c);
-}
-
-Q_DECL_EXPORT void APIENTRY glIndexdv(const GLdouble *c)
-{
- GLCALLV(Indexdv, c);
-}
-
-Q_DECL_EXPORT void APIENTRY glIndexd(GLdouble c)
-{
- GLCALLV(Indexd, c);
-}
-
-Q_DECL_EXPORT void APIENTRY glEnd()
-{
- GLCALLV(End);
-}
-
-Q_DECL_EXPORT void APIENTRY glEdgeFlagv(const GLboolean *flag)
-{
- GLCALLV(EdgeFlagv, flag);
-}
-
-Q_DECL_EXPORT void APIENTRY glEdgeFlag(GLboolean flag)
-{
- GLCALLV(EdgeFlag, flag);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor4usv(const GLushort *v)
-{
- GLCALLV(Color4usv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha)
-{
- GLCALLV(Color4us, red, green, blue, alpha);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor4uiv(const GLuint *v)
-{
- GLCALLV(Color4uiv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
-{
- GLCALLV(Color4ui, red, green, blue, alpha);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor4ubv(const GLubyte *v)
-{
- GLCALLV(Color4ubv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
-{
- GLCALLV(Color4ub, red, green, blue, alpha);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor4sv(const GLshort *v)
-{
- GLCALLV(Color4sv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha)
-{
- GLCALLV(Color4s, red, green, blue, alpha);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor4iv(const GLint *v)
-{
- GLCALLV(Color4iv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor4i(GLint red, GLint green, GLint blue, GLint alpha)
-{
- GLCALLV(Color4i, red, green, blue, alpha);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor4fv(const GLfloat *v)
-{
- GLCALLV(Color4fv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- GLCALLV(Color4f, red, green, blue, alpha);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor4dv(const GLdouble *v)
-{
- GLCALLV(Color4dv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
-{
- GLCALLV(Color4d, red, green, blue, alpha);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor4bv(const GLbyte *v)
-{
- GLCALLV(Color4bv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
-{
- GLCALLV(Color4b, red, green, blue, alpha);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor3usv(const GLushort *v)
-{
- GLCALLV(Color3usv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor3us(GLushort red, GLushort green, GLushort blue)
-{
- GLCALLV(Color3us, red, green, blue);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor3uiv(const GLuint *v)
-{
- GLCALLV(Color3uiv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor3ui(GLuint red, GLuint green, GLuint blue)
-{
- GLCALLV(Color3ui, red, green, blue);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor3ubv(const GLubyte *v)
-{
- GLCALLV(Color3ubv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor3ub(GLubyte red, GLubyte green, GLubyte blue)
-{
- GLCALLV(Color3ub, red, green, blue);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor3sv(const GLshort *v)
-{
- GLCALLV(Color3sv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor3s(GLshort red, GLshort green, GLshort blue)
-{
- GLCALLV(Color3s, red, green, blue);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor3iv(const GLint *v)
-{
- GLCALLV(Color3iv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor3i(GLint red, GLint green, GLint blue)
-{
- GLCALLV(Color3i, red, green, blue);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor3fv(const GLfloat *v)
-{
- GLCALLV(Color3fv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor3f(GLfloat red, GLfloat green, GLfloat blue)
-{
- GLCALLV(Color3f, red, green, blue);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor3dv(const GLdouble *v)
-{
- GLCALLV(Color3dv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor3d(GLdouble red, GLdouble green, GLdouble blue)
-{
- GLCALLV(Color3d, red, green, blue);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor3bv(const GLbyte *v)
-{
- GLCALLV(Color3bv, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glColor3b(GLbyte red, GLbyte green, GLbyte blue)
-{
- GLCALLV(Color3b, red, green, blue);
-}
-
-Q_DECL_EXPORT void APIENTRY glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)
-{
- GLCALLV(Bitmap, width, height, xorig, yorig, xmove, ymove, bitmap);
-}
-
-Q_DECL_EXPORT void APIENTRY glBegin(GLenum mode)
-{
- GLCALLV(Begin, mode);
-}
-
-Q_DECL_EXPORT void APIENTRY glListBase(GLuint base)
-{
- GLCALLV(ListBase, base);
-}
-
-Q_DECL_EXPORT GLuint APIENTRY glGenLists(GLsizei range)
-{
- GLCALL(GenLists, range);
-}
-
-Q_DECL_EXPORT void APIENTRY glDeleteLists(GLuint list, GLsizei range)
-{
- GLCALLV(DeleteLists, list, range);
-}
-
-Q_DECL_EXPORT void APIENTRY glCallLists(GLsizei n, GLenum type, const GLvoid *lists)
-{
- GLCALLV(CallLists, n, type, lists);
-}
-
-Q_DECL_EXPORT void APIENTRY glCallList(GLuint list)
-{
- GLCALLV(CallList, list);
-}
-
-Q_DECL_EXPORT void APIENTRY glEndList()
-{
- GLCALLV(EndList);
-}
-
-Q_DECL_EXPORT void APIENTRY glNewList(GLuint list, GLenum mode)
-{
- GLCALLV(NewList, list, mode);
-}
-
-Q_DECL_EXPORT void APIENTRY glIndexubv(const GLubyte *c)
-{
- GLCALLV(Indexubv, c);
-}
-
-Q_DECL_EXPORT void APIENTRY glIndexub(GLubyte c)
-{
- GLCALLV(Indexub, c);
-}
-
-Q_DECL_EXPORT GLboolean APIENTRY glIsTexture(GLuint texture)
-{
- GLCALL(IsTexture, texture);
-}
-
-Q_DECL_EXPORT void APIENTRY glGenTextures(GLsizei n, GLuint *textures)
-{
- GLCALLV(GenTextures, n, textures);
-}
-
-Q_DECL_EXPORT void APIENTRY glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- GLCALLV(DeleteTextures, n, textures);
-}
-
-Q_DECL_EXPORT void APIENTRY glBindTexture(GLenum target, GLuint texture)
-{
- GLCALLV(BindTexture, target, texture);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- GLCALLV(TexSubImage2D, target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
-{
- GLCALLV(TexSubImage1D, target, level, xoffset, width, format, type, pixels);
-}
-
-Q_DECL_EXPORT void APIENTRY glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- GLCALLV(CopyTexSubImage2D, target, level, xoffset, yoffset, x, y, width, height);
-}
-
-Q_DECL_EXPORT void APIENTRY glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- GLCALLV(CopyTexSubImage1D, target, level, xoffset, x, y, width);
-}
-
-Q_DECL_EXPORT void APIENTRY glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- GLCALLV(CopyTexImage2D, target, level, internalformat, x, y, width, height, border);
-}
-
-Q_DECL_EXPORT void APIENTRY glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
-{
- GLCALLV(CopyTexImage1D, target, level, internalformat, x, y, width, border);
-}
-
-Q_DECL_EXPORT void APIENTRY glPolygonOffset(GLfloat factor, GLfloat units)
-{
- GLCALLV(PolygonOffset, factor, units);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetPointerv(GLenum pname, GLvoid* *params)
-{
- GLCALLV(GetPointerv, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-{
- GLCALLV(DrawElements, mode, count, type, indices);
-}
-
-Q_DECL_EXPORT void APIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- GLCALLV(DrawArrays, mode, first, count);
-}
-
-Q_DECL_EXPORT void APIENTRY glPushClientAttrib(GLbitfield mask)
-{
- GLCALLV(PushClientAttrib, mask);
-}
-
-Q_DECL_EXPORT void APIENTRY glPopClientAttrib()
-{
- GLCALLV(PopClientAttrib);
-}
-
-Q_DECL_EXPORT void APIENTRY glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities)
-{
- GLCALLV(PrioritizeTextures, n, textures, priorities);
-}
-
-Q_DECL_EXPORT GLboolean APIENTRY glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences)
-{
- GLCALL(AreTexturesResident, n, textures, residences);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- GLCALLV(VertexPointer, size, type, stride, pointer);
-}
-
-Q_DECL_EXPORT void APIENTRY glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- GLCALLV(TexCoordPointer, size, type, stride, pointer);
-}
-
-Q_DECL_EXPORT void APIENTRY glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- GLCALLV(NormalPointer, type, stride, pointer);
-}
-
-Q_DECL_EXPORT void APIENTRY glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
-{
- GLCALLV(InterleavedArrays, format, stride, pointer);
-}
-
-Q_DECL_EXPORT void APIENTRY glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- GLCALLV(IndexPointer, type, stride, pointer);
-}
-
-Q_DECL_EXPORT void APIENTRY glEnableClientState(GLenum array)
-{
- GLCALLV(EnableClientState, array);
-}
-
-Q_DECL_EXPORT void APIENTRY glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer)
-{
- GLCALLV(EdgeFlagPointer, stride, pointer);
-}
-
-Q_DECL_EXPORT void APIENTRY glDisableClientState(GLenum array)
-{
- GLCALLV(DisableClientState, array);
-}
-
-Q_DECL_EXPORT void APIENTRY glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- GLCALLV(ColorPointer, size, type, stride, pointer);
-}
-
-Q_DECL_EXPORT void APIENTRY glArrayElement(GLint i)
-{
- GLCALLV(ArrayElement, i);
-}
-
-// OpenGL ES 2.0
-
-Q_DECL_EXPORT void APIENTRY glActiveTexture(GLenum texture)
-{
- GLCALLV(ActiveTexture,texture);
-}
-
-Q_DECL_EXPORT void APIENTRY glAttachShader(GLuint program, GLuint shader)
-{
- GLCALLV(AttachShader,program, shader);
-}
-
-Q_DECL_EXPORT void APIENTRY glBindAttribLocation(GLuint program, GLuint index, const GLchar* name)
-{
- GLCALLV(BindAttribLocation,program, index, name);
-}
-
-Q_DECL_EXPORT void APIENTRY glBindBuffer(GLenum target, GLuint buffer)
-{
- GLCALLV(BindBuffer,target, buffer);
-}
-
-Q_DECL_EXPORT void APIENTRY glBindFramebuffer(GLenum target, GLuint framebuffer)
-{
- GLCALLV(BindFramebuffer,target, framebuffer);
-}
-
-Q_DECL_EXPORT void APIENTRY glBindRenderbuffer(GLenum target, GLuint renderbuffer)
-{
- GLCALLV(BindRenderbuffer,target, renderbuffer);
-}
-
-Q_DECL_EXPORT void APIENTRY glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
-{
- GLCALLV(BlendColor,red, green, blue, alpha);
-}
-
-Q_DECL_EXPORT void APIENTRY glBlendEquation(GLenum mode)
-{
- GLCALLV(BlendEquation,mode);
-}
-
-Q_DECL_EXPORT void APIENTRY glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- GLCALLV(BlendEquationSeparate,modeRGB, modeAlpha);
-}
-
-Q_DECL_EXPORT void APIENTRY glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
- GLCALLV(BlendFuncSeparate,srcRGB, dstRGB, srcAlpha, dstAlpha);
-}
-
-Q_DECL_EXPORT void APIENTRY glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage)
-{
- GLCALLV(BufferData,target, size, data, usage);
-}
-
-Q_DECL_EXPORT void APIENTRY glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data)
-{
- GLCALLV(BufferSubData,target, offset, size, data);
-}
-
-Q_DECL_EXPORT GLenum APIENTRY glCheckFramebufferStatus(GLenum target)
-{
- GLCALL(CheckFramebufferStatus,target);
-}
-
-Q_DECL_EXPORT void APIENTRY glClearDepthf(GLclampf depth)
-{
- glClearDepth(depth);
-}
-
-Q_DECL_EXPORT void APIENTRY glCompileShader(GLuint shader)
-{
- GLCALLV(CompileShader,shader);
-}
-
-Q_DECL_EXPORT void APIENTRY glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data)
-{
- GLCALLV(CompressedTexImage2D,target, level, internalformat, width, height, border, imageSize, data);
-}
-
-Q_DECL_EXPORT void APIENTRY glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data)
-{
- GLCALLV(CompressedTexSubImage2D,target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-Q_DECL_EXPORT GLuint APIENTRY glCreateProgram(void)
-{
- GLCALL(CreateProgram);
-}
-
-Q_DECL_EXPORT GLuint glCreateShader(GLenum type)
-{
- GLCALL(CreateShader,type);
-}
-
-Q_DECL_EXPORT void APIENTRY glDeleteBuffers(GLsizei n, const GLuint* buffers)
-{
- GLCALLV(DeleteBuffers,n, buffers);
-}
-
-Q_DECL_EXPORT void APIENTRY glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
-{
- GLCALLV(DeleteFramebuffers,n, framebuffers);
-}
-
-Q_DECL_EXPORT void APIENTRY glDeleteProgram(GLuint program)
-{
- GLCALLV(DeleteProgram,program);
-}
-
-Q_DECL_EXPORT void APIENTRY glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
-{
- GLCALLV(DeleteRenderbuffers,n, renderbuffers);
-}
-
-Q_DECL_EXPORT void APIENTRY glDeleteShader(GLuint shader)
-{
- GLCALLV(DeleteShader,shader);
-}
-
-Q_DECL_EXPORT void APIENTRY glDepthRangef(GLclampf zNear, GLclampf zFar)
-{
- glDepthRange(zNear, zFar);
-}
-
-Q_DECL_EXPORT void APIENTRY glDetachShader(GLuint program, GLuint shader)
-{
- GLCALLV(DetachShader,program, shader);
-}
-
-Q_DECL_EXPORT void APIENTRY glDisableVertexAttribArray(GLuint index)
-{
- GLCALLV(DisableVertexAttribArray,index);
-}
-
-Q_DECL_EXPORT void APIENTRY glEnableVertexAttribArray(GLuint index)
-{
- GLCALLV(EnableVertexAttribArray,index);
-}
-
-Q_DECL_EXPORT void APIENTRY glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- GLCALLV(FramebufferRenderbuffer,target, attachment, renderbuffertarget, renderbuffer);
-}
-
-Q_DECL_EXPORT void APIENTRY glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- GLCALLV(FramebufferTexture2D,target, attachment, textarget, texture, level);
-}
-
-Q_DECL_EXPORT void APIENTRY glGenBuffers(GLsizei n, GLuint* buffers)
-{
- GLCALLV(GenBuffers,n, buffers);
-}
-
-Q_DECL_EXPORT void APIENTRY glGenerateMipmap(GLenum target)
-{
- GLCALLV(GenerateMipmap,target);
-}
-
-Q_DECL_EXPORT void APIENTRY glGenFramebuffers(GLsizei n, GLuint* framebuffers)
-{
- GLCALLV(GenFramebuffers,n, framebuffers);
-}
-
-Q_DECL_EXPORT void APIENTRY glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
-{
- GLCALLV(GenRenderbuffers,n, renderbuffers);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
-{
- GLCALLV(GetActiveAttrib,program, index, bufsize, length, size, type, name);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
-{
- GLCALLV(GetActiveUniform,program, index, bufsize, length, size, type, name);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
-{
- GLCALLV(GetAttachedShaders,program, maxcount, count, shaders);
-}
-
-Q_DECL_EXPORT int APIENTRY glGetAttribLocation(GLuint program, const GLchar* name)
-{
- GLCALL(GetAttribLocation,program, name);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
-{
- GLCALLV(GetBufferParameteriv,target, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
-{
- GLCALLV(GetFramebufferAttachmentParameteriv,target, attachment, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetProgramiv(GLuint program, GLenum pname, GLint* params)
-{
- GLCALLV(GetProgramiv,program, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog)
-{
- GLCALLV(GetProgramInfoLog,program, bufsize, length, infolog);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
-{
- GLCALLV(GetRenderbufferParameteriv,target, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
-{
- GLCALLV(GetShaderiv,shader, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog)
-{
- GLCALLV(GetShaderInfoLog,shader, bufsize, length, infolog);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
-{
- GLCALLV(GetShaderPrecisionFormat,shadertype, precisiontype, range, precision);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source)
-{
- GLCALLV(GetShaderSource,shader, bufsize, length, source);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetUniformfv(GLuint program, GLint location, GLfloat* params)
-{
- GLCALLV(GetUniformfv, program, location, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetUniformiv(GLuint program, GLint location, GLint* params)
-{
- GLCALLV(GetUniformiv, program, location, params);
-}
-
-Q_DECL_EXPORT int APIENTRY glGetUniformLocation(GLuint program, const GLchar* name)
-{
- GLCALL(GetUniformLocation,program, name);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
-{
- GLCALLV(GetVertexAttribfv,index, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
-{
- GLCALLV(GetVertexAttribiv,index, pname, params);
-}
-
-Q_DECL_EXPORT void APIENTRY glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer)
-{
- GLCALLV(GetVertexAttribPointerv,index, pname, pointer);
-}
-
-Q_DECL_EXPORT GLboolean APIENTRY glIsBuffer(GLuint buffer)
-{
- GLCALL(IsBuffer,buffer);
-}
-
-Q_DECL_EXPORT GLboolean APIENTRY glIsFramebuffer(GLuint framebuffer)
-{
- GLCALL(IsFramebuffer,framebuffer);
-}
-
-Q_DECL_EXPORT GLboolean APIENTRY glIsProgram(GLuint program)
-{
- GLCALL(IsProgram,program);
-}
-
-Q_DECL_EXPORT GLboolean APIENTRY glIsRenderbuffer(GLuint renderbuffer)
-{
- GLCALL(IsRenderbuffer,renderbuffer);
-}
-
-Q_DECL_EXPORT GLboolean APIENTRY glIsShader(GLuint shader)
-{
- GLCALL(IsShader,shader);
-}
-
-Q_DECL_EXPORT void APIENTRY glLinkProgram(GLuint program)
-{
- GLCALLV(LinkProgram,program);
-}
-
-Q_DECL_EXPORT void APIENTRY glReleaseShaderCompiler(void)
-{
- GLCALLV(ReleaseShaderCompiler,);
-}
-
-Q_DECL_EXPORT void APIENTRY glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- GLCALLV(RenderbufferStorage,target, internalformat, width, height);
-}
-
-Q_DECL_EXPORT void APIENTRY glSampleCoverage(GLclampf value, GLboolean invert)
-{
- GLCALLV(SampleCoverage,value, invert);
-}
-
-Q_DECL_EXPORT void APIENTRY glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length)
-{
- GLCALLV(ShaderBinary,n, shaders, binaryformat, binary, length);
-}
-
-Q_DECL_EXPORT void APIENTRY glShaderSource(GLuint shader, GLsizei count, const GLchar* *string, const GLint* length)
-{
- GLCALLV(ShaderSource,shader, count, string, length);
-}
-
-Q_DECL_EXPORT void APIENTRY glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- GLCALLV(StencilFuncSeparate,face, func, ref, mask);
-}
-
-Q_DECL_EXPORT void APIENTRY glStencilMaskSeparate(GLenum face, GLuint mask)
-{
- GLCALLV(StencilMaskSeparate,face, mask);
-}
-
-Q_DECL_EXPORT void APIENTRY glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
-{
- GLCALLV(StencilOpSeparate,face, fail, zfail, zpass);
-}
-
-Q_DECL_EXPORT void APIENTRY glUniform1f(GLint location, GLfloat x)
-{
- GLCALLV(Uniform1f,location, x);
-}
-
-Q_DECL_EXPORT void APIENTRY glUniform1fv(GLint location, GLsizei count, const GLfloat* v)
-{
- GLCALLV(Uniform1fv,location, count, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glUniform1i(GLint location, GLint x)
-{
- GLCALLV(Uniform1i,location, x);
-}
-
-Q_DECL_EXPORT void APIENTRY glUniform1iv(GLint location, GLsizei count, const GLint* v)
-{
- GLCALLV(Uniform1iv,location, count, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glUniform2f(GLint location, GLfloat x, GLfloat y)
-{
- GLCALLV(Uniform2f,location, x, y);
-}
-
-Q_DECL_EXPORT void APIENTRY glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
-{
- GLCALLV(Uniform2fv,location, count, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glUniform2i(GLint location, GLint x, GLint y)
-{
- GLCALLV(Uniform2i,location, x, y);
-}
-
-Q_DECL_EXPORT void APIENTRY glUniform2iv(GLint location, GLsizei count, const GLint* v)
-{
- GLCALLV(Uniform2iv,location, count, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
-{
- GLCALLV(Uniform3f,location, x, y, z);
-}
-
-Q_DECL_EXPORT void APIENTRY glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
-{
- GLCALLV(Uniform3fv,location, count, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glUniform3i(GLint location, GLint x, GLint y, GLint z)
-{
- GLCALLV(Uniform3i,location, x, y, z);
-}
-
-Q_DECL_EXPORT void APIENTRY glUniform3iv(GLint location, GLsizei count, const GLint* v)
-{
- GLCALLV(Uniform3iv,location, count, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- GLCALLV(Uniform4f,location, x, y, z, w);
-}
-
-Q_DECL_EXPORT void APIENTRY glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
-{
- GLCALLV(Uniform4fv,location, count, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
-{
- GLCALLV(Uniform4i,location, x, y, z, w);
-}
-
-Q_DECL_EXPORT void APIENTRY glUniform4iv(GLint location, GLsizei count, const GLint* v)
-{
- GLCALLV(Uniform4iv,location, count, v);
-}
-
-Q_DECL_EXPORT void APIENTRY glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
- GLCALLV(UniformMatrix2fv,location, count, transpose, value);
-}
-
-Q_DECL_EXPORT void APIENTRY glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
- GLCALLV(UniformMatrix3fv,location, count, transpose, value);
-}
-
-Q_DECL_EXPORT void APIENTRY glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
- GLCALLV(UniformMatrix4fv,location, count, transpose, value);
-}
-
-Q_DECL_EXPORT void APIENTRY glUseProgram(GLuint program)
-{
- GLCALLV(UseProgram,program);
-}
-
-Q_DECL_EXPORT void APIENTRY glValidateProgram(GLuint program)
-{
- GLCALLV(ValidateProgram,program);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertexAttrib1f(GLuint indx, GLfloat x)
-{
- GLCALLV(VertexAttrib1f,indx, x);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertexAttrib1fv(GLuint indx, const GLfloat* values)
-{
- GLCALLV(VertexAttrib1fv,indx, values);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
-{
- GLCALLV(VertexAttrib2f,indx, x, y);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertexAttrib2fv(GLuint indx, const GLfloat* values)
-{
- GLCALLV(VertexAttrib2fv,indx, values);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
-{
- GLCALLV(VertexAttrib3f,indx, x, y, z);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertexAttrib3fv(GLuint indx, const GLfloat* values)
-{
- GLCALLV(VertexAttrib3fv,indx, values);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- GLCALLV(VertexAttrib4f,indx, x, y, z, w);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertexAttrib4fv(GLuint indx, const GLfloat* values)
-{
- GLCALLV(VertexAttrib4fv,indx, values);
-}
-
-Q_DECL_EXPORT void APIENTRY glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr)
-{
- GLCALLV(VertexAttribPointer,indx, size, type, normalized, stride, ptr);
-}
-
-// EGL
-
-Q_DECL_EXPORT __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress(const char *procname)
-{
- // This is a bit more complicated since the GLES2 functions (that are not in OpenGL 1)
- // must be made queriable in order to allow classes like QOpenGLFunctions to operate
- // on the same code path for desktop GL and proxied ES.
- typedef __eglMustCastToProperFunctionPointerType FuncType;
- FuncType f = 0;
- f = qgl_choose()->EGL_GetProcAddress(procname);
- if (!f) {
- static struct Tab {
- const char *name;
- FuncType func;
- } tab[] = {
- { "glActiveTexture", (FuncType) glActiveTexture },
- { "glAttachShader", (FuncType) glAttachShader },
- { "glBindAttribLocation", (FuncType) glBindAttribLocation },
- { "glBindBuffer", (FuncType) glBindBuffer },
- { "glBindFramebuffer", (FuncType) glBindFramebuffer },
- { "glBindRenderbuffer", (FuncType) glBindRenderbuffer },
- { "glBlendColor", (FuncType) glBlendColor },
- { "glBlendEquation", (FuncType) glBlendEquation },
- { "glBlendEquationSeparate", (FuncType) glBlendEquationSeparate },
- { "glBlendFuncSeparate", (FuncType) glBlendFuncSeparate },
- { "glBufferData", (FuncType) glBufferData },
- { "glBufferSubData", (FuncType) glBufferSubData },
- { "glCheckFramebufferStatus", (FuncType) glCheckFramebufferStatus },
- { "glCompileShader", (FuncType) glCompileShader },
- { "glCompressedTexImage2D", (FuncType) glCompressedTexImage2D },
- { "glCompressedTexSubImage2D", (FuncType) glCompressedTexSubImage2D },
- { "glCreateProgram", (FuncType) glCreateProgram },
- { "glCreateShader", (FuncType) glCreateShader },
- { "glDeleteBuffers", (FuncType) glDeleteBuffers },
- { "glDeleteFramebuffers", (FuncType) glDeleteFramebuffers },
- { "glDeleteProgram", (FuncType) glDeleteProgram },
- { "glDeleteRenderbuffers", (FuncType) glDeleteRenderbuffers },
- { "glDeleteShader", (FuncType) glDeleteShader },
- { "glDetachShader", (FuncType) glDetachShader },
- { "glDisableVertexAttribArray", (FuncType) glDisableVertexAttribArray },
- { "glEnableVertexAttribArray", (FuncType) glEnableVertexAttribArray },
- { "glFramebufferRenderbuffer", (FuncType) glFramebufferRenderbuffer },
- { "glFramebufferTexture2D", (FuncType) glFramebufferTexture2D },
- { "glGenBuffers", (FuncType) glGenBuffers },
- { "glGenerateMipmap", (FuncType) glGenerateMipmap },
- { "glGenFramebuffers", (FuncType) glGenFramebuffers },
- { "glGenRenderbuffers", (FuncType) glGenRenderbuffers },
- { "glGetActiveAttrib", (FuncType) glGetActiveAttrib },
- { "glGetActiveUniform", (FuncType) glGetActiveUniform },
- { "glGetAttachedShaders", (FuncType) glGetAttachedShaders },
- { "glGetAttribLocation", (FuncType) glGetAttribLocation },
- { "glGetBufferParameteriv", (FuncType) glGetBufferParameteriv },
- { "glGetFramebufferAttachmentParameteriv", (FuncType) glGetFramebufferAttachmentParameteriv },
- { "glGetProgramiv", (FuncType) glGetProgramiv },
- { "glGetProgramInfoLog", (FuncType) glGetProgramInfoLog },
- { "glGetRenderbufferParameteriv", (FuncType) glGetRenderbufferParameteriv },
- { "glGetShaderiv", (FuncType) glGetShaderiv },
- { "glGetShaderInfoLog", (FuncType) glGetShaderInfoLog },
- { "glGetShaderPrecisionFormat", (FuncType) glGetShaderPrecisionFormat },
- { "glGetShaderSource", (FuncType) glGetShaderSource },
- { "glGetUniformfv", (FuncType) glGetUniformfv },
- { "glGetUniformiv", (FuncType) glGetUniformiv },
- { "glGetUniformLocation", (FuncType) glGetUniformLocation },
- { "glGetVertexAttribfv", (FuncType) glGetVertexAttribfv },
- { "glGetVertexAttribiv", (FuncType) glGetVertexAttribiv },
- { "glGetVertexAttribPointerv", (FuncType) glGetVertexAttribPointerv },
- { "glIsBuffer", (FuncType) glIsBuffer },
- { "glIsFramebuffer", (FuncType) glIsFramebuffer },
- { "glIsProgram", (FuncType) glIsProgram },
- { "glIsRenderbuffer", (FuncType) glIsRenderbuffer },
- { "glIsShader", (FuncType) glIsShader },
- { "glLinkProgram", (FuncType) glLinkProgram },
- { "glReleaseShaderCompiler", (FuncType) glReleaseShaderCompiler },
- { "glRenderbufferStorage", (FuncType) glRenderbufferStorage },
- { "glSampleCoverage", (FuncType) glSampleCoverage },
- { "glShaderBinary", (FuncType) glShaderBinary },
- { "glShaderSource", (FuncType) glShaderSource },
- { "glStencilFuncSeparate", (FuncType) glStencilFuncSeparate },
- { "glStencilMaskSeparate", (FuncType) glStencilMaskSeparate },
- { "glStencilOpSeparate", (FuncType) glStencilOpSeparate },
- { "glUniform1f", (FuncType) glUniform1f },
- { "glUniform1fv", (FuncType) glUniform1fv },
- { "glUniform1i", (FuncType) glUniform1i },
- { "glUniform1iv", (FuncType) glUniform1iv },
- { "glUniform2f", (FuncType) glUniform2f },
- { "glUniform2fv", (FuncType) glUniform2fv },
- { "glUniform2i", (FuncType) glUniform2i },
- { "glUniform2iv", (FuncType) glUniform2iv },
- { "glUniform3f", (FuncType) glUniform3f },
- { "glUniform3fv", (FuncType) glUniform3fv },
- { "glUniform3i", (FuncType) glUniform3i },
- { "glUniform3iv", (FuncType) glUniform3iv },
- { "glUniform4f", (FuncType) glUniform4f },
- { "glUniform4fv", (FuncType) glUniform4fv },
- { "glUniform4i", (FuncType) glUniform4i },
- { "glUniform4iv", (FuncType) glUniform4iv },
- { "glUniformMatrix2fv", (FuncType) glUniformMatrix2fv },
- { "glUniformMatrix3fv", (FuncType) glUniformMatrix3fv },
- { "glUniformMatrix4fv", (FuncType) glUniformMatrix4fv },
- { "glUseProgram", (FuncType) glUseProgram },
- { "glValidateProgram", (FuncType) glValidateProgram },
- { "glVertexAttrib1f", (FuncType) glVertexAttrib1f },
- { "glVertexAttrib1fv", (FuncType) glVertexAttrib1fv },
- { "glVertexAttrib2f", (FuncType) glVertexAttrib2f },
- { "glVertexAttrib2fv", (FuncType) glVertexAttrib2fv },
- { "glVertexAttrib3f", (FuncType) glVertexAttrib3f },
- { "glVertexAttrib3fv", (FuncType) glVertexAttrib3fv },
- { "glVertexAttrib4f", (FuncType) glVertexAttrib4f },
- { "glVertexAttrib4fv", (FuncType) glVertexAttrib4fv },
- { "glVertexAttribPointer", (FuncType) glVertexAttribPointer }
- };
- for (size_t i = 0; i < sizeof(tab) / sizeof(Tab); ++i) {
- uint len = qstrlen(tab[i].name);
- if (!qstrncmp(tab[i].name, procname, len)
- && procname[len] == '\0') {
- f = tab[i].func;
- break;
- }
- }
- if (!f)
- qCDebug(qglLc, "eglGetProcAddress failed for %s", procname);
- }
-
- return f;
-}
-
-} // extern "C"
-
-// For QOpenGLFunctions
-int qgl_proxyLibraryType(void)
-{
- return qgl_choose()->libraryType();
-}
-
-HMODULE qgl_glHandle(void)
-{
- return qgl_choose()->libraryHandle();
-}
-
-QAbstractWindowsOpenGL::QAbstractWindowsOpenGL()
- :
- CopyContext(0),
- CreateContext(0),
- CreateLayerContext(0),
- DeleteContext(0),
- GetCurrentContext(0),
- GetCurrentDC(0),
- GetProcAddress(0),
- MakeCurrent(0),
- ShareLists(0),
- UseFontBitmapsW(0),
- UseFontOutlinesW(0),
- DescribeLayerPlane(0),
- SetLayerPaletteEntries(0),
- GetLayerPaletteEntries(0),
- RealizeLayerPalette(0),
- SwapLayerBuffers(0),
- SwapMultipleBuffers(0),
-
- EGL_GetError(0),
- EGL_GetDisplay(0),
- EGL_Initialize(0),
- EGL_Terminate(0),
- EGL_QueryString(0),
- EGL_GetConfigs(0),
- EGL_ChooseConfig(0),
- EGL_GetConfigAttrib(0),
- EGL_CreateWindowSurface(0),
- EGL_CreatePbufferSurface(0),
- EGL_CreatePixmapSurface(0),
- EGL_DestroySurface(0),
- EGL_QuerySurface(0),
- EGL_BindAPI(0),
- EGL_QueryAPI(0),
- EGL_WaitClient(0),
- EGL_ReleaseThread(0),
- EGL_CreatePbufferFromClientBuffer(0),
- EGL_SurfaceAttrib(0),
- EGL_BindTexImage(0),
- EGL_ReleaseTexImage(0),
- EGL_SwapInterval(0),
- EGL_CreateContext(0),
- EGL_DestroyContext(0),
- EGL_MakeCurrent (0),
- EGL_GetCurrentContext(0),
- EGL_GetCurrentSurface(0),
- EGL_GetCurrentDisplay(0),
- EGL_QueryContext(0),
- EGL_WaitGL(0),
- EGL_WaitNative(0),
- EGL_SwapBuffers(0),
- EGL_CopyBuffers(0),
- EGL_GetProcAddress(0),
-
- Viewport(0),
- DepthRange(0),
- IsEnabled(0),
- GetTexLevelParameteriv(0),
- GetTexLevelParameterfv(0),
- GetTexParameteriv(0),
- GetTexParameterfv(0),
- GetTexImage(0),
- GetString(0),
- GetIntegerv(0),
- GetFloatv(0),
- GetError(0),
- GetDoublev(0),
- GetBooleanv(0),
- ReadPixels(0),
- ReadBuffer(0),
- PixelStorei(0),
- PixelStoref(0),
- DepthFunc(0),
- StencilOp(0),
- StencilFunc(0),
- LogicOp(0),
- BlendFunc(0),
- Flush(0),
- Finish(0),
- Enable(0),
- Disable(0),
- DepthMask(0),
- ColorMask(0),
- StencilMask(0),
- ClearDepth(0),
- ClearStencil(0),
- ClearColor(0),
- Clear(0),
- DrawBuffer(0),
- TexImage2D(0),
- TexImage1D(0),
- TexParameteriv(0),
- TexParameteri(0),
- TexParameterfv(0),
- TexParameterf(0),
- Scissor(0),
- PolygonMode(0),
- PointSize(0),
- LineWidth(0),
- Hint(0),
- FrontFace(0),
- CullFace(0),
-
- Translatef(0),
- Translated(0),
- Scalef(0),
- Scaled(0),
- Rotatef(0),
- Rotated(0),
- PushMatrix(0),
- PopMatrix(0),
- Ortho(0),
- MultMatrixd(0),
- MultMatrixf(0),
- MatrixMode(0),
- LoadMatrixd(0),
- LoadMatrixf(0),
- LoadIdentity(0),
- Frustum(0),
- IsList(0),
- GetTexGeniv(0),
- GetTexGenfv(0),
- GetTexGendv(0),
- GetTexEnviv(0),
- GetTexEnvfv(0),
- GetPolygonStipple(0),
- GetPixelMapusv(0),
- GetPixelMapuiv(0),
- GetPixelMapfv(0),
- GetMaterialiv(0),
- GetMaterialfv(0),
- GetMapiv(0),
- GetMapfv(0),
- GetMapdv(0),
- GetLightiv(0),
- GetLightfv(0),
- GetClipPlane(0),
- DrawPixels(0),
- CopyPixels(0),
- PixelMapusv(0),
- PixelMapuiv(0),
- PixelMapfv(0),
- PixelTransferi(0),
- PixelTransferf(0),
- PixelZoom(0),
- AlphaFunc(0),
- EvalPoint2(0),
- EvalMesh2(0),
- EvalPoint1(0),
- EvalMesh1(0),
- EvalCoord2fv(0),
- EvalCoord2f(0),
- EvalCoord2dv(0),
- EvalCoord2d(0),
- EvalCoord1fv(0),
- EvalCoord1f(0),
- EvalCoord1dv(0),
- EvalCoord1d(0),
- MapGrid2f(0),
- MapGrid2d(0),
- MapGrid1f(0),
- MapGrid1d(0),
- Map2f(0),
- Map2d(0),
- Map1f(0),
- Map1d(0),
- PushAttrib(0),
- PopAttrib(0),
- Accum(0),
- IndexMask(0),
- ClearIndex(0),
- ClearAccum(0),
- PushName(0),
- PopName(0),
- PassThrough(0),
- LoadName(0),
- InitNames(0),
- RenderMode(0),
- SelectBuffer(0),
- FeedbackBuffer(0),
- TexGeniv(0),
- TexGeni(0),
- TexGenfv(0),
- TexGenf(0),
- TexGendv(0),
- TexGend(0),
- TexEnviv(0),
- TexEnvi(0),
- TexEnvfv(0),
- TexEnvf(0),
- ShadeModel(0),
- PolygonStipple(0),
- Materialiv(0),
- Materiali(0),
- Materialfv(0),
- Materialf(0),
- LineStipple(0),
- LightModeliv(0),
- LightModeli(0),
- LightModelfv(0),
- LightModelf(0),
- Lightiv(0),
- Lighti(0),
- Lightfv(0),
- Lightf(0),
- Fogiv(0),
- Fogi(0),
- Fogfv(0),
- Fogf(0),
- ColorMaterial(0),
- ClipPlane(0),
- Vertex4sv(0),
- Vertex4s(0),
- Vertex4iv(0),
- Vertex4i(0),
- Vertex4fv(0),
- Vertex4f(0),
- Vertex4dv(0),
- Vertex4d(0),
- Vertex3sv(0),
- Vertex3s(0),
- Vertex3iv(0),
- Vertex3i(0),
- Vertex3fv(0),
- Vertex3f(0),
- Vertex3dv(0),
- Vertex3d(0),
- Vertex2sv(0),
- Vertex2s(0),
- Vertex2iv(0),
- Vertex2i(0),
- Vertex2fv(0),
- Vertex2f(0),
- Vertex2dv(0),
- Vertex2d(0),
- TexCoord4sv(0),
- TexCoord4s(0),
- TexCoord4iv(0),
- TexCoord4i(0),
- TexCoord4fv(0),
- TexCoord4f(0),
- TexCoord4dv(0),
- TexCoord4d(0),
- TexCoord3sv(0),
- TexCoord3s(0),
- TexCoord3iv(0),
- TexCoord3i(0),
- TexCoord3fv(0),
- TexCoord3f(0),
- TexCoord3dv(0),
- TexCoord3d(0),
- TexCoord2sv(0),
- TexCoord2s(0),
- TexCoord2iv(0),
- TexCoord2i(0),
- TexCoord2fv(0),
- TexCoord2f(0),
- TexCoord2dv(0),
- TexCoord2d(0),
- TexCoord1sv(0),
- TexCoord1s(0),
- TexCoord1iv(0),
- TexCoord1i(0),
- TexCoord1fv(0),
- TexCoord1f(0),
- TexCoord1dv(0),
- TexCoord1d(0),
- Rectsv(0),
- Rects(0),
- Rectiv(0),
- Recti(0),
- Rectfv(0),
- Rectf(0),
- Rectdv(0),
- Rectd(0),
- RasterPos4sv(0),
- RasterPos4s(0),
- RasterPos4iv(0),
- RasterPos4i(0),
- RasterPos4fv(0),
- RasterPos4f(0),
- RasterPos4dv(0),
- RasterPos4d(0),
- RasterPos3sv(0),
- RasterPos3s(0),
- RasterPos3iv(0),
- RasterPos3i(0),
- RasterPos3fv(0),
- RasterPos3f(0),
- RasterPos3dv(0),
- RasterPos3d(0),
- RasterPos2sv(0),
- RasterPos2s(0),
- RasterPos2iv(0),
- RasterPos2i(0),
- RasterPos2fv(0),
- RasterPos2f(0),
- RasterPos2dv(0),
- RasterPos2d(0),
- Normal3sv(0),
- Normal3s(0),
- Normal3iv(0),
- Normal3i(0),
- Normal3fv(0),
- Normal3f(0),
- Normal3dv(0),
- Normal3d(0),
- Normal3bv(0),
- Normal3b(0),
- Indexsv(0),
- Indexs(0),
- Indexiv(0),
- Indexi(0),
- Indexfv(0),
- Indexf(0),
- Indexdv(0),
- Indexd(0),
- End(0),
- EdgeFlagv(0),
- EdgeFlag(0),
- Color4usv(0),
- Color4us(0),
- Color4uiv(0),
- Color4ui(0),
- Color4ubv(0),
- Color4ub(0),
- Color4sv(0),
- Color4s(0),
- Color4iv(0),
- Color4i(0),
- Color4fv(0),
- Color4f(0),
- Color4dv(0),
- Color4d(0),
- Color4bv(0),
- Color4b(0),
- Color3usv(0),
- Color3us(0),
- Color3uiv(0),
- Color3ui(0),
- Color3ubv(0),
- Color3ub(0),
- Color3sv(0),
- Color3s(0),
- Color3iv(0),
- Color3i(0),
- Color3fv(0),
- Color3f(0),
- Color3dv(0),
- Color3d(0),
- Color3bv(0),
- Color3b(0),
- Bitmap(0),
- Begin(0),
- ListBase(0),
- GenLists(0),
- DeleteLists(0),
- CallLists(0),
- CallList(0),
- EndList(0),
- NewList(0),
-
- Indexubv(0),
- Indexub(0),
- IsTexture(0),
- GenTextures(0),
- DeleteTextures(0),
- BindTexture(0),
- TexSubImage2D(0),
- TexSubImage1D(0),
- CopyTexSubImage2D(0),
- CopyTexSubImage1D(0),
- CopyTexImage2D(0),
- CopyTexImage1D(0),
- PolygonOffset(0),
- GetPointerv(0),
- DrawElements(0),
- DrawArrays(0),
-
- PushClientAttrib(0),
- PopClientAttrib(0),
- PrioritizeTextures(0),
- AreTexturesResident(0),
- VertexPointer(0),
- TexCoordPointer(0),
- NormalPointer(0),
- InterleavedArrays(0),
- IndexPointer(0),
- EnableClientState(0),
- EdgeFlagPointer(0),
- DisableClientState(0),
- ColorPointer(0),
- ArrayElement(0),
-
- ActiveTexture(0),
- AttachShader(0),
- BindAttribLocation(0),
- BindBuffer(0),
- BindFramebuffer(0),
- BindRenderbuffer(0),
- BlendColor(0),
- BlendEquation(0),
- BlendEquationSeparate(0),
- BlendFuncSeparate(0),
- BufferData(0),
- BufferSubData(0),
- CheckFramebufferStatus(0),
- ClearDepthf(0),
- CompileShader(0),
- CompressedTexImage2D(0),
- CompressedTexSubImage2D(0),
- CreateProgram(0),
- CreateShader(0),
- DeleteBuffers(0),
- DeleteFramebuffers(0),
- DeleteProgram(0),
- DeleteRenderbuffers(0),
- DeleteShader(0),
- DepthRangef(0),
- DetachShader(0),
- DisableVertexAttribArray(0),
- EnableVertexAttribArray(0),
- FramebufferRenderbuffer(0),
- FramebufferTexture2D(0),
- GenBuffers(0),
- GenerateMipmap(0),
- GenFramebuffers(0),
- GenRenderbuffers(0),
- GetActiveAttrib(0),
- GetActiveUniform(0),
- GetAttachedShaders(0),
- GetAttribLocation(0),
- GetBufferParameteriv(0),
- GetFramebufferAttachmentParameteriv(0),
- GetProgramiv(0),
- GetProgramInfoLog(0),
- GetRenderbufferParameteriv(0),
- GetShaderiv(0),
- GetShaderInfoLog(0),
- GetShaderPrecisionFormat(0),
- GetShaderSource(0),
- GetUniformfv(0),
- GetUniformiv(0),
- GetUniformLocation(0),
- GetVertexAttribfv(0),
- GetVertexAttribiv(0),
- GetVertexAttribPointerv(0),
- IsBuffer(0),
- IsFramebuffer(0),
- IsProgram(0),
- IsRenderbuffer(0),
- IsShader(0),
- LinkProgram(0),
- ReleaseShaderCompiler(0),
- RenderbufferStorage(0),
- SampleCoverage(0),
- ShaderBinary(0),
- ShaderSource(0),
- StencilFuncSeparate(0),
- StencilMaskSeparate(0),
- StencilOpSeparate(0),
- Uniform1f(0),
- Uniform1fv(0),
- Uniform1i(0),
- Uniform1iv(0),
- Uniform2f(0),
- Uniform2fv(0),
- Uniform2i(0),
- Uniform2iv(0),
- Uniform3f(0),
- Uniform3fv(0),
- Uniform3i(0),
- Uniform3iv(0),
- Uniform4f(0),
- Uniform4fv(0),
- Uniform4i(0),
- Uniform4iv(0),
- UniformMatrix2fv(0),
- UniformMatrix3fv(0),
- UniformMatrix4fv(0),
- UseProgram(0),
- ValidateProgram(0),
- VertexAttrib1f(0),
- VertexAttrib1fv(0),
- VertexAttrib2f(0),
- VertexAttrib2fv(0),
- VertexAttrib3f(0),
- VertexAttrib3fv(0),
- VertexAttrib4f(0),
- VertexAttrib4fv(0),
- VertexAttribPointer(0),
-
- m_lib(0),
- m_libraryType(DesktopGL),
- m_loaded(false)
-{
-}
diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp
index 164e5e6925..d2429cdd23 100644
--- a/src/gui/opengl/qopenglshaderprogram.cpp
+++ b/src/gui/opengl/qopenglshaderprogram.cpp
@@ -176,7 +176,7 @@ public:
#endif
{
#ifndef QT_OPENGL_ES_2
- if (!QOpenGLFunctions::isES()) {
+ if (!ctx->isES()) {
QSurfaceFormat f = ctx->format();
// Geometry shaders require OpenGL >= 3.2
@@ -445,7 +445,7 @@ bool QOpenGLShader::compileSourceCode(const char *source)
#ifdef QOpenGL_REDEFINE_HIGHP
if (d->shaderType == Fragment && !ctx_d->workaround_missingPrecisionQualifiers
- && QOpenGLFunctions::isES()) {
+ && QOpenGLContext::currentContext()->isES()) {
src.append(redefineHighp);
srclen.append(GLint(sizeof(redefineHighp) - 1));
}
@@ -674,7 +674,7 @@ bool QOpenGLShaderProgram::init()
#ifndef QT_OPENGL_ES_2
// Resolve OpenGL 4 functions for tessellation shader support
QSurfaceFormat format = context->format();
- if (!QOpenGLFunctions::isES()
+ if (!context->isES()
&& format.version() >= qMakePair<int, int>(4, 0)) {
d->tessellationFuncs = context->versionFunctions<QOpenGLFunctions_4_0_Core>();
d->tessellationFuncs->initializeOpenGLFunctions();
@@ -3035,7 +3035,8 @@ int QOpenGLShaderProgram::maxGeometryOutputVertices() const
{
GLint n = 0;
#if defined(QT_OPENGL_3_2)
- glGetIntegerv(GL_MAX_GEOMETRY_OUTPUT_VERTICES, &n);
+ Q_D(const QOpenGLShaderProgram);
+ d->glfuncs->glGetIntegerv(GL_MAX_GEOMETRY_OUTPUT_VERTICES, &n);
#endif
return n;
}
@@ -3273,7 +3274,7 @@ bool QOpenGLShader::hasOpenGLShaders(ShaderType type, QOpenGLContext *context)
#ifndef QT_OPENGL_ES_2
// Geometry shaders require OpenGL 3.2 or newer
QSurfaceFormat format = context->format();
- return (!QOpenGLFunctions::isES())
+ return (!context->isES())
&& (format.version() >= qMakePair<int, int>(3, 2));
#else
// No geometry shader support in OpenGL ES2
@@ -3281,7 +3282,7 @@ bool QOpenGLShader::hasOpenGLShaders(ShaderType type, QOpenGLContext *context)
#endif
} else if (type == TessellationControl || type == TessellationEvaluation) {
#if !defined(QT_OPENGL_ES_2)
- return (!QOpenGLFunctions::isES())
+ return (!context->isES())
&& (format.version() >= qMakePair<int, int>(4, 0));
#else
// No tessellation shader support in OpenGL ES2
diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp
index 8bdbdba6f7..983496230d 100644
--- a/src/gui/opengl/qopengltexture.cpp
+++ b/src/gui/opengl/qopengltexture.cpp
@@ -1461,7 +1461,7 @@ QOpenGLTexture::QOpenGLTexture(Target target)
/*!
Creates a QOpenGLTexture object that can later be bound to the 2D texture
target and contains the pixel data contained in \a image. If you wish
- to have a chain of mipmaps generated then set \a useMipMaps to true (this
+ to have a chain of mipmaps generated then set \a genMipMaps to \c true (this
is the default).
This does create the underlying OpenGL texture object. Therefore,
@@ -1491,6 +1491,8 @@ QOpenGLTexture::~QOpenGLTexture()
functions that set properties of the texture object implicitly call create()
on your behalf.
+ Returns \c true if the creation succeeded, otherwise returns \c false.
+
\sa destroy(), isCreated(), textureId()
*/
bool QOpenGLTexture::create()
@@ -1557,9 +1559,8 @@ void QOpenGLTexture::bind()
EXT_direct_state_access extension where available and simulates it
where it is not.
- If \a restoreTextureUnit is true then this function
- will restore the active unit to the texture unit that was active
- upon entry.
+ If parameter \a reset is \c true then this function will restore
+ the active unit to the texture unit that was active upon entry.
\sa release()
*/
@@ -1584,7 +1585,7 @@ void QOpenGLTexture::release()
/*!
Unbinds this texture from texture unit \a unit.
- If \a restoreTextureUnit is true then this function
+ If parameter \a reset is \c true then this function
will restore the active unit to the texture unit that was active
upon entry.
*/
@@ -1633,7 +1634,7 @@ GLuint QOpenGLTexture::boundTextureId(BindingTarget target)
}
GLint textureId = 0;
- glGetIntegerv(target, &textureId);
+ ctx->functions()->glGetIntegerv(target, &textureId);
return static_cast<GLuint>(textureId);
}
@@ -1653,11 +1654,11 @@ GLuint QOpenGLTexture::boundTextureId(uint unit, BindingTarget target)
funcs->initializeOpenGLFunctions();
GLint oldTextureUnit = 0;
- glGetIntegerv(GL_ACTIVE_TEXTURE, &oldTextureUnit);
+ funcs->glGetIntegerv(GL_ACTIVE_TEXTURE, &oldTextureUnit);
funcs->glActiveTexture(unit);
GLint textureId = 0;
- glGetIntegerv(target, &textureId);
+ funcs->glGetIntegerv(target, &textureId);
funcs->glActiveTexture(oldTextureUnit);
return static_cast<GLuint>(textureId);
@@ -1838,11 +1839,11 @@ QOpenGLTexture::TextureFormat QOpenGLTexture::format() const
}
/*!
- Sets the dimensions of this texture object. The default
- for each dimension is 1. The maximum allowable texture size
- is dependent upon your OpenGL implementation. Allocating
- storage for a texture less than the maximum size can still
- fail if your system is low on resources.
+ Sets the dimensions of this texture object to \a width,
+ \a height, and \a depth. The default for each dimension is 1.
+ The maximum allowable texture size is dependent upon your OpenGL
+ implementation. Allocating storage for a texture less than the
+ maximum size can still fail if your system is low on resources.
\sa width(), height(), depth()
*/
@@ -1925,8 +1926,8 @@ int QOpenGLTexture::depth() const
}
/*!
- For texture targets that support mipmaps this function
- sets the requested number of mipmap levels to allocate storage
+ For texture targets that support mipmaps, this function
+ sets the requested number of mipmap \a levels to allocate storage
for. This function should be called before storage is allocated
for the texture.
@@ -1991,11 +1992,10 @@ int QOpenGLTexture::maximumMipLevels() const
}
/*!
- For those texture targets that support array layers this function
- sets the number of array layers to allocate storage for. This
- function should be called before storage is allocated for the tecture.
+ Sets the number of array \a layers to allocate storage for. This
+ function should be called before storage is allocated for the texture.
- For tarets that do not support array layers this function has
+ For targets that do not support array layers this function has
no effect.
\sa layers(), isStorageAllocated()
@@ -2116,13 +2116,13 @@ bool QOpenGLTexture::isStorageAllocated() const
Simpliar constraints apply for the \a viewFormat. See the above link
and the specification for more details.
- The \a minimumMipmapLevel, \a maximumMipmapLevel, \a mimimumLayer,
+ The \a minimumMipmapLevel, \a maximumMipmapLevel, \a minimumLayer,
and \a maximumLayer arguments serve to restrict the parts of the
texture accessible by the texture view.
If creation of the texture view fails this function will return
0. If the function succeeds it will return a pointer to a new
- QOpenGLTexture object that will return true from its isTextureView()
+ QOpenGLTexture object that will return \c true from its isTextureView()
function.
\sa isTextureView()
@@ -2158,7 +2158,7 @@ bool QOpenGLTexture::isTextureView() const
}
/*!
- Uploads pixel \a data for this texture object \a mipLevel, array \a layer and \acubeFace.
+ Uploads pixel \a data for this texture object \a mipLevel, array \a layer, and \a cubeFace.
Storage must have been allocated before uploading pixel data. Some overloads of setData()
will set appropriate dimensions, mipmap levels, and array layers and then allocate storage
for you if they have enough information to do so. This will be noted in the function
@@ -2285,6 +2285,8 @@ void QOpenGLTexture::setData(PixelFormat sourceFormat, PixelType sourceType,
/*!
This overload of setData() will allocate storage for you.
+ The pixel data is contained in \a image. Mipmaps are generated by default.
+ Set \a genMipMaps to \l DontGenerateMipMaps to turn off mipmap generation.
\overload
*/
@@ -2303,7 +2305,7 @@ void QOpenGLTexture::setData(const QImage& image, MipMapGeneration genMipMaps)
}
/*!
- Uploads compressed pixel \a data to \a mipLevel, array \a layer and \a cubeFace.
+ Uploads compressed pixel \a data to \a mipLevel, array \a layer, and \a cubeFace.
The pixel transfer can optionally be controlled with \a options. The \a dataSize
argument should specify the size of the data pointed to by \a data.
@@ -2430,7 +2432,7 @@ bool QOpenGLTexture::hasFeature(Feature feature)
bool supported = false;
#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLFunctions::isES()) {
+ if (!ctx->isES()) {
switch (feature) {
case ImmutableMultisampleStorage:
case TextureBuffer:
@@ -2487,7 +2489,7 @@ bool QOpenGLTexture::hasFeature(Feature feature)
}
}
- if (QOpenGLFunctions::isES())
+ if (ctx->isES())
#endif
{
switch (feature) {
@@ -2522,7 +2524,7 @@ bool QOpenGLTexture::hasFeature(Feature feature)
void QOpenGLTexture::setMipBaseLevel(int baseLevel)
{
#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLFunctions::isES()) {
+ if (!QOpenGLContext::currentContext()->isES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->textureId);
@@ -2559,7 +2561,7 @@ int QOpenGLTexture::mipBaseLevel() const
void QOpenGLTexture::setMipMaxLevel(int maxLevel)
{
#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLFunctions::isES()) {
+ if (!QOpenGLContext::currentContext()->isES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->textureId);
@@ -2596,7 +2598,7 @@ int QOpenGLTexture::mipMaxLevel() const
void QOpenGLTexture::setMipLevelRange(int baseLevel, int maxLevel)
{
#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLFunctions::isES()) {
+ if (!QOpenGLContext::currentContext()->isES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->textureId);
@@ -2625,7 +2627,7 @@ QPair<int, int> QOpenGLTexture::mipLevelRange() const
}
/*!
- If \a enabled is true, enables automatic mipmap generation for this texture object
+ If \a enabled is \c true, enables automatic mipmap generation for this texture object
to occur whenever the level 0 mipmap data is set via setData().
The automatic mipmap generation is enabled by default.
@@ -2673,7 +2675,7 @@ void QOpenGLTexture::generateMipMaps()
The generation of mipmaps to above \baseLevel is achieved by setting the mipmap
base level to \a baseLevel and then generating the mipmap chain. If \a resetBaseLevel
- is true, then the baseLevel of the texture will be reset to its previous value.
+ is \c true, then the baseLevel of the texture will be reset to its previous value.
\sa setAutoMipMapGenerationEnabled(), setMipLevels(), mipLevels()
*/
@@ -2706,7 +2708,7 @@ void QOpenGLTexture::generateMipMaps(int baseLevel, bool resetBaseLevel)
void QOpenGLTexture::setSwizzleMask(SwizzleComponent component, SwizzleValue value)
{
#if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2)
- if (!QOpenGLFunctions::isES()) {
+ if (!QOpenGLContext::currentContext()->isES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -2727,13 +2729,15 @@ void QOpenGLTexture::setSwizzleMask(SwizzleComponent component, SwizzleValue val
}
/*!
+ Parameters \a {r}, \a {g}, \a {b}, and \a {a} are values used for setting
+ the colors red, green, blue, and the alpha value.
\overload
*/
void QOpenGLTexture::setSwizzleMask(SwizzleValue r, SwizzleValue g,
SwizzleValue b, SwizzleValue a)
{
#if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2)
- if (!QOpenGLFunctions::isES()) {
+ if (!QOpenGLContext::currentContext()->isES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -2782,7 +2786,7 @@ QOpenGLTexture::SwizzleValue QOpenGLTexture::swizzleMask(SwizzleComponent compon
void QOpenGLTexture::setDepthStencilMode(QOpenGLTexture::DepthStencilMode mode)
{
#if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2)
- if (!QOpenGLFunctions::isES()) {
+ if (!QOpenGLContext::currentContext()->isES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -2941,6 +2945,7 @@ void QOpenGLTexture::setWrapMode(QOpenGLTexture::WrapMode mode)
}
/*!
+ Holds the texture dimension \a direction.
\overload
*/
void QOpenGLTexture::setWrapMode(QOpenGLTexture::CoordinateDirection direction, QOpenGLTexture::WrapMode mode)
@@ -2972,7 +2977,7 @@ QOpenGLTexture::WrapMode QOpenGLTexture::wrapMode(QOpenGLTexture::CoordinateDire
void QOpenGLTexture::setBorderColor(QColor color)
{
#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLFunctions::isES()) {
+ if (!QOpenGLContext::currentContext()->isES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -2995,12 +3000,14 @@ void QOpenGLTexture::setBorderColor(QColor color)
}
/*!
+ Sets the color red to \a {r}, green to \a {g}, blue to \{b}, and \a {a} to the
+ alpha value.
\overload
*/
void QOpenGLTexture::setBorderColor(float r, float g, float b, float a)
{
#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLFunctions::isES()) {
+ if (!QOpenGLContext::currentContext()->isES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -3026,12 +3033,14 @@ void QOpenGLTexture::setBorderColor(float r, float g, float b, float a)
}
/*!
+ Sets the color red to \a {r}, green to \a {g}, blue to \a {b}, and \a the alpha
+ value to {a}.
\overload
*/
void QOpenGLTexture::setBorderColor(int r, int g, int b, int a)
{
#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLFunctions::isES()) {
+ if (!QOpenGLContext::currentContext()->isES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -3059,12 +3068,14 @@ void QOpenGLTexture::setBorderColor(int r, int g, int b, int a)
}
/*!
+ Sets the color red to \a {r}, green to \a {g}, blue to \a {b}, and \a the alpha
+ value to {a}.
\overload
*/
void QOpenGLTexture::setBorderColor(uint r, uint g, uint b, uint a)
{
#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLFunctions::isES()) {
+ if (!QOpenGLContext::currentContext()->isES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -3110,7 +3121,7 @@ QColor QOpenGLTexture::borderColor() const
}
/*!
- Writes the texture border color into the first 4 elements
+ Writes the texture border color into the first four elements
of the array pointed to by \a border.
\sa setBorderColor()
@@ -3129,6 +3140,9 @@ void QOpenGLTexture::borderColor(float *border) const
}
/*!
+ Writes the texture border color into the first four elements
+ of the array pointed to by \a border.
+
\overload
*/
void QOpenGLTexture::borderColor(int *border) const
@@ -3145,6 +3159,9 @@ void QOpenGLTexture::borderColor(int *border) const
}
/*!
+ Writes the texture border color into the first four elements
+ of the array pointed to by \a border.
+
\overload
*/
void QOpenGLTexture::borderColor(unsigned int *border) const
@@ -3170,7 +3187,7 @@ void QOpenGLTexture::borderColor(unsigned int *border) const
void QOpenGLTexture::setMinimumLevelOfDetail(float value)
{
#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLFunctions::isES()) {
+ if (!QOpenGLContext::currentContext()->isES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -3207,7 +3224,7 @@ float QOpenGLTexture::minimumLevelOfDetail() const
void QOpenGLTexture::setMaximumLevelOfDetail(float value)
{
#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLFunctions::isES()) {
+ if (!QOpenGLContext::currentContext()->isES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -3235,15 +3252,15 @@ float QOpenGLTexture::maximumLevelOfDetail() const
}
/*!
- Sets the minimum and maximum level of detail parameters.
-
+ Sets the minimum level of detail parameters to \a min and the maximum level
+ to \a max.
\note This function has no effect on Qt built for OpenGL ES 2.
\sa levelOfDetailRange(), setMinimumLevelOfDetail(), setMaximumLevelOfDetail()
*/
void QOpenGLTexture::setLevelOfDetailRange(float min, float max)
{
#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLFunctions::isES()) {
+ if (!QOpenGLContext::currentContext()->isES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -3274,7 +3291,10 @@ QPair<float, float> QOpenGLTexture::levelOfDetailRange() const
}
/*!
- Sets the level of detail bias parameter.
+ Sets the level of detail bias to \a bias.
+ Level of detail bias affects the point at which mipmapping levels change.
+ Increasing values for level of detail bias makes the overall images blurrier
+ or smoother. Decreasing values make the overall images sharper.
\note This function has no effect on Qt built for OpenGL ES 2.
\sa levelofDetailBias()
@@ -3282,7 +3302,7 @@ QPair<float, float> QOpenGLTexture::levelOfDetailRange() const
void QOpenGLTexture::setLevelofDetailBias(float bias)
{
#if !defined(QT_OPENGL_ES_2)
- if (!QOpenGLFunctions::isES()) {
+ if (!QOpenGLContext::currentContext()->isES()) {
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
diff --git a/src/gui/opengl/qopengltextureblitter.cpp b/src/gui/opengl/qopengltextureblitter.cpp
index b776444347..d52517add2 100644
--- a/src/gui/opengl/qopengltextureblitter.cpp
+++ b/src/gui/opengl/qopengltextureblitter.cpp
@@ -45,6 +45,7 @@
#include <QtGui/QOpenGLShaderProgram>
#include <QtGui/QOpenGLVertexArrayObject>
#include <QtGui/QOpenGLContext>
+#include <QtGui/QOpenGLFunctions>
QT_BEGIN_NAMESPACE
@@ -120,11 +121,11 @@ class TextureBinder
public:
TextureBinder(GLuint textureId)
{
- glBindTexture(GL_TEXTURE_2D, textureId);
+ QOpenGLContext::currentContext()->functions()->glBindTexture(GL_TEXTURE_2D, textureId);
}
~TextureBinder()
{
- glBindTexture(GL_TEXTURE_2D, 0);
+ QOpenGLContext::currentContext()->functions()->glBindTexture(GL_TEXTURE_2D, 0);
}
};
@@ -196,7 +197,7 @@ void QOpenGLTextureBlitterPrivate::blit(GLuint texture,
program->setUniformValue(textureTransformUniformPos, textureTransform);
textureMatrixUniformState = User;
- glDrawArrays(GL_TRIANGLES, 0, 6);
+ QOpenGLContext::currentContext()->functions()->glDrawArrays(GL_TRIANGLES, 0, 6);
}
void QOpenGLTextureBlitterPrivate::blit(GLuint texture,
@@ -219,7 +220,7 @@ void QOpenGLTextureBlitterPrivate::blit(GLuint texture,
textureMatrixUniformState = Identity;
}
- glDrawArrays(GL_TRIANGLES, 0, 6);
+ QOpenGLContext::currentContext()->functions()->glDrawArrays(GL_TRIANGLES, 0, 6);
}
QOpenGLTextureBlitter::QOpenGLTextureBlitter()
diff --git a/src/gui/opengl/qopengltexturecache.cpp b/src/gui/opengl/qopengltexturecache.cpp
index 750264935b..f4aa29ac0f 100644
--- a/src/gui/opengl/qopengltexturecache.cpp
+++ b/src/gui/opengl/qopengltexturecache.cpp
@@ -117,7 +117,7 @@ GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, const QPixmap &
if (!pixmap.paintingActive()) {
QOpenGLCachedTexture *entry = m_cache.object(key);
if (entry) {
- glBindTexture(GL_TEXTURE_2D, entry->id());
+ context->functions()->glBindTexture(GL_TEXTURE_2D, entry->id());
return entry->id();
}
}
@@ -154,7 +154,7 @@ GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, const QImage &i
if (!image.paintingActive()) {
QOpenGLCachedTexture *entry = m_cache.object(key);
if (entry) {
- glBindTexture(GL_TEXTURE_2D, entry->id());
+ context->functions()->glBindTexture(GL_TEXTURE_2D, entry->id());
return entry->id();
}
}
@@ -181,12 +181,13 @@ GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, const QImage &i
GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, qint64 key, const QImage &image)
{
GLuint id;
- glGenTextures(1, &id);
- glBindTexture(GL_TEXTURE_2D, id);
+ QOpenGLFunctions *funcs = context->functions();
+ funcs->glGenTextures(1, &id);
+ funcs->glBindTexture(GL_TEXTURE_2D, id);
QImage tx = image.convertToFormat(QImage::Format_RGBA8888_Premultiplied);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tx.width(), tx.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, const_cast<const QImage &>(tx).bits());
+ funcs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tx.width(), tx.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, const_cast<const QImage &>(tx).bits());
int cost = tx.width() * tx.height() * 4 / 1024;
m_cache.insert(key, new QOpenGLCachedTexture(id, context), cost);
@@ -210,9 +211,9 @@ void QOpenGLTextureCache::freeResource(QOpenGLContext *)
Q_ASSERT(false); // the texture cache lives until the context group disappears
}
-static void freeTexture(QOpenGLFunctions *, GLuint id)
+static void freeTexture(QOpenGLFunctions *funcs, GLuint id)
{
- glDeleteTextures(1, &id);
+ funcs->glDeleteTextures(1, &id);
}
QOpenGLCachedTexture::QOpenGLCachedTexture(GLuint id, QOpenGLContext *context)
diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp
index 3524c1cb1a..5844bf639c 100644
--- a/src/gui/opengl/qopengltextureglyphcache.cpp
+++ b/src/gui/opengl/qopengltextureglyphcache.cpp
@@ -122,8 +122,9 @@ void QOpenGLTextureGlyphCache::createTextureData(int width, int height)
if (!m_textureResource)
m_textureResource = new QOpenGLGlyphTexture(ctx);
- glGenTextures(1, &m_textureResource->m_texture);
- glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture);
+ QOpenGLFunctions *funcs = ctx->functions();
+ funcs->glGenTextures(1, &m_textureResource->m_texture);
+ funcs->glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture);
m_textureResource->m_width = width;
m_textureResource->m_height = height;
@@ -132,7 +133,7 @@ void QOpenGLTextureGlyphCache::createTextureData(int width, int height)
QVarLengthArray<uchar> data(width * height * 4);
for (int i = 0; i < data.size(); ++i)
data[i] = 0;
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, &data[0]);
+ funcs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, &data[0]);
} else {
QVarLengthArray<uchar> data(width * height);
for (int i = 0; i < data.size(); ++i)
@@ -144,13 +145,13 @@ void QOpenGLTextureGlyphCache::createTextureData(int width, int height)
const GLint internalFormat = GL_ALPHA;
const GLenum format = GL_ALPHA;
#endif
- glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format, GL_UNSIGNED_BYTE, &data[0]);
+ funcs->glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format, GL_UNSIGNED_BYTE, &data[0]);
}
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
m_filterMode = Nearest;
if (!m_buffer.isCreated()) {
@@ -187,8 +188,9 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height)
return;
}
+ QOpenGLFunctions *funcs = ctx->functions();
GLint oldFbo;
- glGetIntegerv(GL_FRAMEBUFFER_BINDING, &oldFbo);
+ funcs->glGetIntegerv(GL_FRAMEBUFFER_BINDING, &oldFbo);
int oldWidth = m_textureResource->m_width;
int oldHeight = m_textureResource->m_height;
@@ -205,54 +207,53 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height)
if (ctx->d_func()->workaround_brokenFBOReadBack) {
QImageTextureGlyphCache::resizeTextureData(width, height);
Q_ASSERT(image().depth() == 8);
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, oldHeight, GL_ALPHA, GL_UNSIGNED_BYTE, image().constBits());
- glDeleteTextures(1, &oldTexture);
+ funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, oldHeight, GL_ALPHA, GL_UNSIGNED_BYTE, image().constBits());
+ funcs->glDeleteTextures(1, &oldTexture);
return;
}
// ### the QTextureGlyphCache API needs to be reworked to allow
// ### resizeTextureData to fail
- QOpenGLFunctions funcs(ctx);
-
- funcs.glBindFramebuffer(GL_FRAMEBUFFER, m_textureResource->m_fbo);
+ funcs->glBindFramebuffer(GL_FRAMEBUFFER, m_textureResource->m_fbo);
GLuint tmp_texture;
- glGenTextures(1, &tmp_texture);
- glBindTexture(GL_TEXTURE_2D, tmp_texture);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, oldWidth, oldHeight, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ funcs->glGenTextures(1, &tmp_texture);
+ funcs->glBindTexture(GL_TEXTURE_2D, tmp_texture);
+ funcs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, oldWidth, oldHeight, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
m_filterMode = Nearest;
- glBindTexture(GL_TEXTURE_2D, 0);
- funcs.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
- GL_TEXTURE_2D, tmp_texture, 0);
+ funcs->glBindTexture(GL_TEXTURE_2D, 0);
+ funcs->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ GL_TEXTURE_2D, tmp_texture, 0);
- funcs.glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
- glBindTexture(GL_TEXTURE_2D, oldTexture);
+ funcs->glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT);
+ funcs->glBindTexture(GL_TEXTURE_2D, oldTexture);
if (pex != 0)
pex->transferMode(BrushDrawingMode);
- glDisable(GL_STENCIL_TEST);
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_SCISSOR_TEST);
- glDisable(GL_BLEND);
+ funcs->glDisable(GL_STENCIL_TEST);
+ funcs->glDisable(GL_DEPTH_TEST);
+ funcs->glDisable(GL_SCISSOR_TEST);
+ funcs->glDisable(GL_BLEND);
- glViewport(0, 0, oldWidth, oldHeight);
+ funcs->glViewport(0, 0, oldWidth, oldHeight);
QOpenGLShaderProgram *blitProgram = 0;
if (pex == 0) {
if (m_blitProgram == 0) {
m_blitProgram = new QOpenGLShaderProgram(ctx);
+ const bool isCoreProfile = ctx->format().profile() == QSurfaceFormat::CoreProfile;
{
QString source;
- source.append(QLatin1String(qopenglslMainWithTexCoordsVertexShader));
- source.append(QLatin1String(qopenglslUntransformedPositionVertexShader));
+ source.append(QLatin1String(isCoreProfile ? qopenglslMainWithTexCoordsVertexShader_core : qopenglslMainWithTexCoordsVertexShader));
+ source.append(QLatin1String(isCoreProfile ? qopenglslUntransformedPositionVertexShader_core : qopenglslUntransformedPositionVertexShader));
QOpenGLShader *vertexShader = new QOpenGLShader(QOpenGLShader::Vertex, m_blitProgram);
vertexShader->compileSourceCode(source);
@@ -262,8 +263,8 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height)
{
QString source;
- source.append(QLatin1String(qopenglslMainFragmentShader));
- source.append(QLatin1String(qopenglslImageSrcFragmentShader));
+ source.append(QLatin1String(isCoreProfile ? qopenglslMainFragmentShader_core : qopenglslMainFragmentShader));
+ source.append(QLatin1String(isCoreProfile ? qopenglslImageSrcFragmentShader_core : qopenglslImageSrcFragmentShader));
QOpenGLShader *fragmentShader = new QOpenGLShader(QOpenGLShader::Fragment, m_blitProgram);
fragmentShader->compileSourceCode(source);
@@ -300,21 +301,21 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height)
blitProgram->setUniformValue("imageTexture", QT_IMAGE_TEXTURE_UNIT);
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+ funcs->glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture);
+ funcs->glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture);
- glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, oldWidth, oldHeight);
+ funcs->glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, oldWidth, oldHeight);
- funcs.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
- GL_RENDERBUFFER, 0);
- glDeleteTextures(1, &tmp_texture);
- glDeleteTextures(1, &oldTexture);
+ funcs->glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ GL_RENDERBUFFER, 0);
+ funcs->glDeleteTextures(1, &tmp_texture);
+ funcs->glDeleteTextures(1, &oldTexture);
- funcs.glBindFramebuffer(GL_FRAMEBUFFER, (GLuint)oldFbo);
+ funcs->glBindFramebuffer(GL_FRAMEBUFFER, (GLuint)oldFbo);
if (pex != 0) {
- glViewport(0, 0, pex->width, pex->height);
+ funcs->glViewport(0, 0, pex->width, pex->height);
pex->updateClipScissorTest();
} else {
if (m_vao.isCreated()) {
@@ -334,15 +335,16 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed
return;
}
+ QOpenGLFunctions *funcs = ctx->functions();
if (ctx->d_func()->workaround_brokenFBOReadBack) {
QImageTextureGlyphCache::fillTexture(c, glyph, subPixelPosition);
- glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture);
+ funcs->glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture);
const QImage &texture = image();
const uchar *bits = texture.constBits();
bits += c.y * texture.bytesPerLine() + c.x;
for (int i=0; i<c.h; ++i) {
- glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y + i, c.w, 1, GL_ALPHA, GL_UNSIGNED_BYTE, bits);
+ funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y + i, c.w, 1, GL_ALPHA, GL_UNSIGNED_BYTE, bits);
bits += texture.bytesPerLine();
}
return;
@@ -377,7 +379,7 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed
|| mask.format() == QImage::Format_ARGB32_Premultiplied
#else
|| (mask.format() == QImage::Format_ARGB32_Premultiplied
- && QOpenGLFunctions::isES())
+ && ctx->isES())
#endif
) {
for (int y = 0; y < maskHeight; ++y) {
@@ -395,7 +397,7 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed
src[x] = qRgba(r, g, b, avg);
// swizzle the bits to accommodate for the GL_RGBA upload.
#if Q_BYTE_ORDER != Q_BIG_ENDIAN
- if (QOpenGLFunctions::isES())
+ if (ctx->isES())
#endif
src[x] = ARGB2RGBA(src[x]);
}
@@ -403,18 +405,18 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed
}
}
- glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture);
+ funcs->glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture);
if (mask.depth() == 32) {
#ifdef QT_OPENGL_ES_2
GLenum fmt = GL_RGBA;
#else
- GLenum fmt = QOpenGLFunctions::isES() ? GL_RGBA : GL_BGRA;
+ GLenum fmt = ctx->isES() ? GL_RGBA : GL_BGRA;
#endif // QT_OPENGL_ES_2
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
fmt = GL_RGBA;
#endif
- glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, fmt, GL_UNSIGNED_BYTE, mask.bits());
+ funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, fmt, GL_UNSIGNED_BYTE, mask.bits());
} else {
// glTexSubImage2D() might cause some garbage to appear in the texture if the mask width is
// not a multiple of four bytes. The bug appeared on a computer with 32-bit Windows Vista
@@ -437,7 +439,7 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed
#if 0
if (ctx->d_func()->workaround_brokenAlphaTexSubImage) {
for (int i = 0; i < maskHeight; ++i)
- glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y + i, maskWidth, 1, GL_ALPHA, GL_UNSIGNED_BYTE, mask.scanLine(i));
+ funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y + i, maskWidth, 1, GL_ALPHA, GL_UNSIGNED_BYTE, mask.scanLine(i));
} else {
#endif
@@ -446,7 +448,7 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed
#else
const GLenum format = GL_ALPHA;
#endif
- glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, format, GL_UNSIGNED_BYTE, mask.bits());
+ funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, format, GL_UNSIGNED_BYTE, mask.bits());
#if 0
}
diff --git a/src/gui/opengl/qopengltextureglyphcache_p.h b/src/gui/opengl/qopengltextureglyphcache_p.h
index 1e2c031018..5a4a4e4c92 100644
--- a/src/gui/opengl/qopengltextureglyphcache_p.h
+++ b/src/gui/opengl/qopengltextureglyphcache_p.h
@@ -89,9 +89,9 @@ public:
qDebug("~QOpenGLGlyphTexture() %p for context %p.", this, ctx);
#endif
if (!ctx->d_func()->workaround_brokenFBOReadBack)
- QOpenGLFunctions(ctx).glDeleteFramebuffers(1, &m_fbo);
+ ctx->functions()->glDeleteFramebuffers(1, &m_fbo);
if (m_width || m_height)
- glDeleteTextures(1, &m_texture);
+ ctx->functions()->glDeleteTextures(1, &m_texture);
}
void invalidateResource()
diff --git a/src/gui/opengl/qopengltexturehelper.cpp b/src/gui/opengl/qopengltexturehelper.cpp
index 1f44a81276..1d31fb5605 100644
--- a/src/gui/opengl/qopengltexturehelper.cpp
+++ b/src/gui/opengl/qopengltexturehelper.cpp
@@ -42,14 +42,13 @@
#include "qopengltexturehelper_p.h"
#include <QOpenGLContext>
-#include <QOpenGLFunctions>
QT_BEGIN_NAMESPACE
QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
{
// Resolve EXT_direct_state_access entry points if present
- if (!QOpenGLFunctions::isES()
+ if (!context->isES()
&& context->hasExtension(QByteArrayLiteral("GL_EXT_direct_state_access"))) {
TextureParameteriEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , GLint )>(context->getProcAddress(QByteArrayLiteral("glTextureParameteriEXT")));
TextureParameterivEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , const GLint *)>(context->getProcAddress(QByteArrayLiteral("glTextureParameterivEXT")));
@@ -122,7 +121,7 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
}
// Some DSA functions are part of NV_texture_multisample instead
- if (!QOpenGLFunctions::isES()
+ if (!context->isES()
&& context->hasExtension(QByteArrayLiteral("GL_NV_texture_multisample"))) {
TextureImage3DMultisampleNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLint , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTextureImage3DMultisampleNV")));
TextureImage2DMultisampleNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLint , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTextureImage2DMultisampleNV")));
@@ -138,7 +137,7 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
// Hence, we resolve them "the hard way"
#if defined(Q_OS_WIN) && !defined(QT_OPENGL_ES_2)
- HMODULE handle = static_cast<HMODULE>(QOpenGLFunctions::platformGLHandle());
+ HMODULE handle = static_cast<HMODULE>(QOpenGLContext::openGLModuleHandle());
if (!handle)
handle = GetModuleHandleA("opengl32.dll");
@@ -191,7 +190,7 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
TexSubImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTexSubImage1D")));
#endif
- if (QOpenGLFunctions::isES() && context->hasExtension(QByteArrayLiteral("GL_OES_texture_3D"))) {
+ if (context->isES() && context->hasExtension(QByteArrayLiteral("GL_OES_texture_3D"))) {
TexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*)>(context->getProcAddress(QByteArrayLiteral("glTexImage3DOES")));
TexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*)>(context->getProcAddress(QByteArrayLiteral("glTexSubImage3DOES")));
CompressedTexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*)>(context->getProcAddress(QByteArrayLiteral("glCompressedTexImage3DOES")));
diff --git a/src/gui/opengl/qopengltimerquery.cpp b/src/gui/opengl/qopengltimerquery.cpp
index deb88b7778..908a9cee07 100644
--- a/src/gui/opengl/qopengltimerquery.cpp
+++ b/src/gui/opengl/qopengltimerquery.cpp
@@ -124,11 +124,6 @@ public:
bool QOpenGLTimerQueryPrivate::create()
{
- if (QOpenGLFunctions::isES()) {
- qWarning("QOpenGLTimerQuery: Not supported on dynamic GL ES");
- return false;
- }
-
QOpenGLContext *ctx = QOpenGLContext::currentContext();
if (timer && context == ctx)
@@ -140,6 +135,11 @@ bool QOpenGLTimerQueryPrivate::create()
return false;
}
+ if (context->isES()) {
+ qWarning("QOpenGLTimerQuery: Not supported on OpenGL ES");
+ return false;
+ }
+
// Resolve the functions provided by OpenGL 1.5 and OpenGL 3.3 or ARB_timer_query
core = new QOpenGLQueryHelper(context);
@@ -283,7 +283,7 @@ GLuint64 QOpenGLTimerQueryPrivate::result() const
As this function's name implies, it blocks CPU execution until OpenGL notifies
that the timer query result is available. To avoid blocking, you can check
if the query result is available by calling isResultAvailable(). Note that
- modern GPUs are deeply pipelined and query results may not become availble for
+ modern GPUs are deeply pipelined and query results may not become available for
between 1-5 frames after they were issued.
Note that OpenGL does not permit nesting or interleaving of multiple timer queries
diff --git a/src/gui/opengl/qopenglvertexarrayobject.cpp b/src/gui/opengl/qopenglvertexarrayobject.cpp
index 52fd482b53..b1fd4ffdfe 100644
--- a/src/gui/opengl/qopenglvertexarrayobject.cpp
+++ b/src/gui/opengl/qopenglvertexarrayobject.cpp
@@ -59,7 +59,7 @@ public:
QVertexArrayObjectHelper(QOpenGLContext *context)
{
Q_ASSERT(context);
- if (QOpenGLFunctions::isES()) {
+ if (context->isES()) {
GenVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , GLuint *)>(context->getProcAddress(QByteArrayLiteral("glGenVertexArraysOES")));
DeleteVertexArrays = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , const GLuint *)>(context->getProcAddress(QByteArrayLiteral("glDeleteVertexArraysOES")));
BindVertexArray = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint )>(context->getProcAddress(QByteArrayLiteral("glBindVertexArrayOES")));
@@ -160,7 +160,7 @@ bool QOpenGLVertexArrayObjectPrivate::create()
context = ctx;
QObject::connect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed()));
- if (QOpenGLFunctions::isES()) {
+ if (ctx->isES()) {
if (ctx->hasExtension(QByteArrayLiteral("GL_OES_vertex_array_object"))) {
vaoFuncs.helper = new QVertexArrayObjectHelper(ctx);
vaoFuncsType = OES;
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 66481d4287..3f598cd3a7 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -39,20 +39,6 @@
**
****************************************************************************/
-#if defined(__OPTIMIZE__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) \
- && (__GNUC__ * 100 + __GNUC_MINOR__ * 10 + __GNUC_PATCHLEVEL__ >= 440)
-// GCC 4.4 supports #pragma GCC optimize and #pragma GCC target
-
-# if (__GNUC__ * 100 + __GNUC_MINOR__ * 10 + __GNUC_PATCHLEVEL__ < 473)
-// From GCC 4.7.3 onwards, GCC optimize can result in gcc bailing out with OOM
-# pragma GCC optimize "O3"
-# endif
-
-# if defined(__i386__) && defined(__SSE2__) && !defined(__SSE2_MATH__)
-# pragma GCC target "fpmath=sse"
-# endif
-#endif
-
#include <qglobal.h>
#ifdef Q_OS_IOS
// We don't build the NEON drawhelpers as they are implemented partly
diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp
index 76b6084d0e..e356a3a36a 100644
--- a/src/gui/painting/qpaintengine_blitter.cpp
+++ b/src/gui/painting/qpaintengine_blitter.cpp
@@ -690,7 +690,7 @@ void QBlitterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const Q
}
}
-// Overriden methods to lock the graphics memory
+// Overridden methods to lock the graphics memory
void QBlitterPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
{
Q_D(QBlitterPaintEngine);
diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp
index 15459dd748..4843e93858 100644
--- a/src/gui/painting/qplatformbackingstore.cpp
+++ b/src/gui/painting/qplatformbackingstore.cpp
@@ -204,7 +204,8 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion &regi
Q_UNUSED(offset);
context->makeCurrent(window);
- glViewport(0, 0, window->width(), window->height());
+ QOpenGLFunctions *funcs = context->functions();
+ funcs->glViewport(0, 0, window->width(), window->height());
if (!d_ptr->blitter) {
d_ptr->blitter = new QOpenGLTextureBlitter;
@@ -216,7 +217,7 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion &regi
QRect windowRect(QPoint(), window->size());
for (int i = 0; i < textures->count(); ++i) {
GLuint textureId = textures->textureId(i);
- glBindTexture(GL_TEXTURE_2D, textureId);
+ funcs->glBindTexture(GL_TEXTURE_2D, textureId);
QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(textures->geometry(i), windowRect);
d_ptr->blitter->blit(textureId, target, QOpenGLTextureBlitter::OriginBottomLeft);
@@ -226,15 +227,15 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion &regi
if (!textureId)
return;
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ funcs->glEnable(GL_BLEND);
+ funcs->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(windowRect, windowRect);
d_ptr->blitter->setSwizzleRB(true);
d_ptr->blitter->blit(textureId, target, QOpenGLTextureBlitter::OriginTopLeft);
d_ptr->blitter->setSwizzleRB(false);
- glDisable(GL_BLEND);
+ funcs->glDisable(GL_BLEND);
d_ptr->blitter->release();
context->swapBuffers(window);
}
@@ -280,27 +281,29 @@ GLuint QPlatformBackingStore::toTexture(const QRegion &dirtyRegion) const
if (image.format() != QImage::Format_RGB32 && image.format() != QImage::Format_RGBA8888)
image = image.convertToFormat(QImage::Format_RGBA8888);
+ QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
+
if (resized) {
if (d_ptr->textureId)
- glDeleteTextures(1, &d_ptr->textureId);
- glGenTextures(1, &d_ptr->textureId);
- glBindTexture(GL_TEXTURE_2D, d_ptr->textureId);
+ funcs->glDeleteTextures(1, &d_ptr->textureId);
+ funcs->glGenTextures(1, &d_ptr->textureId);
+ funcs->glBindTexture(GL_TEXTURE_2D, d_ptr->textureId);
#ifndef QT_OPENGL_ES_2
- if (!QOpenGLFunctions::isES()) {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
+ if (!QOpenGLContext::currentContext()->isES()) {
+ funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
+ funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
}
#endif
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+ funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, imageSize.width(), imageSize.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE,
- const_cast<uchar*>(image.constBits()));
+ funcs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, imageSize.width(), imageSize.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE,
+ const_cast<uchar*>(image.constBits()));
d_ptr->textureSize = imageSize;
} else {
- glBindTexture(GL_TEXTURE_2D, d_ptr->textureId);
+ funcs->glBindTexture(GL_TEXTURE_2D, d_ptr->textureId);
QRect imageRect = image.rect();
QRect rect = dirtyRegion.boundingRect() & imageRect;
// if the rect is wide enough it's cheaper to just
@@ -314,11 +317,11 @@ GLuint QPlatformBackingStore::toTexture(const QRegion &dirtyRegion) const
// OpenGL instead of copying, since there's no gap between scanlines
if (rect.width() == imageRect.width()) {
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, rect.y(), rect.width(), rect.height(), GL_RGBA, GL_UNSIGNED_BYTE,
- image.constScanLine(rect.y()));
+ funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, 0, rect.y(), rect.width(), rect.height(), GL_RGBA, GL_UNSIGNED_BYTE,
+ image.constScanLine(rect.y()));
} else {
- glTexSubImage2D(GL_TEXTURE_2D, 0, rect.x(), rect.y(), rect.width(), rect.height(), GL_RGBA, GL_UNSIGNED_BYTE,
- image.copy(rect).constBits());
+ funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, rect.x(), rect.y(), rect.width(), rect.height(), GL_RGBA, GL_UNSIGNED_BYTE,
+ image.copy(rect).constBits());
}
}
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index f58cd1c428..beeac6bd43 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -3528,7 +3528,7 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule)
QPoint *pts; /* output buffer */
EdgeTableEntry *pPrevAET; /* ptr to previous AET */
EdgeTable ET; /* header node for ET */
- EdgeTableEntry AET; /* header node for AET */
+ EdgeTableEntry *AET; /* header node for AET */
EdgeTableEntry *pETEs; /* EdgeTableEntries pool */
ScanLineListBlock SLLBlock; /* header for scanlinelist */
int fixWAET = false;
@@ -3567,8 +3567,9 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule)
region->vectorize();
+ AET = new EdgeTableEntry;
pts = FirstPtBlock.pts;
- CreateETandAET(Count, Pts, &ET, &AET, pETEs, &SLLBlock);
+ CreateETandAET(Count, Pts, &ET, AET, pETEs, &SLLBlock);
pSLL = ET.scanlines.next;
curPtBlock = &FirstPtBlock;
@@ -3579,6 +3580,7 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule)
#ifndef QT_NO_DEBUG
qWarning("QRegion: creating region from big polygon failed...!");
#endif
+ delete AET;
delete region;
return 0;
}
@@ -3596,11 +3598,11 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule)
* get to the next edge.
*/
if (pSLL && y == pSLL->scanline) {
- loadAET(&AET, pSLL->edgelist);
+ loadAET(AET, pSLL->edgelist);
pSLL = pSLL->next;
}
- pPrevAET = &AET;
- pAET = AET.next;
+ pPrevAET = AET;
+ pAET = AET->next;
/*
* for each active edge
@@ -3626,7 +3628,7 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule)
}
EVALUATEEDGEEVENODD(pAET, pPrevAET, y)
}
- InsertionSort(&AET);
+ InsertionSort(AET);
}
} else {
/*
@@ -3638,12 +3640,12 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule)
* get to the next edge.
*/
if (pSLL && y == pSLL->scanline) {
- loadAET(&AET, pSLL->edgelist);
- computeWAET(&AET);
+ loadAET(AET, pSLL->edgelist);
+ computeWAET(AET);
pSLL = pSLL->next;
}
- pPrevAET = &AET;
- pAET = AET.next;
+ pPrevAET = AET;
+ pAET = AET->next;
pWETE = pAET;
/*
@@ -3681,8 +3683,8 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule)
* recompute the winding active edge table if
* we just resorted or have exited an edge.
*/
- if (InsertionSort(&AET) || fixWAET) {
- computeWAET(&AET);
+ if (InsertionSort(AET) || fixWAET) {
+ computeWAET(AET);
fixWAET = false;
}
}
@@ -3706,6 +3708,7 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule)
free(curPtBlock);
curPtBlock = tmpPtBlock;
}
+ delete AET;
free(pETEs);
return region;
}
diff --git a/src/gui/text/qdistancefield.cpp b/src/gui/text/qdistancefield.cpp
index f2b88c4692..17116ee2d0 100644
--- a/src/gui/text/qdistancefield.cpp
+++ b/src/gui/text/qdistancefield.cpp
@@ -739,20 +739,11 @@ bool qt_fontHasNarrowOutlines(QFontEngine *fontEngine)
if (!fe)
return false;
- const QChar uc(QLatin1Char('O'));
+ QImage im;
- glyph_t glyph;
-
- QGlyphLayout glyphs;
- glyphs.numGlyphs = 1;
- glyphs.glyphs = &glyph;
- int numGlyphs = 1;
-
- if (!fe->stringToCMap(&uc, 1, &glyphs, &numGlyphs, QFontEngine::GlyphIndicesOnly))
- Q_UNREACHABLE();
- Q_ASSERT(numGlyphs == 1);
-
- QImage im = fe->alphaMapForGlyph(glyph, QFixed(), QTransform());
+ const glyph_t glyph = fe->glyphIndex('O');
+ if (glyph != 0)
+ im = fe->alphaMapForGlyph(glyph, QFixed(), QTransform());
Q_ASSERT(fe->ref.load() == 0);
delete fe;
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 83f2d7190b..2e21a81187 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -2770,10 +2770,10 @@ void QFontCache::updateHitCountAndTimeStamp(Engine &value)
value.timestamp = ++current_timestamp;
FC_DEBUG("QFontCache: found font engine\n"
- " %p: timestamp %4u hits %3u ref %2d/%2d, type '%s'",
+ " %p: timestamp %4u hits %3u ref %2d/%2d, type %d",
value.data, value.timestamp, value.hits,
value.data->ref.load(), engineCacheCount.value(value.data),
- value.data->name());
+ value.data->type());
}
void QFontCache::insertEngine(const Key &key, QFontEngine *engine, bool insertMulti)
@@ -2969,10 +2969,10 @@ void QFontCache::timerEvent(QTimerEvent *)
it = jt;
if (it != end) {
- FC_DEBUG(" %p: timestamp %4u hits %2u ref %2d/%2d, type '%s'",
+ FC_DEBUG(" %p: timestamp %4u hits %2u ref %2d/%2d, type %d",
it.value().data, it.value().timestamp, it.value().hits,
it.value().data->ref.load(), engineCacheCount.value(it.value().data),
- it.value().data->name());
+ it.value().data->type());
QFontEngine *fontEngine = it.value().data;
// get rid of all occurrences
diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h
index 6165554388..b78d6692b4 100644
--- a/src/gui/text/qfont_p.h
+++ b/src/gui/text/qfont_p.h
@@ -228,22 +228,32 @@ public:
void clear();
struct Key {
- Key() : script(0), screen(0) { }
- Key(const QFontDef &d, int c, int s = 0)
- : def(d), script(c), screen(s) { }
+ Key() : script(0), multi(0), screen(0) { }
+ Key(const QFontDef &d, uchar c, bool m = 0, uchar s = 0)
+ : def(d), script(c), multi(m), screen(s) { }
QFontDef def;
- int script;
- int screen;
+ uchar script;
+ uchar multi: 1;
+ uchar screen: 7;
inline bool operator<(const Key &other) const
{
if (script != other.script) return script < other.script;
if (screen != other.screen) return screen < other.screen;
+ if (multi != other.multi) return multi < other.multi;
+ if (multi && def.fallBackFamilies.size() != other.def.fallBackFamilies.size())
+ return def.fallBackFamilies.size() < other.def.fallBackFamilies.size();
return def < other.def;
}
inline bool operator==(const Key &other) const
- { return def == other.def && script == other.script && screen == other.screen; }
+ {
+ return script == other.script
+ && screen == other.screen
+ && multi == other.multi
+ && (!multi || def.fallBackFamilies.size() == other.def.fallBackFamilies.size())
+ && def == other.def;
+ }
};
// QFontEngineData cache
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 61c93dc2ac..02b9e6d25c 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -55,6 +55,8 @@
#include <qpa/qplatformfontdatabase.h>
#include <qpa/qplatformtheme.h>
+#include <QtCore/qmath.h>
+
#include <stdlib.h>
#include <limits.h>
#include <algorithm>
@@ -418,6 +420,7 @@ void QFontDatabasePrivate::invalidate()
{
QFontCache::instance()->clear();
free();
+ QGuiApplicationPrivate::platformIntegration()->fontDatabase()->invalidate();
emit static_cast<QGuiApplication *>(QCoreApplication::instance())->fontDatabaseChanged();
}
@@ -654,9 +657,201 @@ QMutex *qt_fontdatabase_mutex()
return fontDatabaseMutex();
}
-QT_BEGIN_INCLUDE_NAMESPACE
-# include "qfontdatabase_qpa.cpp"
-QT_END_INCLUDE_NAMESPACE
+
+void qt_registerFont(const QString &familyName, const QString &stylename,
+ const QString &foundryname, int weight,
+ QFont::Style style, int stretch, bool antialiased,
+ bool scalable, int pixelSize, bool fixedPitch,
+ const QSupportedWritingSystems &writingSystems, void *handle)
+{
+ QFontDatabasePrivate *d = privateDb();
+// qDebug() << "Adding font" << familyName << weight << style << pixelSize << antialiased;
+ QtFontStyle::Key styleKey;
+ styleKey.style = style;
+ styleKey.weight = weight;
+ styleKey.stretch = stretch;
+ QtFontFamily *f = d->family(familyName, true);
+ f->fixedPitch = fixedPitch;
+
+ for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) {
+ if (writingSystems.supported(QFontDatabase::WritingSystem(i)))
+ f->writingSystems[i] = QtFontFamily::Supported;
+ }
+
+ QtFontFoundry *foundry = f->foundry(foundryname, true);
+ QtFontStyle *fontStyle = foundry->style(styleKey, stylename, true);
+ fontStyle->smoothScalable = scalable;
+ fontStyle->antialiased = antialiased;
+ QtFontSize *size = fontStyle->pixelSize(pixelSize ? pixelSize : SMOOTH_SCALABLE, true);
+ if (size->handle) {
+ QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration();
+ if (integration)
+ integration->fontDatabase()->releaseHandle(size->handle);
+ }
+ size->handle = handle;
+}
+
+void qt_registerAliasToFontFamily(const QString &familyName, const QString &alias)
+{
+ if (alias.isEmpty())
+ return;
+
+ QFontDatabasePrivate *d = privateDb();
+ QtFontFamily *f = d->family(familyName, false);
+ if (!f)
+ return;
+
+ if (f->aliases.contains(alias, Qt::CaseInsensitive))
+ return;
+
+ f->aliases.push_back(alias);
+}
+
+QString qt_resolveFontFamilyAlias(const QString &alias)
+{
+ if (!alias.isEmpty()) {
+ const QFontDatabasePrivate *d = privateDb();
+ for (int i = 0; i < d->count; ++i)
+ if (d->families[i]->matchesFamilyName(alias))
+ return d->families[i]->name;
+ }
+ return alias;
+}
+
+static QStringList fallbackFamilies(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script)
+{
+ QStringList retList = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,styleHint,script);
+ QFontDatabasePrivate *db = privateDb();
+
+ QStringList::iterator i;
+ for (i = retList.begin(); i != retList.end(); ++i) {
+ bool contains = false;
+ for (int j = 0; j < db->count; j++) {
+ if (db->families[j]->matchesFamilyName(*i)) {
+ contains = true;
+ break;
+ }
+ }
+ if (!contains) {
+ i = retList.erase(i);
+ i--;
+ }
+ }
+ return retList;
+}
+
+static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt);
+
+static void initializeDb()
+{
+ QFontDatabasePrivate *db = privateDb();
+
+ // init by asking for the platformfontdb for the first time or after invalidation
+ if (!db->count)
+ QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFontDatabase();
+
+ if (db->reregisterAppFonts) {
+ for (int i = 0; i < db->applicationFonts.count(); i++) {
+ if (!db->applicationFonts.at(i).families.isEmpty())
+ registerFont(&db->applicationFonts[i]);
+ }
+ db->reregisterAppFonts = false;
+ }
+}
+
+static inline void load(const QString & = QString(), int = -1)
+{
+ // Only initialize the database if it has been cleared or not initialized yet
+ if (!privateDb()->count)
+ initializeDb();
+}
+
+static
+QFontEngine *loadSingleEngine(int script,
+ const QFontDef &request,
+ QtFontFoundry *foundry,
+ QtFontStyle *style, QtFontSize *size)
+{
+ Q_UNUSED(foundry);
+
+ Q_ASSERT(size);
+ QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
+ int pixelSize = size->pixelSize;
+ if (!pixelSize || (style->smoothScalable && pixelSize == SMOOTH_SCALABLE)
+ || pfdb->fontsAlwaysScalable()) {
+ pixelSize = request.pixelSize;
+ }
+
+ QFontDef def = request;
+ def.pixelSize = pixelSize;
+
+ QFontCache::Key key(def,script);
+ QFontEngine *engine = QFontCache::instance()->findEngine(key);
+ if (!engine) {
+ engine = pfdb->fontEngine(def, size->handle);
+ if (engine) {
+ Q_ASSERT(engine->type() != QFontEngine::Multi);
+ // Also check for OpenType tables when using complex scripts
+ if (!engine->supportsScript(QChar::Script(script))) {
+ qWarning(" OpenType support missing for script %d", script);
+ if (engine->ref.load() == 0)
+ delete engine;
+ return 0;
+ }
+
+ QFontCache::instance()->insertEngine(key, engine);
+ }
+ }
+ return engine;
+}
+
+static
+QFontEngine *loadEngine(int script, const QFontDef &request,
+ QtFontFamily *family, QtFontFoundry *foundry,
+ QtFontStyle *style, QtFontSize *size)
+{
+ QFontEngine *engine = loadSingleEngine(script, request, foundry, style, size);
+ Q_ASSERT(!engine || engine->type() != QFontEngine::Multi);
+ if (engine && !(request.styleStrategy & QFont::NoFontMerging) && !engine->symbol) {
+ // make sure that the db has all fallback families
+ if (family && !family->askedForFallback) {
+ QFont::Style fontStyle = QFont::Style(style->key.style);
+ QFont::StyleHint styleHint = QFont::StyleHint(request.styleHint);
+ if (styleHint == QFont::AnyStyle && request.fixedPitch)
+ styleHint = QFont::TypeWriter;
+ family->fallbackFamilies = fallbackFamilies(family->name, fontStyle, styleHint, QChar::Script(script));
+
+ family->askedForFallback = true;
+ }
+
+ QStringList fallbacks = request.fallBackFamilies;
+ if (family && !family->fallbackFamilies.isEmpty())
+ fallbacks += family->fallbackFamilies;
+ else
+ fallbacks += privateDb()->fallbackFamilies;
+
+ QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
+ QFontEngineMulti *pfMultiEngine = pfdb->fontEngineMulti(engine, QChar::Script(script));
+ pfMultiEngine->setFallbackFamiliesList(fallbacks);
+ engine = pfMultiEngine;
+
+ // Cache Multi font engine as well in case we got the single
+ // font engine when we are actually looking for a Multi one
+ QFontCache::Key key(request, script, 1);
+ QFontCache::instance()->insertEngine(key, engine);
+ }
+
+ return engine;
+}
+
+static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt)
+{
+ QFontDatabasePrivate *db = privateDb();
+
+ fnt->families = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->addApplicationFont(fnt->data,fnt->fileName);
+
+ db->reregisterAppFonts = true;
+}
static QtFontStyle *bestStyle(QtFontFoundry *foundry, const QtFontStyle::Key &styleKey,
const QString &styleName = QString())
@@ -1032,6 +1227,9 @@ QString QFontDatabase::styleString(const QFontInfo &fontInfo)
*/
QFontDatabase::QFontDatabase()
{
+ if (!qApp || !QGuiApplicationPrivate::platformIntegration())
+ qFatal("QFontDatabase: Must construct a QGuiApplication before accessing QFontDatabase");
+
QMutexLocker locker(fontDatabaseMutex());
createDatabase();
d = privateDb();
@@ -2146,6 +2344,20 @@ QFont QFontDatabase::systemFont(QFontDatabase::SystemFont type)
\sa removeAllApplicationFonts(), addApplicationFont(),
addApplicationFontFromData()
*/
+bool QFontDatabase::removeApplicationFont(int handle)
+{
+ QMutexLocker locker(fontDatabaseMutex());
+
+ QFontDatabasePrivate *db = privateDb();
+ if (handle < 0 || handle >= db->applicationFonts.count())
+ return false;
+
+ db->applicationFonts[handle] = QFontDatabasePrivate::ApplicationFont();
+
+ db->reregisterAppFonts = true;
+ db->invalidate();
+ return true;
+}
/*!
\fn bool QFontDatabase::removeAllApplicationFonts()
@@ -2159,6 +2371,18 @@ QFont QFontDatabase::systemFont(QFontDatabase::SystemFont type)
\sa removeApplicationFont(), addApplicationFont(), addApplicationFontFromData()
*/
+bool QFontDatabase::removeAllApplicationFonts()
+{
+ QMutexLocker locker(fontDatabaseMutex());
+
+ QFontDatabasePrivate *db = privateDb();
+ if (db->applicationFonts.isEmpty())
+ return false;
+
+ db->applicationFonts.clear();
+ db->invalidate();
+ return true;
+}
/*!
\fn bool QFontDatabase::supportsThreadedFontRendering()
@@ -2174,6 +2398,200 @@ QFont QFontDatabase::systemFont(QFontDatabase::SystemFont type)
\sa {Thread-Support in Qt Modules#Painting In Threads}{Painting In Threads}
*/
+// QT_DEPRECATED_SINCE(5, 2)
+bool QFontDatabase::supportsThreadedFontRendering()
+{
+ return true;
+}
+
+/*!
+ \internal
+*/
+QFontEngine *
+QFontDatabase::findFont(int script, const QFontPrivate *fp,
+ const QFontDef &request, bool multi)
+{
+ QMutexLocker locker(fontDatabaseMutex());
+
+ const int force_encoding_id = -1;
+
+ if (!privateDb()->count)
+ initializeDb();
+
+ QFontEngine *engine;
+ QFontCache::Key key(request, script, multi ? 1 : 0);
+ engine = QFontCache::instance()->findEngine(key);
+ if (engine) {
+ FM_DEBUG("Cache hit level 1");
+ return engine;
+ }
+
+ QString family_name, foundry_name;
+
+ parseFontName(request.family, foundry_name, family_name);
+
+ if (qt_enable_test_font && request.family == QLatin1String("__Qt__Box__Engine__")) {
+ engine =new QTestFontEngine(request.pixelSize);
+ engine->fontDef = request;
+ }
+
+ QtFontDesc desc;
+ QList<int> blackListed;
+ int index = match(script, request, family_name, foundry_name, force_encoding_id, &desc, blackListed);
+ if (index >= 0) {
+ engine = loadEngine(script, request, desc.family, desc.foundry, desc.style, desc.size);
+ if (!engine)
+ blackListed.append(index);
+ } else {
+ FM_DEBUG(" NO MATCH FOUND\n");
+ }
+
+ if (engine && engine->type() != QFontEngine::TestFontEngine) {
+ initFontDef(desc, request, &engine->fontDef, engine->type() == QFontEngine::Multi);
+
+ if (fp) {
+ QFontDef def = request;
+ if (def.family.isEmpty()) {
+ def.family = fp->request.family;
+ def.family = def.family.left(def.family.indexOf(QLatin1Char(',')));
+ }
+ }
+ }
+
+ if (!engine) {
+ if (!request.family.isEmpty()) {
+ QStringList fallbacks = request.fallBackFamilies
+ + fallbackFamilies(request.family,
+ QFont::Style(request.style),
+ QFont::StyleHint(request.styleHint),
+ QChar::Script(script));
+ if (script > QChar::Script_Common)
+ fallbacks += QString(); // Find the first font matching the specified script.
+
+ for (int i = 0; !engine && i < fallbacks.size(); i++) {
+ QFontDef def = request;
+ def.family = fallbacks.at(i);
+ QFontCache::Key key(def, script, multi ? 1 : 0);
+ engine = QFontCache::instance()->findEngine(key);
+ if (!engine) {
+ QtFontDesc desc;
+ do {
+ index = match(script, def, def.family, QLatin1String(""), 0, &desc, blackListed);
+ if (index >= 0) {
+ QFontDef loadDef = def;
+ if (loadDef.family.isEmpty())
+ loadDef.family = desc.family->name;
+ engine = loadEngine(script, loadDef, desc.family, desc.foundry, desc.style, desc.size);
+ if (engine)
+ initFontDef(desc, loadDef, &engine->fontDef, engine->type() == QFontEngine::Multi);
+ else
+ blackListed.append(index);
+ }
+ } while (index >= 0 && !engine);
+ }
+ }
+ }
+
+ if (!engine)
+ engine = new QFontEngineBox(request.pixelSize);
+
+ FM_DEBUG("returning box engine");
+ }
+
+ if (fp && fp->dpi > 0) {
+ engine->fontDef.pointSize = qreal(double((engine->fontDef.pixelSize * 72) / fp->dpi));
+ } else {
+ engine->fontDef.pointSize = request.pointSize;
+ }
+
+ return engine;
+}
+
+void QFontDatabase::load(const QFontPrivate *d, int script)
+{
+ QFontDef req = d->request;
+
+ if (req.pixelSize == -1) {
+ req.pixelSize = floor(((req.pointSize * d->dpi) / 72) * 100 + 0.5) / 100;
+ req.pixelSize = qRound(req.pixelSize);
+ }
+ if (req.pointSize < 0)
+ req.pointSize = req.pixelSize*72.0/d->dpi;
+ if (req.weight == 0)
+ req.weight = QFont::Normal;
+ if (req.stretch == 0)
+ req.stretch = 100;
+
+ // Until we specifically asked not to, try looking for Multi font engine
+ // first, the last '1' indicates that we want Multi font engine instead
+ // of single ones
+ bool multi = !(req.styleStrategy & QFont::NoFontMerging);
+ QFontCache::Key key(req, script, multi ? 1 : 0);
+
+ if (!d->engineData)
+ getEngineData(d, req);
+
+ // the cached engineData could have already loaded the engine we want
+ if (d->engineData->engines[script])
+ return;
+
+ QFontEngine *fe = QFontCache::instance()->findEngine(key);
+
+ // list of families to try
+ QStringList family_list;
+
+ if (!req.family.isEmpty()) {
+ QStringList familiesForRequest = familyList(req);
+
+ // Add primary selection
+ family_list << familiesForRequest.takeFirst();
+
+ // Fallbacks requested in font request
+ req.fallBackFamilies = familiesForRequest;
+
+ // add the default family
+ QString defaultFamily = QGuiApplication::font().family();
+ if (! family_list.contains(defaultFamily))
+ family_list << defaultFamily;
+
+ }
+
+ // null family means find the first font matching the specified script
+ family_list << QString();
+
+ QStringList::ConstIterator it = family_list.constBegin(), end = family_list.constEnd();
+ for (; !fe && it != end; ++it) {
+ req.family = *it;
+
+ fe = QFontDatabase::findFont(script, d, req, multi);
+ if (fe && (fe->type()==QFontEngine::Box) && !req.family.isEmpty()) {
+ if (fe->ref.load() == 0)
+ delete fe;
+
+ fe = 0;
+ }
+
+ // No need to check requested fallback families again
+ req.fallBackFamilies.clear();
+ }
+
+ if (fe->symbol || (d->request.styleStrategy & QFont::NoFontMerging)) {
+ for (int i = 0; i < QChar::ScriptCount; ++i) {
+ if (!d->engineData->engines[i]) {
+ d->engineData->engines[i] = fe;
+ fe->ref.ref();
+ }
+ }
+ } else {
+ d->engineData->engines[script] = fe;
+ fe->ref.ref();
+ }
+}
+
+QString QFontDatabase::resolveFontFamilyAlias(const QString &family)
+{
+ return QGuiApplicationPrivate::platformIntegration()->fontDatabase()->resolveFontFamilyAlias(family);
+}
QT_END_NAMESPACE
diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp
deleted file mode 100644
index 1972f5d58c..0000000000
--- a/src/gui/text/qfontdatabase_qpa.cpp
+++ /dev/null
@@ -1,472 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtGui 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 Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qlibraryinfo.h"
-#include <QtCore/qsettings.h>
-
-#include "qfontengine_qpa_p.h"
-#include "qplatformdefs.h"
-
-#include <QtGui/private/qguiapplication_p.h>
-#include <qpa/qplatformfontdatabase.h>
-
-#include <QtCore/qmath.h>
-
-QT_BEGIN_NAMESPACE
-
-void qt_registerFont(const QString &familyName, const QString &stylename,
- const QString &foundryname, int weight,
- QFont::Style style, int stretch, bool antialiased,
- bool scalable, int pixelSize, bool fixedPitch,
- const QSupportedWritingSystems &writingSystems, void *handle)
-{
- QFontDatabasePrivate *d = privateDb();
-// qDebug() << "Adding font" << familyName << weight << style << pixelSize << antialiased;
- QtFontStyle::Key styleKey;
- styleKey.style = style;
- styleKey.weight = weight;
- styleKey.stretch = stretch;
- QtFontFamily *f = d->family(familyName, true);
- f->fixedPitch = fixedPitch;
-
- for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) {
- if (writingSystems.supported(QFontDatabase::WritingSystem(i)))
- f->writingSystems[i] = QtFontFamily::Supported;
- }
-
- QtFontFoundry *foundry = f->foundry(foundryname, true);
- QtFontStyle *fontStyle = foundry->style(styleKey, stylename, true);
- fontStyle->smoothScalable = scalable;
- fontStyle->antialiased = antialiased;
- QtFontSize *size = fontStyle->pixelSize(pixelSize ? pixelSize : SMOOTH_SCALABLE, true);
- if (size->handle) {
- QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration();
- if (integration)
- integration->fontDatabase()->releaseHandle(size->handle);
- }
- size->handle = handle;
-}
-
-void qt_registerAliasToFontFamily(const QString &familyName, const QString &alias)
-{
- if (alias.isEmpty())
- return;
-
- QFontDatabasePrivate *d = privateDb();
- QtFontFamily *f = d->family(familyName, false);
- if (!f)
- return;
-
- if (f->aliases.contains(alias, Qt::CaseInsensitive))
- return;
-
- f->aliases.push_back(alias);
-}
-
-QString qt_resolveFontFamilyAlias(const QString &alias)
-{
- if (!alias.isEmpty()) {
- const QFontDatabasePrivate *d = privateDb();
- for (int i = 0; i < d->count; ++i)
- if (d->families[i]->matchesFamilyName(alias))
- return d->families[i]->name;
- }
- return alias;
-}
-
-static QStringList fallbackFamilies(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script)
-{
- QStringList retList = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,styleHint,script);
- QFontDatabasePrivate *db = privateDb();
-
- QStringList::iterator i;
- for (i = retList.begin(); i != retList.end(); ++i) {
- bool contains = false;
- for (int j = 0; j < db->count; j++) {
- if (db->families[j]->matchesFamilyName(*i)) {
- contains = true;
- break;
- }
- }
- if (!contains) {
- i = retList.erase(i);
- i--;
- }
- }
- return retList;
-}
-
-static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt);
-
-static void initializeDb()
-{
- QFontDatabasePrivate *db = privateDb();
-
- // init by asking for the platformfontdb for the first time or after invalidation
- if (!db->count)
- QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFontDatabase();
-
- if (db->reregisterAppFonts) {
- for (int i = 0; i < db->applicationFonts.count(); i++) {
- if (!db->applicationFonts.at(i).families.isEmpty())
- registerFont(&db->applicationFonts[i]);
- }
- db->reregisterAppFonts = false;
- }
-}
-
-static inline void load(const QString & = QString(), int = -1)
-{
- // Only initialize the database if it has been cleared or not initialized yet
- if (!privateDb()->count)
- initializeDb();
-}
-
-static
-QFontEngine *loadSingleEngine(int script,
- const QFontDef &request,
- QtFontFoundry *foundry,
- QtFontStyle *style, QtFontSize *size)
-{
- Q_UNUSED(foundry);
-
- Q_ASSERT(size);
- QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
- int pixelSize = size->pixelSize;
- if (!pixelSize || (style->smoothScalable && pixelSize == SMOOTH_SCALABLE)
- || pfdb->fontsAlwaysScalable()) {
- pixelSize = request.pixelSize;
- }
-
- QFontDef def = request;
- def.pixelSize = pixelSize;
-
- QFontCache::Key key(def,script);
- QFontEngine *engine = QFontCache::instance()->findEngine(key);
- if (!engine) {
- engine = pfdb->fontEngine(def, size->handle);
- if (engine) {
- // Also check for OpenType tables when using complex scripts
- if (!engine->supportsScript(QChar::Script(script))) {
- qWarning(" OpenType support missing for script %d", script);
- if (engine->ref.load() == 0)
- delete engine;
- return 0;
- }
-
- QFontCache::instance()->insertEngine(key, engine);
- }
- }
- return engine;
-}
-
-static
-QFontEngine *loadEngine(int script, const QFontDef &request,
- QtFontFamily *family, QtFontFoundry *foundry,
- QtFontStyle *style, QtFontSize *size)
-{
-
- QFontEngine *engine = loadSingleEngine(script, request, foundry, style, size);
- //make sure that the db has all fallback families
- if (engine && engine->type() != QFontEngine::Multi
- && !(request.styleStrategy & QFont::NoFontMerging) && !engine->symbol ) {
-
- if (family && !family->askedForFallback) {
- QFont::Style fontStyle = QFont::Style(style->key.style);
- QFont::StyleHint styleHint = QFont::StyleHint(request.styleHint);
- if (styleHint == QFont::AnyStyle && request.fixedPitch)
- styleHint = QFont::TypeWriter;
- family->fallbackFamilies = fallbackFamilies(family->name, fontStyle, styleHint, QChar::Script(script));
-
- family->askedForFallback = true;
- }
-
- QStringList fallbacks = privateDb()->fallbackFamilies;
- if (family && !family->fallbackFamilies.isEmpty())
- fallbacks = family->fallbackFamilies;
-
- QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
- QFontEngineMulti *pfMultiEngine = pfdb->fontEngineMulti(engine, QChar::Script(script));
- pfMultiEngine->setFallbackFamiliesList(fallbacks);
- engine = pfMultiEngine;
-
- // Cache Multi font engine as well in case we got the single
- // font engine when we are actually looking for a Multi one
- QFontCache::Key key(request, script, 1);
- QFontCache::instance()->insertEngine(key, engine);
- }
-
- return engine;
-}
-
-static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt)
-{
- QFontDatabasePrivate *db = privateDb();
-
- fnt->families = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->addApplicationFont(fnt->data,fnt->fileName);
-
- db->reregisterAppFonts = true;
-}
-
-bool QFontDatabase::removeApplicationFont(int handle)
-{
- QMutexLocker locker(fontDatabaseMutex());
-
- QFontDatabasePrivate *db = privateDb();
- if (handle < 0 || handle >= db->applicationFonts.count())
- return false;
-
- db->applicationFonts[handle] = QFontDatabasePrivate::ApplicationFont();
-
- db->reregisterAppFonts = true;
- db->invalidate();
- return true;
-}
-
-bool QFontDatabase::removeAllApplicationFonts()
-{
- QMutexLocker locker(fontDatabaseMutex());
-
- QFontDatabasePrivate *db = privateDb();
- if (db->applicationFonts.isEmpty())
- return false;
-
- db->applicationFonts.clear();
- db->invalidate();
- return true;
-}
-
-// QT_DEPRECATED_SINCE(5, 2)
-bool QFontDatabase::supportsThreadedFontRendering()
-{
- return true;
-}
-
-/*!
- \internal
-*/
-QFontEngine *
-QFontDatabase::findFont(int script, const QFontPrivate *fp,
- const QFontDef &request, bool multi)
-{
- QMutexLocker locker(fontDatabaseMutex());
-
- const int force_encoding_id = -1;
-
- if (!privateDb()->count)
- initializeDb();
-
- QFontEngine *engine;
- QFontCache::Key key(request, script, multi ? 1 : 0);
- engine = QFontCache::instance()->findEngine(key);
- if (engine) {
- FM_DEBUG("Cache hit level 1");
- return engine;
- }
-
- QString family_name, foundry_name;
-
- parseFontName(request.family, foundry_name, family_name);
-
- if (qt_enable_test_font && request.family == QLatin1String("__Qt__Box__Engine__")) {
- engine =new QTestFontEngine(request.pixelSize);
- engine->fontDef = request;
- }
-
- QtFontDesc desc;
- QList<int> blackListed;
- int index = match(script, request, family_name, foundry_name, force_encoding_id, &desc, blackListed);
- if (index >= 0) {
- engine = loadEngine(script, request, desc.family, desc.foundry, desc.style, desc.size);
- if (!engine)
- blackListed.append(index);
- } else {
- FM_DEBUG(" NO MATCH FOUND\n");
- }
-
- if (engine && engine->type() != QFontEngine::TestFontEngine) {
- initFontDef(desc, request, &engine->fontDef, engine->type() == QFontEngine::Multi);
-
- if (fp) {
- QFontDef def = request;
- if (def.family.isEmpty()) {
- def.family = fp->request.family;
- def.family = def.family.left(def.family.indexOf(QLatin1Char(',')));
- }
- }
- }
-
- if (!engine) {
- if (!request.family.isEmpty()) {
- QStringList fallbacks = request.fallBackFamilies
- + fallbackFamilies(request.family,
- QFont::Style(request.style),
- QFont::StyleHint(request.styleHint),
- QChar::Script(script));
- if (script > QChar::Script_Common)
- fallbacks += QString(); // Find the first font matching the specified script.
-
- for (int i = 0; !engine && i < fallbacks.size(); i++) {
- QFontDef def = request;
- def.family = fallbacks.at(i);
- QFontCache::Key key(def, script, multi ? 1 : 0);
- engine = QFontCache::instance()->findEngine(key);
- if (!engine) {
- QtFontDesc desc;
- do {
- index = match(script, def, def.family, QLatin1String(""), 0, &desc, blackListed);
- if (index >= 0) {
- QFontDef loadDef = def;
- if (loadDef.family.isEmpty())
- loadDef.family = desc.family->name;
- engine = loadEngine(script, loadDef, desc.family, desc.foundry, desc.style, desc.size);
- if (engine)
- initFontDef(desc, loadDef, &engine->fontDef, engine->type() == QFontEngine::Multi);
- else
- blackListed.append(index);
- }
- } while (index >= 0 && !engine);
- }
- }
- }
-
- if (!engine)
- engine = new QFontEngineBox(request.pixelSize);
-
- FM_DEBUG("returning box engine");
- }
-
- if (fp && fp->dpi > 0) {
- engine->fontDef.pointSize = qreal(double((engine->fontDef.pixelSize * 72) / fp->dpi));
- } else {
- engine->fontDef.pointSize = request.pointSize;
- }
-
- return engine;
-}
-
-void QFontDatabase::load(const QFontPrivate *d, int script)
-{
- QFontDef req = d->request;
-
- if (req.pixelSize == -1) {
- req.pixelSize = floor(((req.pointSize * d->dpi) / 72) * 100 + 0.5) / 100;
- req.pixelSize = qRound(req.pixelSize);
- }
- if (req.pointSize < 0)
- req.pointSize = req.pixelSize*72.0/d->dpi;
- if (req.weight == 0)
- req.weight = QFont::Normal;
- if (req.stretch == 0)
- req.stretch = 100;
-
- // Until we specifically asked not to, try looking for Multi font engine
- // first, the last '1' indicates that we want Multi font engine instead
- // of single ones
- bool multi = !(req.styleStrategy & QFont::NoFontMerging);
- QFontCache::Key key(req, script, multi ? 1 : 0);
-
- if (!d->engineData)
- getEngineData(d, req);
-
- // the cached engineData could have already loaded the engine we want
- if (d->engineData->engines[script])
- return;
-
- QFontEngine *fe = QFontCache::instance()->findEngine(key);
-
- // list of families to try
- QStringList family_list;
-
- if (!req.family.isEmpty()) {
- QStringList familiesForRequest = familyList(req);
-
- // Add primary selection
- family_list << familiesForRequest.takeFirst();
-
- // Fallbacks requested in font request
- req.fallBackFamilies = familiesForRequest;
-
- // add the default family
- QString defaultFamily = QGuiApplication::font().family();
- if (! family_list.contains(defaultFamily))
- family_list << defaultFamily;
-
- }
-
- // null family means find the first font matching the specified script
- family_list << QString();
-
- QStringList::ConstIterator it = family_list.constBegin(), end = family_list.constEnd();
- for (; !fe && it != end; ++it) {
- req.family = *it;
-
- fe = QFontDatabase::findFont(script, d, req, multi);
- if (fe && (fe->type()==QFontEngine::Box) && !req.family.isEmpty()) {
- if (fe->ref.load() == 0)
- delete fe;
-
- fe = 0;
- }
-
- // No need to check requested fallback families again
- req.fallBackFamilies.clear();
- }
-
- if (fe->symbol || (d->request.styleStrategy & QFont::NoFontMerging)) {
- for (int i = 0; i < QChar::ScriptCount; ++i) {
- if (!d->engineData->engines[i]) {
- d->engineData->engines[i] = fe;
- fe->ref.ref();
- }
- }
- } else {
- d->engineData->engines[script] = fe;
- fe->ref.ref();
- }
-}
-
-QString QFontDatabase::resolveFontFamilyAlias(const QString &family)
-{
- return QGuiApplicationPrivate::platformIntegration()->fontDatabase()->resolveFontFamilyAlias(family);
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 83e64a51a6..a72ac23418 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -101,35 +101,13 @@ static HB_Bool hb_stringToGlyphs(HB_Font font, const HB_UChar16 *string, hb_uint
*numGlyphs = nGlyphs;
if (rightToLeft && result && !fe->symbol) {
- uint glyph_pos = 0;
- for (uint i = 0; i < length; ++i, ++glyph_pos) {
- uint ucs4 = str[i].unicode();
- if (Q_UNLIKELY(QChar::isHighSurrogate(ucs4) && i + 1 < length)) {
- uint low = str[i + 1].unicode();
- if (Q_LIKELY(QChar::isLowSurrogate(low))) {
- ucs4 = QChar::surrogateToUcs4(ucs4, low);
- ++i;
- }
- }
-
- uint mirrored = QChar::mirroredChar(ucs4);
- if (Q_UNLIKELY(mirrored != ucs4)) {
- QChar chars[2];
- uint numChars = 0;
- if (Q_UNLIKELY(QChar::requiresSurrogates(mirrored))) {
- chars[numChars++] = QChar(QChar::highSurrogate(mirrored));
- chars[numChars++] = QChar(QChar::lowSurrogate(mirrored));
- } else {
- chars[numChars++] = QChar(mirrored);
- }
-
- qglyphs.numGlyphs = numChars;
- qglyphs.glyphs = glyphs + glyph_pos;
- nGlyphs = numChars;
- if (!fe->stringToCMap(chars, numChars, &qglyphs, &nGlyphs, QFontEngine::GlyphIndicesOnly))
- Q_UNREACHABLE();
- Q_ASSERT(nGlyphs == 1);
- }
+ QStringIterator it(str, str + length);
+ while (it.hasNext()) {
+ const uint ucs4 = it.next();
+ const uint mirrored = QChar::mirroredChar(ucs4);
+ if (Q_UNLIKELY(mirrored != ucs4))
+ *glyphs = fe->glyphIndex(mirrored);
+ ++glyphs;
}
}
@@ -242,8 +220,8 @@ Q_AUTOTEST_EXPORT QList<QFontEngine *> QFontEngine_stopCollectingEngines()
// QFontEngine
-QFontEngine::QFontEngine()
- : ref(0),
+QFontEngine::QFontEngine(Type type)
+ : m_type(type), ref(0),
font_(0), font_destroy_func(0),
face_(0), face_destroy_func(0)
{
@@ -359,6 +337,15 @@ bool QFontEngine::supportsScript(QChar::Script script) const
return true;
}
+#ifdef Q_OS_MAC
+ {
+ // in AAT fonts, 'gsub' table is effectively replaced by 'mort'/'morx' table
+ uint len;
+ if (getSfntTableData(MAKE_TAG('m','o','r','t'), 0, &len) || getSfntTableData(MAKE_TAG('m','o','r','x'), 0, &len))
+ return true;
+ }
+#endif
+
#ifdef QT_ENABLE_HARFBUZZ_NG
if (useHarfbuzzNG) {
bool ret = false;
@@ -385,6 +372,17 @@ bool QFontEngine::supportsScript(QChar::Script script) const
return hbFace->supported_scripts[script_to_hbscript(script)];
}
+bool QFontEngine::canRender(const QChar *str, int len) const
+{
+ QStringIterator it(str, str + len);
+ while (it.hasNext()) {
+ if (glyphIndex(it.next()) == 0)
+ return false;
+ }
+
+ return true;
+}
+
glyph_metrics_t QFontEngine::boundingBox(glyph_t glyph, const QTransform &matrix)
{
glyph_metrics_t metrics = boundingBox(glyph);
@@ -397,38 +395,14 @@ glyph_metrics_t QFontEngine::boundingBox(glyph_t glyph, const QTransform &matrix
QFixed QFontEngine::xHeight() const
{
- QChar x((ushort)'x');
-
- glyph_t glyph;
-
- QGlyphLayout glyphs;
- glyphs.numGlyphs = 1;
- glyphs.glyphs = &glyph;
-
- int nglyphs = 1;
- if (!stringToCMap(&x, 1, &glyphs, &nglyphs, GlyphIndicesOnly))
- Q_UNREACHABLE();
- Q_ASSERT(nglyphs == 1);
-
+ const glyph_t glyph = glyphIndex('x');
glyph_metrics_t bb = const_cast<QFontEngine *>(this)->boundingBox(glyph);
return bb.height;
}
QFixed QFontEngine::averageCharWidth() const
{
- QChar x((ushort)'x');
-
- glyph_t glyph;
-
- QGlyphLayout glyphs;
- glyphs.numGlyphs = 1;
- glyphs.glyphs = &glyph;
-
- int nglyphs = 1;
- if (!stringToCMap(&x, 1, &glyphs, &nglyphs, GlyphIndicesOnly))
- Q_UNREACHABLE();
- Q_ASSERT(nglyphs == 1);
-
+ const glyph_t glyph = glyphIndex('x');
glyph_metrics_t bb = const_cast<QFontEngine *>(this)->boundingBox(glyph);
return bb.xoff;
}
@@ -489,18 +463,14 @@ void QFontEngine::getGlyphPositions(const QGlyphLayout &glyphs, const QTransform
if (glyphs.justifications[i].nKashidas) {
QChar ch(0x640); // Kashida character
- glyph_t kashidaGlyph;
+ glyph_t kashidaGlyph = glyphIndex(ch.unicode());
QFixed kashidaWidth;
QGlyphLayout g;
g.numGlyphs = 1;
g.glyphs = &kashidaGlyph;
g.advances = &kashidaWidth;
-
- int nglyphs = 1;
- if (!stringToCMap(&ch, 1, &g, &nglyphs, 0))
- Q_UNREACHABLE();
- Q_ASSERT(nglyphs == 1);
+ recalcAdvances(&g, 0);
for (uint k = 0; k < glyphs.justifications[i].nKashidas; ++k) {
xpos -= kashidaWidth;
@@ -937,14 +907,31 @@ void QFontEngine::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metr
addGlyphsToPath(&glyph, &p, 1, path, QFlag(0));
}
+/*!
+ Returns \c true if the font table idetified by \a tag exists in the font;
+ returns \c false otherwise.
+
+ If \a buffer is NULL, stores the size of the buffer required for the font table data,
+ in bytes, in \a length. If \a buffer is not NULL and the capacity
+ of the buffer, passed in \a length, is sufficient to store the font table data,
+ also copies the font table data to \a buffer.
+
+ Note: returning \c false when the font table exists could lead to an undefined behavior.
+*/
+bool QFontEngine::getSfntTableData(uint tag, uchar *buffer, uint *length) const
+{
+ Q_UNUSED(tag)
+ Q_UNUSED(buffer)
+ Q_UNUSED(length)
+ return false;
+}
+
QByteArray QFontEngine::getSfntTable(uint tag) const
{
QByteArray table;
uint len = 0;
if (!getSfntTableData(tag, 0, &len))
return table;
- if (!len)
- return table;
table.resize(len);
if (!getSfntTableData(tag, reinterpret_cast<uchar *>(table.data()), &len))
return QByteArray();
@@ -1382,7 +1369,15 @@ QFontEngine::GlyphCacheEntry &QFontEngine::GlyphCacheEntry::operator=(const Glyp
// ------------------------------------------------------------------
QFontEngineBox::QFontEngineBox(int size)
- : _size(size)
+ : QFontEngine(Box),
+ _size(size)
+{
+ cache_cost = sizeof(QFontEngineBox);
+}
+
+QFontEngineBox::QFontEngineBox(Type type, int size)
+ : QFontEngine(type),
+ _size(size)
{
cache_cost = sizeof(QFontEngineBox);
}
@@ -1391,8 +1386,15 @@ QFontEngineBox::~QFontEngineBox()
{
}
+glyph_t QFontEngineBox::glyphIndex(uint ucs4) const
+{
+ Q_UNUSED(ucs4)
+ return 0;
+}
+
bool QFontEngineBox::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const
{
+ Q_ASSERT(glyphs->numGlyphs >= *nglyphs);
if (*nglyphs < len) {
*nglyphs = len;
return false;
@@ -1503,22 +1505,11 @@ qreal QFontEngineBox::maxCharWidth() const
return _size;
}
-
-const char *QFontEngineBox::name() const
-{
- return "null";
-}
-
-bool QFontEngineBox::canRender(const QChar *, int)
+bool QFontEngineBox::canRender(const QChar *, int) const
{
return true;
}
-QFontEngine::Type QFontEngineBox::type() const
-{
- return Box;
-}
-
QImage QFontEngineBox::alphaMapForGlyph(glyph_t)
{
QImage image(_size, _size, QImage::Format_Indexed8);
@@ -1550,6 +1541,7 @@ static inline glyph_t stripped(glyph_t glyph)
{ return glyph & 0x00ffffff; }
QFontEngineMulti::QFontEngineMulti(int engineCount)
+ : QFontEngine(Multi)
{
engines.fill(0, engineCount);
cache_cost = 0;
@@ -1564,6 +1556,35 @@ QFontEngineMulti::~QFontEngineMulti()
}
}
+glyph_t QFontEngineMulti::glyphIndex(uint ucs4) const
+{
+ glyph_t glyph = engine(0)->glyphIndex(ucs4);
+ if (glyph == 0 && ucs4 != QChar::LineSeparator) {
+ const_cast<QFontEngineMulti *>(this)->ensureFallbackFamiliesQueried();
+ for (int x = 1, n = qMin(engines.size(), 256); x < n; ++x) {
+ QFontEngine *engine = engines.at(x);
+ if (!engine) {
+ if (!shouldLoadFontEngineForCharacter(x, ucs4))
+ continue;
+ const_cast<QFontEngineMulti *>(this)->loadEngine(x);
+ engine = engines.at(x);
+ }
+ Q_ASSERT(engine != 0);
+ if (engine->type() == Box)
+ continue;
+
+ glyph = engine->glyphIndex(ucs4);
+ if (glyph != 0) {
+ // set the high byte to indicate which engine the glyph came from
+ glyph |= (x << 24);
+ break;
+ }
+ }
+ }
+
+ return glyph;
+}
+
bool QFontEngineMulti::stringToCMap(const QChar *str, int len,
QGlyphLayout *glyphs, int *nglyphs,
QFontEngine::ShaperFlags flags) const
@@ -1573,13 +1594,10 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len,
const_cast<QFontEngineMulti *>(this)->ensureFallbackFamiliesQueried();
int glyph_pos = 0;
- for (int i = 0; i < len; ++i) {
- bool surrogate = (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate());
- uint ucs4 = surrogate ? QChar::surrogateToUcs4(str[i], str[i+1]) : str[i].unicode();
- if (glyphs->glyphs[glyph_pos] == 0 && str[i].category() != QChar::Separator_Line) {
- QFixed tmpAdvance;
- if (!(flags & GlyphIndicesOnly))
- tmpAdvance = glyphs->advances[glyph_pos];
+ QStringIterator it(str, str + len);
+ while (it.hasNext()) {
+ const uint ucs4 = it.peekNext();
+ if (glyphs->glyphs[glyph_pos] == 0 && ucs4 != QChar::LineSeparator) {
for (int x = 1, n = qMin(engines.size(), 256); x < n; ++x) {
if (engines.at(x) == 0 && !shouldLoadFontEngineForCharacter(x, ucs4))
continue;
@@ -1593,27 +1611,21 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len,
if (engine->type() == Box)
continue;
- if (!(flags & GlyphIndicesOnly))
- glyphs->advances[glyph_pos] = QFixed();
- int num = 2;
- QGlyphLayout g = glyphs->mid(glyph_pos, num);
- if (!engine->stringToCMap(str + i, surrogate ? 2 : 1, &g, &num, flags))
- Q_UNREACHABLE();
- Q_ASSERT(num == 1);
- if (glyphs->glyphs[glyph_pos]) {
+ glyph_t glyph = engine->glyphIndex(ucs4);
+ if (glyph != 0) {
+ glyphs->glyphs[glyph_pos] = glyph;
+ if (!(flags & GlyphIndicesOnly)) {
+ QGlyphLayout g = glyphs->mid(glyph_pos, 1);
+ engine->recalcAdvances(&g, flags);
+ }
// set the high byte to indicate which engine the glyph came from
glyphs->glyphs[glyph_pos] |= (x << 24);
break;
}
}
-
- // ensure we use metrics from the 1st font when we use the fallback image.
- if (!(flags & GlyphIndicesOnly) && glyphs->glyphs[glyph_pos] == 0)
- glyphs->advances[glyph_pos] = tmpAdvance;
}
- if (surrogate)
- ++i;
+ it.advance();
++glyph_pos;
}
@@ -1898,7 +1910,7 @@ qreal QFontEngineMulti::minRightBearing() const
return engine(0)->minRightBearing();
}
-bool QFontEngineMulti::canRender(const QChar *string, int len)
+bool QFontEngineMulti::canRender(const QChar *string, int len) const
{
if (engine(0)->canRender(string, len))
return true;
@@ -1959,13 +1971,4 @@ QImage QFontEngineMulti::alphaRGBMapForGlyph(glyph_t glyph, QFixed subPixelPosit
return engine(which)->alphaRGBMapForGlyph(stripped(glyph), subPixelPosition, t);
}
-QTestFontEngine::QTestFontEngine(int size)
- : QFontEngineBox(size)
-{}
-
-QFontEngine::Type QTestFontEngine::type() const
-{
- return TestFontEngine;
-}
-
QT_END_NAMESPACE
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index c13f60ff69..11e9ce6c02 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -45,6 +45,7 @@
#include "qvariant.h"
#include "qfontengine_ft_p.h"
#include "private/qimage_p.h"
+#include <private/qstringiterator_p.h>
#ifndef QT_NO_FREETYPE
@@ -125,6 +126,7 @@ static bool ft_getSfntTable(void *user_data, uint tag, uchar *buffer, uint *leng
FT_ULong len = *length;
result = FT_Load_Sfnt_Table(face, tag, 0, buffer, &len) == FT_Err_Ok;
*length = len;
+ Q_ASSERT(!result || int(*length) > 0);
}
return result;
@@ -634,6 +636,7 @@ static void convoluteBitmap(const uchar *src, uchar *dst, int width, int height,
}
QFontEngineFT::QFontEngineFT(const QFontDef &fd)
+ : QFontEngine(Freetype)
{
fontDef = fd;
matrix.xx = 0x10000;
@@ -1281,22 +1284,10 @@ qreal QFontEngineFT::minRightBearing() const
{
if (rbearing == SHRT_MIN) {
lbearing = rbearing = 0;
-
- const QChar *ch = reinterpret_cast<const QChar *>(char_table);
-
- glyph_t glyphs[char_table_entries];
-
- QGlyphLayout g;
- g.glyphs = glyphs;
- g.numGlyphs = char_table_entries;
- int ng = char_table_entries;
- if (!stringToCMap(ch, char_table_entries, &g, &ng, GlyphIndicesOnly))
- Q_UNREACHABLE();
- Q_ASSERT(ng == char_table_entries);
-
- while (--ng) {
- if (glyphs[ng]) {
- glyph_metrics_t gi = const_cast<QFontEngineFT *>(this)->boundingBox(glyphs[ng]);
+ for (int i = 0; i < char_table_entries; ++i) {
+ const glyph_t glyph = glyphIndex(char_table[i]);
+ if (glyph != 0) {
+ glyph_metrics_t gi = const_cast<QFontEngineFT *>(this)->boundingBox(glyph);
lbearing = qMin(lbearing, gi.x);
rbearing = qMin(rbearing, (gi.xoff - gi.x - gi.width));
}
@@ -1457,29 +1448,6 @@ bool QFontEngineFT::supportsTransformation(const QTransform &transform) const
return transform.type() <= QTransform::TxTranslate;
}
-static inline unsigned int getChar(const QChar *str, int &i, const int len)
-{
- uint ucs4 = str[i].unicode();
- if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) {
- ++i;
- ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode());
- }
- return ucs4;
-}
-
-bool QFontEngineFT::canRender(const QChar *string, int len)
-{
- FT_Face face = freetype->face;
- {
- for ( int i = 0; i < len; i++ ) {
- unsigned int uc = getChar(string, i, len);
- if (!FT_Get_Char_Index(face, uc))
- return false;
- }
- }
- return true;
-}
-
void QFontEngineFT::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags)
{
if (!glyphs.numGlyphs)
@@ -1524,9 +1492,40 @@ void QFontEngineFT::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int
unlockFace();
}
+glyph_t QFontEngineFT::glyphIndex(uint ucs4) const
+{
+ glyph_t glyph = ucs4 < QFreetypeFace::cmapCacheSize ? freetype->cmapCache[ucs4] : 0;
+ if (glyph == 0) {
+ FT_Face face = freetype->face;
+ glyph = FT_Get_Char_Index(face, ucs4);
+ if (glyph == 0) {
+ // Certain fonts don't have no-break space and tab,
+ // while we usually want to render them as space
+ if (ucs4 == QChar::Nbsp || ucs4 == QChar::Tabulation) {
+ glyph = FT_Get_Char_Index(face, QChar::Space);
+ } else if (freetype->symbol_map) {
+ // Symbol fonts can have more than one CMAPs, FreeType should take the
+ // correct one for us by default, so we always try FT_Get_Char_Index
+ // first. If it didn't work (returns 0), we will explicitly set the
+ // CMAP to symbol font one and try again. symbol_map is not always the
+ // correct one because in certain fonts like Wingdings symbol_map only
+ // contains PUA codepoints instead of the common ones.
+ FT_Set_Charmap(face, freetype->symbol_map);
+ glyph = FT_Get_Char_Index(face, ucs4);
+ FT_Set_Charmap(face, freetype->unicode_map);
+ }
+ }
+ if (ucs4 < QFreetypeFace::cmapCacheSize)
+ freetype->cmapCache[ucs4] = glyph;
+ }
+
+ return glyph;
+}
+
bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs,
QFontEngine::ShaperFlags flags) const
{
+ Q_ASSERT(glyphs->numGlyphs >= *nglyphs);
if (*nglyphs < len) {
*nglyphs = len;
return false;
@@ -1535,8 +1534,9 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs
int glyph_pos = 0;
if (freetype->symbol_map) {
FT_Face face = freetype->face;
- for ( int i = 0; i < len; ++i ) {
- unsigned int uc = getChar(str, i, len);
+ QStringIterator it(str, str + len);
+ while (it.hasNext()) {
+ uint uc = it.next();
glyphs->glyphs[glyph_pos] = uc < QFreetypeFace::cmapCacheSize ? freetype->cmapCache[uc] : 0;
if ( !glyphs->glyphs[glyph_pos] ) {
// Symbol fonts can have more than one CMAPs, FreeType should take the
@@ -1565,8 +1565,9 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs
}
} else {
FT_Face face = freetype->face;
- for (int i = 0; i < len; ++i) {
- unsigned int uc = getChar(str, i, len);
+ QStringIterator it(str, str + len);
+ while (it.hasNext()) {
+ uint uc = it.next();
glyphs->glyphs[glyph_pos] = uc < QFreetypeFace::cmapCacheSize ? freetype->cmapCache[uc] : 0;
if (!glyphs->glyphs[glyph_pos]) {
{
diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h
index ad1598ba6d..8bdf991174 100644
--- a/src/gui/text/qfontengine_ft_p.h
+++ b/src/gui/text/qfontengine_ft_p.h
@@ -225,19 +225,13 @@ private:
virtual QFixed lineThickness() const;
virtual QFixed underlinePosition() const;
+ virtual glyph_t glyphIndex(uint ucs4) const;
void doKerning(QGlyphLayout *, ShaperFlags) const;
- inline virtual Type type() const
- { return QFontEngine::Freetype; }
- inline virtual const char *name() const
- { return "freetype"; }
-
virtual void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics);
virtual bool supportsTransformation(const QTransform &transform) const;
- virtual bool canRender(const QChar *string, int len);
-
virtual void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs,
QPainterPath *path, QTextItem::RenderFlags flags);
virtual void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs,
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index 0bfb9e70e2..5e40abbda6 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -125,9 +125,10 @@ public:
};
Q_DECLARE_FLAGS(ShaperFlags, ShaperFlag)
- QFontEngine();
virtual ~QFontEngine();
+ inline Type type() const { return m_type; }
+
// all of these are in unscaled metrics if the engine supports uncsaled metrics,
// otherwise in design metrics
struct Properties {
@@ -144,8 +145,8 @@ public:
};
virtual Properties properties() const;
virtual void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics);
- QByteArray getSfntTable(uint /*tag*/) const;
- virtual bool getSfntTableData(uint /*tag*/, uchar * /*buffer*/, uint * /*length*/) const { return false; }
+ QByteArray getSfntTable(uint tag) const;
+ virtual bool getSfntTableData(uint tag, uchar *buffer, uint *length) const;
struct FaceId {
FaceId() : index(0), encoding(0) {}
@@ -167,6 +168,7 @@ public:
virtual QFixed emSquareSize() const { return ascent(); }
/* returns 0 as glyph index for non existent glyphs */
+ virtual glyph_t glyphIndex(uint ucs4) const = 0;
virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const = 0;
virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const {}
virtual void doKerning(QGlyphLayout *, ShaperFlags) const;
@@ -224,26 +226,11 @@ public:
virtual void getGlyphBearings(glyph_t glyph, qreal *leftBearing = 0, qreal *rightBearing = 0);
- virtual const char *name() const = 0;
-
- virtual bool canRender(const QChar *string, int len) = 0;
- inline bool canRender(uint ucs4) {
- QChar utf16[2];
- int utf16len = 1;
- if (QChar::requiresSurrogates(ucs4)) {
- utf16[0] = QChar::highSurrogate(ucs4);
- utf16[1] = QChar::lowSurrogate(ucs4);
- ++utf16len;
- } else {
- utf16[0] = QChar(ucs4);
- }
- return canRender(utf16, utf16len);
- }
+ inline bool canRender(uint ucs4) const { return glyphIndex(ucs4) != 0; }
+ virtual bool canRender(const QChar *str, int len) const;
virtual bool supportsTransformation(const QTransform &transform) const;
- virtual Type type() const = 0;
-
virtual int glyphCount() const;
virtual int glyphMargin(GlyphFormat format) { return format == Format_A32 ? 2 : 0; }
@@ -272,6 +259,10 @@ public:
};
virtual void setDefaultHintStyle(HintStyle) { }
+private:
+ const Type m_type;
+
+public:
QAtomicInt ref;
QFontDef fontDef;
@@ -306,6 +297,8 @@ public:
inline QVariant userData() const { return m_userData; }
protected:
+ explicit QFontEngine(Type type);
+
QFixed lastRightBearing(const QGlyphLayout &glyphs, bool round = false);
inline void setUserData(const QVariant &userData) { m_userData = userData; }
@@ -352,6 +345,7 @@ public:
QFontEngineBox(int size);
~QFontEngineBox();
+ virtual glyph_t glyphIndex(uint ucs4) const;
virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const;
virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const;
@@ -370,13 +364,13 @@ public:
virtual qreal minRightBearing() const { return 0; }
virtual QImage alphaMapForGlyph(glyph_t);
- virtual const char *name() const;
-
- virtual bool canRender(const QChar *string, int len);
+ virtual bool canRender(const QChar *string, int len) const;
- virtual Type type() const;
inline int size() const { return _size; }
+protected:
+ explicit QFontEngineBox(Type type, int size);
+
private:
friend class QFontPrivate;
int _size;
@@ -388,6 +382,7 @@ public:
explicit QFontEngineMulti(int engineCount);
~QFontEngineMulti();
+ virtual glyph_t glyphIndex(uint ucs4) const;
virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const;
virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs);
@@ -415,12 +410,7 @@ public:
virtual qreal minLeftBearing() const;
virtual qreal minRightBearing() const;
- virtual inline Type type() const
- { return QFontEngine::Multi; }
-
- virtual bool canRender(const QChar *string, int len);
- inline virtual const char *name() const
- { return "Multi"; }
+ virtual bool canRender(const QChar *string, int len) const;
QFontEngine *engine(int at) const
{Q_ASSERT(at < engines.size()); return engines.at(at); }
@@ -444,8 +434,7 @@ protected:
class QTestFontEngine : public QFontEngineBox
{
public:
- QTestFontEngine(int size);
- virtual Type type() const;
+ inline QTestFontEngine(int size) : QFontEngineBox(TestFontEngine, size) {}
};
QT_END_NAMESPACE
diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp
index cb40a5388a..f9ed3c38c1 100644
--- a/src/gui/text/qfontengine_qpa.cpp
+++ b/src/gui/text/qfontengine_qpa.cpp
@@ -45,6 +45,7 @@
#include <QtCore/QFileInfo>
#include <QtCore/QDir>
#include <QtCore/QBuffer>
+#include <QtCore/private/qstringiterator_p.h>
#include <QtGui/private/qpaintengine_raster_p.h>
#include <QtGui/private/qguiapplication_p.h>
@@ -225,23 +226,13 @@ QVariant QFontEngineQPA::extractHeaderField(const uchar *data, HeaderTag request
}
-
-static inline unsigned int getChar(const QChar *str, int &i, const int len)
-{
- uint ucs4 = str[i].unicode();
- if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) {
- ++i;
- ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode());
- }
- return ucs4;
-}
-
QFontEngineQPA::QFontEngineQPA(const QFontDef &def, const QByteArray &data)
- : fontData(reinterpret_cast<const uchar *>(data.constData())), dataSize(data.size())
+ : QFontEngine(QPF2),
+ fontData(reinterpret_cast<const uchar *>(data.constData())), dataSize(data.size())
{
fontDef = def;
cache_cost = 100;
- externalCMap = 0;
+ cmap = 0;
cmapOffset = 0;
cmapSize = 0;
glyphMapOffset = 0;
@@ -292,15 +283,8 @@ QFontEngineQPA::QFontEngineQPA(const QFontDef &def, const QByteArray &data)
// get the real cmap
if (cmapOffset) {
- int tableSize = cmapSize;
- const uchar *cmapPtr = getCMap(fontData + cmapOffset, tableSize, &symbol, &cmapSize);
- if (cmapPtr)
- cmapOffset = cmapPtr - fontData;
- else
- cmapOffset = 0;
- } else if (externalCMap) {
- int tableSize = cmapSize;
- externalCMap = getCMap(externalCMap, tableSize, &symbol, &cmapSize);
+ cmap = QFontEngine::getCMap(fontData + cmapOffset, cmapSize, &symbol, &cmapSize);
+ cmapOffset = cmap ? cmap - fontData : 0;
}
// verify all the positions in the glyphMap
@@ -322,7 +306,7 @@ QFontEngineQPA::QFontEngineQPA(const QFontDef &def, const QByteArray &data)
#if defined(DEBUG_FONTENGINE)
if (!isValid())
qDebug() << "fontData" << fontData << "dataSize" << dataSize
- << "externalCMap" << externalCMap << "cmapOffset" << cmapOffset
+ << "cmap" << cmap << "cmapOffset" << cmapOffset
<< "glyphMapOffset" << glyphMapOffset << "glyphDataOffset" << glyphDataOffset
<< "fd" << fd << "glyphDataSize" << glyphDataSize;
#endif
@@ -334,14 +318,30 @@ QFontEngineQPA::~QFontEngineQPA()
bool QFontEngineQPA::getSfntTableData(uint tag, uchar *buffer, uint *length) const
{
- Q_UNUSED(tag);
- Q_UNUSED(buffer);
- *length = 0;
- return false;
+ if (tag != MAKE_TAG('c', 'm', 'a', 'p') || !cmap)
+ return false;
+
+ if (buffer && int(*length) >= cmapSize)
+ memcpy(buffer, cmap, cmapSize);
+ *length = cmapSize;
+ Q_ASSERT(int(*length) > 0);
+ return true;
+}
+
+glyph_t QFontEngineQPA::glyphIndex(uint ucs4) const
+{
+ glyph_t glyph = getTrueTypeGlyphIndex(cmap, ucs4);
+ if (glyph == 0 && symbol && ucs4 < 0x100)
+ glyph = getTrueTypeGlyphIndex(cmap, ucs4 + 0xf000);
+ if (!findGlyph(glyph))
+ glyph = 0;
+
+ return glyph;
}
bool QFontEngineQPA::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const
{
+ Q_ASSERT(glyphs->numGlyphs >= *nglyphs);
if (*nglyphs < len) {
*nglyphs = len;
return false;
@@ -351,20 +351,20 @@ bool QFontEngineQPA::stringToCMap(const QChar *str, int len, QGlyphLayout *glyph
QSet<QChar> seenGlyphs;
#endif
- const uchar *cmap = externalCMap ? externalCMap : (fontData + cmapOffset);
-
int glyph_pos = 0;
if (symbol) {
- for (int i = 0; i < len; ++i) {
- unsigned int uc = getChar(str, i, len);
+ QStringIterator it(str, str + len);
+ while (it.hasNext()) {
+ const uint uc = it.next();
glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc);
if(!glyphs->glyphs[glyph_pos] && uc < 0x100)
glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc + 0xf000);
++glyph_pos;
}
} else {
- for (int i = 0; i < len; ++i) {
- unsigned int uc = getChar(str, i, len);
+ QStringIterator it(str, str + len);
+ while (it.hasNext()) {
+ const uint uc = it.next();
glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc);
#if 0 && defined(DEBUG_FONTENGINE)
QChar c(uc);
@@ -390,10 +390,8 @@ void QFontEngineQPA::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFla
{
for (int i = 0; i < glyphs->numGlyphs; ++i) {
const Glyph *g = findGlyph(glyphs->glyphs[i]);
- if (!g) {
- glyphs->glyphs[i] = 0;
+ if (!g)
continue;
- }
glyphs->advances[i] = g->advance;
}
}
@@ -498,37 +496,9 @@ QFixed QFontEngineQPA::lineThickness() const
return QFixed::fromReal(extractHeaderField(fontData, Tag_LineThickness).value<qreal>());
}
-QFontEngine::Type QFontEngineQPA::type() const
-{
- return QFontEngine::QPF2;
-}
-
-bool QFontEngineQPA::canRender(const QChar *string, int len)
-{
- const uchar *cmap = externalCMap ? externalCMap : (fontData + cmapOffset);
-
- if (symbol) {
- for (int i = 0; i < len; ++i) {
- unsigned int uc = getChar(string, i, len);
- glyph_t g = getTrueTypeGlyphIndex(cmap, uc);
- if(!g && uc < 0x100)
- g = getTrueTypeGlyphIndex(cmap, uc + 0xf000);
- if (!g)
- return false;
- }
- } else {
- for (int i = 0; i < len; ++i) {
- unsigned int uc = getChar(string, i, len);
- if (!getTrueTypeGlyphIndex(cmap, uc))
- return false;
- }
- }
- return true;
-}
-
bool QFontEngineQPA::isValid() const
{
- return fontData && dataSize && (cmapOffset || externalCMap)
+ return fontData && dataSize && cmapOffset
&& glyphMapOffset && glyphDataOffset && glyphDataSize > 0;
}
@@ -563,11 +533,9 @@ void QPAGenerator::writeHeader()
writeTaggedUInt32(QFontEngineQPA::Tag_FileIndex, face.index);
{
- uchar data[4];
- uint len = 4;
- bool ok = fe->getSfntTableData(MAKE_TAG('h', 'e', 'a', 'd'), data, &len);
- if (ok) {
- const quint32 revision = qFromBigEndian<quint32>(data);
+ const QByteArray head = fe->getSfntTable(MAKE_TAG('h', 'e', 'a', 'd'));
+ if (head.size() >= 4) {
+ const quint32 revision = qFromBigEndian<quint32>(reinterpret_cast<const uchar *>(head.constData()));
writeTaggedUInt32(QFontEngineQPA::Tag_FontRevision, revision);
}
}
@@ -748,10 +716,9 @@ QFontEngine* QFontEngineMultiQPA::createMultiFontEngine(QFontEngine *fe, int scr
QFontCache::EngineCache::Iterator it = fc->engineCache.find(key),
end = fc->engineCache.end();
while (it != end && it.key() == key) {
- QFontEngineMulti *cachedEngine = 0;
- if (it.value().data->type() == QFontEngine::Multi)
- cachedEngine = static_cast<QFontEngineMulti *>(it.value().data);
- if (faceIsLocal || (cachedEngine && fe == cachedEngine->engine(0))) {
+ Q_ASSERT(it.value().data->type() == QFontEngine::Multi);
+ QFontEngineMulti *cachedEngine = static_cast<QFontEngineMulti *>(it.value().data);
+ if (faceIsLocal || fe == cachedEngine->engine(0)) {
engine = cachedEngine;
fc->updateHitCountAndTimeStamp(it.value());
break;
diff --git a/src/gui/text/qfontengine_qpa_p.h b/src/gui/text/qfontengine_qpa_p.h
index c8b40abd7f..e84b067c68 100644
--- a/src/gui/text/qfontengine_qpa_p.h
+++ b/src/gui/text/qfontengine_qpa_p.h
@@ -163,6 +163,7 @@ public:
FaceId faceId() const { return face_id; }
bool getSfntTableData(uint tag, uchar *buffer, uint *length) const;
+ virtual glyph_t glyphIndex(uint ucs4) const;
bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const;
void recalcAdvances(QGlyphLayout *, ShaperFlags) const;
@@ -181,11 +182,6 @@ public:
QFixed underlinePosition() const;
QFixed lineThickness() const;
- Type type() const;
-
- bool canRender(const QChar *string, int len);
- inline const char *name() const { return "QPF2"; }
-
virtual int glyphCount() const { return glyphMapEntries; }
bool isValid() const;
@@ -199,7 +195,7 @@ private:
const uchar *fontData;
int dataSize;
- const uchar *externalCMap;
+ const uchar *cmap;
quint32 cmapOffset;
int cmapSize;
quint32 glyphMapOffset;
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index 2f4709afe4..7868fd23d1 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -410,12 +410,7 @@ int QFontMetrics::averageCharWidth() const
*/
bool QFontMetrics::inFont(QChar ch) const
{
- const int script = ch.script();
- QFontEngine *engine = d->engineForScript(script);
- Q_ASSERT(engine != 0);
- if (engine->type() == QFontEngine::Box)
- return false;
- return engine->canRender(&ch, 1);
+ return inFontUcs4(ch.unicode());
}
/*!
@@ -458,16 +453,7 @@ int QFontMetrics::leftBearing(QChar ch) const
d->alterCharForCapitalization(ch);
- glyph_t glyph;
-
- QGlyphLayout glyphs;
- glyphs.numGlyphs = 1;
- glyphs.glyphs = &glyph;
-
- int nglyphs = 1;
- if (!engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, QFontEngine::GlyphIndicesOnly))
- Q_UNREACHABLE();
- Q_ASSERT(nglyphs == 1);
+ glyph_t glyph = engine->glyphIndex(ch.unicode());
qreal lb;
engine->getGlyphBearings(glyph, &lb);
@@ -500,16 +486,7 @@ int QFontMetrics::rightBearing(QChar ch) const
d->alterCharForCapitalization(ch);
- glyph_t glyph;
-
- QGlyphLayout glyphs;
- glyphs.numGlyphs = 1;
- glyphs.glyphs = &glyph;
-
- int nglyphs = 1;
- if (!engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, QFontEngine::GlyphIndicesOnly))
- Q_UNREACHABLE();
- Q_ASSERT(nglyphs == 1);
+ glyph_t glyph = engine->glyphIndex(ch.unicode());
qreal rb;
engine->getGlyphBearings(glyph, 0, &rb);
@@ -605,18 +582,14 @@ int QFontMetrics::width(QChar ch) const
d->alterCharForCapitalization(ch);
+ glyph_t glyph = engine->glyphIndex(ch.unicode());
QFixed advance;
QGlyphLayout glyphs;
glyphs.numGlyphs = 1;
- glyph_t glyph;
glyphs.glyphs = &glyph;
glyphs.advances = &advance;
-
- int nglyphs = 1;
- if (!engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, 0))
- Q_UNREACHABLE();
- Q_ASSERT(nglyphs == 1);
+ engine->recalcAdvances(&glyphs, 0);
return qRound(advance);
}
@@ -660,18 +633,14 @@ int QFontMetrics::charWidth(const QString &text, int pos) const
d->alterCharForCapitalization(ch);
+ glyph_t glyph = engine->glyphIndex(ch.unicode());
QFixed advance;
QGlyphLayout glyphs;
glyphs.numGlyphs = 1;
- glyph_t glyph;
glyphs.glyphs = &glyph;
glyphs.advances = &advance;
-
- int nglyphs = 1;
- if (!engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, 0))
- Q_UNREACHABLE();
- Q_ASSERT(nglyphs == 1);
+ engine->recalcAdvances(&glyphs, 0);
width = qRound(advance);
}
@@ -739,16 +708,7 @@ QRect QFontMetrics::boundingRect(QChar ch) const
d->alterCharForCapitalization(ch);
- glyph_t glyph;
-
- QGlyphLayout glyphs;
- glyphs.numGlyphs = 1;
- glyphs.glyphs = &glyph;
-
- int nglyphs = 1;
- if (!engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, QFontEngine::GlyphIndicesOnly))
- Q_UNREACHABLE();
- Q_ASSERT(nglyphs == 1);
+ glyph_t glyph = engine->glyphIndex(ch.unicode());
glyph_metrics_t gm = engine->boundingBox(glyph);
return QRect(qRound(gm.x), qRound(gm.y), qRound(gm.width), qRound(gm.height));
@@ -1315,12 +1275,7 @@ qreal QFontMetricsF::averageCharWidth() const
*/
bool QFontMetricsF::inFont(QChar ch) const
{
- const int script = ch.script();
- QFontEngine *engine = d->engineForScript(script);
- Q_ASSERT(engine != 0);
- if (engine->type() == QFontEngine::Box)
- return false;
- return engine->canRender(&ch, 1);
+ return inFontUcs4(ch.unicode());
}
/*!
@@ -1365,16 +1320,7 @@ qreal QFontMetricsF::leftBearing(QChar ch) const
d->alterCharForCapitalization(ch);
- glyph_t glyph;
-
- QGlyphLayout glyphs;
- glyphs.numGlyphs = 1;
- glyphs.glyphs = &glyph;
-
- int nglyphs = 1;
- if (!engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, QFontEngine::GlyphIndicesOnly))
- Q_UNREACHABLE();
- Q_ASSERT(nglyphs == 1);
+ glyph_t glyph = engine->glyphIndex(ch.unicode());
qreal lb;
engine->getGlyphBearings(glyph, &lb);
@@ -1407,16 +1353,7 @@ qreal QFontMetricsF::rightBearing(QChar ch) const
d->alterCharForCapitalization(ch);
- glyph_t glyph;
-
- QGlyphLayout glyphs;
- glyphs.numGlyphs = 1;
- glyphs.glyphs = &glyph;
-
- int nglyphs = 1;
- if (!engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, QFontEngine::GlyphIndicesOnly))
- Q_UNREACHABLE();
- Q_ASSERT(nglyphs == 1);
+ glyph_t glyph = engine->glyphIndex(ch.unicode());
qreal rb;
engine->getGlyphBearings(glyph, 0, &rb);
@@ -1484,18 +1421,14 @@ qreal QFontMetricsF::width(QChar ch) const
d->alterCharForCapitalization(ch);
+ glyph_t glyph = engine->glyphIndex(ch.unicode());
QFixed advance;
QGlyphLayout glyphs;
glyphs.numGlyphs = 1;
- glyph_t glyph;
glyphs.glyphs = &glyph;
glyphs.advances = &advance;
-
- int nglyphs = 1;
- if (!engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, 0))
- Q_UNREACHABLE();
- Q_ASSERT(nglyphs == 1);
+ engine->recalcAdvances(&glyphs, 0);
return advance.toReal();
}
@@ -1559,16 +1492,7 @@ QRectF QFontMetricsF::boundingRect(QChar ch) const
d->alterCharForCapitalization(ch);
- glyph_t glyph;
-
- QGlyphLayout glyphs;
- glyphs.numGlyphs = 1;
- glyphs.glyphs = &glyph;
-
- int nglyphs = 1;
- if (!engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, QFontEngine::GlyphIndicesOnly))
- Q_UNREACHABLE();
- Q_ASSERT(nglyphs == 1);
+ glyph_t glyph = engine->glyphIndex(ch.unicode());
glyph_metrics_t gm = engine->boundingBox(glyph);
return QRectF(gm.x.toReal(), gm.y.toReal(), gm.width.toReal(), gm.height.toReal());
diff --git a/src/gui/text/qfontsubset.cpp b/src/gui/text/qfontsubset.cpp
index 2109b16bb5..4bb29da2af 100644
--- a/src/gui/text/qfontsubset.cpp
+++ b/src/gui/text/qfontsubset.cpp
@@ -201,22 +201,8 @@ static void checkRanges(QPdf::ByteStream &ts, QByteArray &ranges, int &nranges)
QVector<int> QFontSubset::getReverseMap() const
{
QVector<int> reverseMap(0x10000, 0);
-
- glyph_t glyph;
-
- QGlyphLayout glyphs;
- glyphs.glyphs = &glyph;
- glyphs.numGlyphs = 1;
-
for (uint uc = 0; uc < 0x10000; ++uc) {
- QChar ch(uc);
-
- int nglyphs = 1;
- if (!fontEngine->stringToCMap(&ch, 1, &glyphs, &nglyphs, QFontEngine::GlyphIndicesOnly))
- Q_UNREACHABLE();
- Q_ASSERT(nglyphs == 1);
-
- int idx = glyph_indices.indexOf(glyph);
+ int idx = glyph_indices.indexOf(fontEngine->glyphIndex(uc));
if (idx >= 0 && !reverseMap.at(idx))
reverseMap[idx] = uc;
}
diff --git a/src/gui/text/qharfbuzzng.cpp b/src/gui/text/qharfbuzzng.cpp
index c09f27b665..1258ea9a78 100644
--- a/src/gui/text/qharfbuzzng.cpp
+++ b/src/gui/text/qharfbuzzng.cpp
@@ -45,6 +45,8 @@
#include <qstring.h>
#include <qvector.h>
+#include <private/qstringiterator_p.h>
+
#include "qfontengine_p.h"
QT_BEGIN_NAMESPACE
@@ -341,16 +343,10 @@ _hb_qt_unicode_decompose_compatibility(hb_unicode_funcs_t * /*ufuncs*/,
const QString normalized = QChar::decomposition(u);
uint outlen = 0;
-
- // ### replace with QCharIterator
- const ushort *p = reinterpret_cast<const ushort *>(normalized.unicode());
- const ushort *const e = p + normalized.size();
- for ( ; p != e; ++p) {
- uint ucs4 = *p;
- if (QChar::isHighSurrogate(ucs4) && p + 1 != e && QChar::isLowSurrogate(p[1]))
- ucs4 = QChar::surrogateToUcs4(ucs4, *++p);
+ QStringIterator it(normalized);
+ while (it.hasNext()) {
Q_ASSERT(outlen < HB_UNICODE_MAX_DECOMPOSITION_LEN);
- decomposed[outlen++] = ucs4;
+ decomposed[outlen++] = it.next();
}
return outlen;
@@ -397,33 +393,7 @@ _hb_qt_font_get_glyph(hb_font_t * /*font*/, void *font_data,
QFontEngine *fe = (QFontEngine *)font_data;
Q_ASSERT(fe);
- QChar chars[2];
- int numChars = 0;
- if (Q_UNLIKELY(QChar::requiresSurrogates(unicode))) {
- chars[numChars++] = QChar(QChar::highSurrogate(unicode));
- chars[numChars++] = QChar(QChar::lowSurrogate(unicode));
- } else {
- chars[numChars++] = QChar(unicode);
- }
-#if 0
- if (Q_UNLIKELY(variation_selector != 0)) {
- if (Q_UNLIKELY(QChar::requiresSurrogates(variation_selector))) {
- chars[numChars++] = QChar(QChar::highSurrogate(variation_selector));
- chars[numChars++] = QChar(QChar::lowSurrogate(variation_selector));
- } else {
- chars[numChars++] = QChar(variation_selector);
- }
- }
-#endif
-
- QGlyphLayout g;
- g.numGlyphs = numChars;
- g.glyphs = glyph;
-
- int numGlyphs = numChars;
- if (!fe->stringToCMap(chars, numChars, &g, &numGlyphs, QFontEngine::GlyphIndicesOnly))
- Q_UNREACHABLE();
- Q_ASSERT(numGlyphs == 1);
+ *glyph = fe->glyphIndex(unicode);
return true;
}
@@ -625,7 +595,7 @@ _hb_qt_reference_table(hb_face_t * /*face*/, hb_tag_t tag, void *user_data)
Q_ASSERT(get_font_table);
uint length = 0;
- if (Q_UNLIKELY(!get_font_table(data->user_data, tag, 0, &length) || length == 0))
+ if (Q_UNLIKELY(!get_font_table(data->user_data, tag, 0, &length)))
return hb_blob_get_empty();
char *buffer = (char *)malloc(length);
diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp
index 3049e0ab5e..5f277c878a 100644
--- a/src/gui/text/qplatformfontdatabase.cpp
+++ b/src/gui/text/qplatformfontdatabase.cpp
@@ -276,6 +276,16 @@ void QPlatformFontDatabase::populateFontDatabase()
}
/*!
+ This function is called whenever the font database is invalidated.
+
+ Reimplement this function to clear any internal data structures that
+ will need to be rebuilt at the next call to populateFontDatabase().
+*/
+void QPlatformFontDatabase::invalidate()
+{
+}
+
+/*!
Returns a multi font engine in the specified \a script to encapsulate \a fontEngine with the
option to fall back to the fonts given by \a fallbacks if \a fontEngine does not support
a certain character.
diff --git a/src/gui/text/qplatformfontdatabase.h b/src/gui/text/qplatformfontdatabase.h
index 5f2c9a74ba..870480809b 100644
--- a/src/gui/text/qplatformfontdatabase.h
+++ b/src/gui/text/qplatformfontdatabase.h
@@ -96,6 +96,8 @@ class Q_GUI_EXPORT QPlatformFontDatabase
public:
virtual ~QPlatformFontDatabase();
virtual void populateFontDatabase();
+ virtual void invalidate();
+
virtual QFontEngineMulti *fontEngineMulti(QFontEngine *fontEngine, QChar::Script script);
virtual QFontEngine *fontEngine(const QFontDef &fontDef, void *handle);
virtual QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const;
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index 449278df06..2ba350fb67 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -665,7 +665,7 @@ QList<QFontDatabase::WritingSystem> QRawFont::supportedWritingSystems() const
*/
bool QRawFont::supportsCharacter(QChar character) const
{
- return d->isValid() && d->fontEngine->canRender(&character, 1);
+ return supportsCharacter(character.unicode());
}
/*!
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 63e2af8d15..0298adde7a 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -839,6 +839,22 @@ void QTextEngine::bidiReorder(int numItems, const quint8 *levels, int *visualOrd
#endif
}
+
+enum JustificationClass {
+ Justification_Prohibited = 0, // Justification can not be applied after this glyph
+ Justification_Arabic_Space = 1, // This glyph represents a space inside arabic text
+ Justification_Character = 2, // Inter-character justification point follows this glyph
+ Justification_Space = 4, // This glyph represents a blank outside an Arabic run
+ Justification_Arabic_Normal = 7, // Normal Middle-Of-Word glyph that connects to the right (begin)
+ Justification_Arabic_Waw = 8, // Next character is final form of Waw/Ain/Qaf/Feh
+ Justification_Arabic_BaRa = 9, // Next two characters are Ba + Ra/Ya/AlefMaksura
+ Justification_Arabic_Alef = 10, // Next character is final form of Alef/Tah/Lam/Kaf/Gaf
+ Justification_Arabic_HahDal = 11, // Next character is final form of Hah/Dal/Teh Marbuta
+ Justification_Arabic_Seen = 12, // Initial or medial form of Seen/Sad
+ Justification_Arabic_Kashida = 13 // User-inserted Kashida(U+0640)
+};
+
+
// shape all the items that intersect with the line, taking tab widths into account to find out what text actually fits in the line.
void QTextEngine::shapeLine(const QScriptLine &line)
{
@@ -1018,12 +1034,12 @@ void QTextEngine::shapeText(int item) const
}
if (wordSpacing != 0) {
for (int i = 0; i < si.num_glyphs; ++i) {
- if (glyphs.attributes[i].justification == QGlyphAttributes::Space
- || glyphs.attributes[i].justification == QGlyphAttributes::Arabic_Space) {
+ if (glyphs.attributes[i].justification == Justification_Space
+ || glyphs.attributes[i].justification == Justification_Arabic_Space) {
// word spacing only gets added once to a consecutive run of spaces (see CSS spec)
if (i + 1 == si.num_glyphs
- ||(glyphs.attributes[i+1].justification != QGlyphAttributes::Space
- && glyphs.attributes[i+1].justification != QGlyphAttributes::Arabic_Space))
+ ||(glyphs.attributes[i+1].justification != Justification_Space
+ && glyphs.attributes[i+1].justification != Justification_Arabic_Space))
glyphs.advances[i] += wordSpacing;
}
}
@@ -1190,7 +1206,6 @@ QT_BEGIN_INCLUDE_NAMESPACE
QT_END_INCLUDE_NAMESPACE
Q_STATIC_ASSERT(sizeof(HB_Glyph) == sizeof(glyph_t));
-Q_STATIC_ASSERT(sizeof(HB_GlyphAttributes) == sizeof(QGlyphAttributes));
Q_STATIC_ASSERT(sizeof(HB_Fixed) == sizeof(QFixed));
Q_STATIC_ASSERT(sizeof(HB_FixedPoint) == sizeof(QFixedPoint));
@@ -1256,18 +1271,23 @@ int QTextEngine::shapeTextWithHarfbuzz(const QScriptItem &si, const ushort *stri
remaining_glyphs -= shaper_item.initialGlyphCount;
+ QVarLengthArray<HB_GlyphAttributes, 128> hbGlyphAttributes;
do {
if (!ensureSpace(glyph_pos + shaper_item.num_glyphs + remaining_glyphs))
return 0;
+ if (hbGlyphAttributes.size() < int(shaper_item.num_glyphs)) {
+ hbGlyphAttributes.resize(shaper_item.num_glyphs);
+ memset(hbGlyphAttributes.data(), 0, hbGlyphAttributes.size() * sizeof(HB_GlyphAttributes));
+ }
const QGlyphLayout g = availableGlyphs(&si).mid(glyph_pos);
if (fontEngine->type() == QFontEngine::Multi && shaper_item.num_glyphs > shaper_item.item.length)
moveGlyphData(g.mid(shaper_item.num_glyphs), g.mid(shaper_item.initialGlyphCount), remaining_glyphs);
shaper_item.glyphs = reinterpret_cast<HB_Glyph *>(g.glyphs);
- shaper_item.attributes = reinterpret_cast<HB_GlyphAttributes *>(g.attributes);
shaper_item.advances = reinterpret_cast<HB_Fixed *>(g.advances);
shaper_item.offsets = reinterpret_cast<HB_FixedPoint *>(g.offsets);
+ shaper_item.attributes = hbGlyphAttributes.data();
if (engineIdx != 0 && shaper_item.glyphIndicesPresent) {
for (quint32 i = 0; i < shaper_item.initialGlyphCount; ++i)
@@ -1281,6 +1301,14 @@ int QTextEngine::shapeTextWithHarfbuzz(const QScriptItem &si, const ushort *stri
if (fontEngine->type() == QFontEngine::Multi)
moveGlyphData(g.mid(shaper_item.num_glyphs), g.mid(shaper_item.initialGlyphCount), remaining_glyphs);
+ for (quint32 i = 0; i < shaper_item.num_glyphs; ++i) {
+ HB_GlyphAttributes hbAttrs = hbGlyphAttributes.at(i);
+ QGlyphAttributes &attrs = g.attributes[i];
+ attrs.clusterStart = hbAttrs.clusterStart;
+ attrs.dontPrint = hbAttrs.dontPrint;
+ attrs.justification = hbAttrs.justification;
+ }
+
for (quint32 i = 0; i < shaper_item.item.length; ++i)
shaper_item.log_clusters[i] += glyph_pos;
@@ -1478,18 +1506,8 @@ void QTextEngine::itemize() const
{
QVarLengthArray<uchar> scripts(length);
QUnicodeTools::initScripts(string, length, scripts.data());
- for (int i = 0; i < length; ++i) {
- ushort script = scripts.at(i);
- switch (script) {
- case QChar::Script_Hiragana:
- case QChar::Script_Katakana:
- script = QChar::Script_Han;
- break;
- default:
- break;
- }
- analysis[i].script = script;
- }
+ for (int i = 0; i < length; ++i)
+ analysis[i].script = scripts.at(i);
}
const ushort *uc = string;
@@ -1536,8 +1554,21 @@ void QTextEngine::itemize() const
(analysis-1)->flags = QScriptAnalysis::LineOrParagraphSeparator; // to exclude it from width
}
#ifdef QT_ENABLE_HARFBUZZ_NG
- if (!useHarfbuzzNG) {
- analysis = scriptAnalysis.data();
+ analysis = scriptAnalysis.data();
+ if (useHarfbuzzNG) {
+ for (int i = 0; i < length; ++i) {
+ switch (analysis[i].script) {
+ case QChar::Script_Han:
+ case QChar::Script_Hiragana:
+ case QChar::Script_Katakana:
+ case QChar::Script_Bopomofo:
+ analysis[i].script = QChar::Script_Common;
+ break;
+ default:
+ break;
+ }
+ }
+ } else {
for (int i = 0; i < length; ++i)
analysis[i].script = hbscript_to_script(script_to_hbscript(analysis[i].script));
}
@@ -1980,26 +2011,21 @@ static void set(QJustificationPoint *point, int type, const QGlyphLayout &glyph,
point->type = type;
point->glyph = glyph;
- if (type >= QGlyphAttributes::Arabic_Normal) {
+ if (type >= Justification_Arabic_Normal) {
QChar ch(0x640); // Kashida character
- glyph_t kashidaGlyph;
- QFixed kashidaWidth;
-
- QGlyphLayout glyphs;
- glyphs.numGlyphs = 1;
- glyphs.glyphs = &kashidaGlyph;
- glyphs.advances = &kashidaWidth;
-
- int nglyphs = 1;
- if (!fe->stringToCMap(&ch, 1, &glyphs, &nglyphs, 0))
- Q_UNREACHABLE();
- Q_ASSERT(nglyphs == 1);
+ glyph_t kashidaGlyph = fe->glyphIndex(ch.unicode());
+ if (kashidaGlyph != 0) {
+ QGlyphLayout g;
+ g.numGlyphs = 1;
+ g.glyphs = &kashidaGlyph;
+ g.advances = &point->kashidaWidth;
+ fe->recalcAdvances(&g, 0);
- if (kashidaGlyph != 0 && kashidaWidth != 0) {
- point->kashidaWidth = kashidaWidth;
+ if (point->kashidaWidth == 0)
+ point->type = Justification_Prohibited;
} else {
- point->type = QGlyphAttributes::NoJustification;
+ point->type = Justification_Prohibited;
point->kashidaWidth = 0;
}
}
@@ -2067,7 +2093,7 @@ void QTextEngine::justify(const QScriptLine &line)
for (int i = 0; i < nItems; ++i) {
QScriptItem &si = layoutData->items[firstItem + i];
- int kashida_type = QGlyphAttributes::Arabic_Normal;
+ int kashida_type = Justification_Arabic_Normal;
int kashida_pos = -1;
int start = qMax(line.from - si.position, 0);
@@ -2091,11 +2117,11 @@ void QTextEngine::justify(const QScriptLine &line)
int justification = g.attributes[i].justification;
switch(justification) {
- case QGlyphAttributes::NoJustification:
+ case Justification_Prohibited:
break;
- case QGlyphAttributes::Space :
+ case Justification_Space:
// fall through
- case QGlyphAttributes::Arabic_Space :
+ case Justification_Arabic_Space:
if (kashida_pos >= 0) {
// qDebug("kashida position at %d in word", kashida_pos);
set(&justificationPoints[nPoints], kashida_type, g.mid(kashida_pos), fontEngine(si));
@@ -2106,19 +2132,19 @@ void QTextEngine::justify(const QScriptLine &line)
}
}
kashida_pos = -1;
- kashida_type = QGlyphAttributes::Arabic_Normal;
+ kashida_type = Justification_Arabic_Normal;
// fall through
- case QGlyphAttributes::Character :
+ case Justification_Character:
set(&justificationPoints[nPoints++], justification, g.mid(i), fontEngine(si));
maxJustify = qMax(maxJustify, justification);
break;
- case QGlyphAttributes::Arabic_Normal :
- case QGlyphAttributes::Arabic_Waw :
- case QGlyphAttributes::Arabic_BaRa :
- case QGlyphAttributes::Arabic_Alef :
- case QGlyphAttributes::Arabic_HaaDal :
- case QGlyphAttributes::Arabic_Seen :
- case QGlyphAttributes::Arabic_Kashida :
+ case Justification_Arabic_Normal:
+ case Justification_Arabic_Waw:
+ case Justification_Arabic_BaRa:
+ case Justification_Arabic_Alef:
+ case Justification_Arabic_HahDal:
+ case Justification_Arabic_Seen:
+ case Justification_Arabic_Kashida:
if (justification >= kashida_type) {
kashida_pos = i;
kashida_type = justification;
@@ -2147,9 +2173,9 @@ void QTextEngine::justify(const QScriptLine &line)
// qDebug(" minKashida=%f, need=%f", minKashida.toReal(), need.toReal());
// distribute in priority order
- if (maxJustify >= QGlyphAttributes::Arabic_Normal) {
+ if (maxJustify >= Justification_Arabic_Normal) {
while (need >= minKashida) {
- for (int type = maxJustify; need >= minKashida && type >= QGlyphAttributes::Arabic_Normal; --type) {
+ for (int type = maxJustify; need >= minKashida && type >= Justification_Arabic_Normal; --type) {
for (int i = 0; need >= minKashida && i < nPoints; ++i) {
if (justificationPoints[i].type == type && justificationPoints[i].kashidaWidth <= need) {
justificationPoints[i].glyph.justifications->nKashidas++;
@@ -2166,7 +2192,7 @@ void QTextEngine::justify(const QScriptLine &line)
if (!need)
goto end;
- maxJustify = qMin(maxJustify, int(QGlyphAttributes::Space));
+ maxJustify = qMin(maxJustify, int(Justification_Space));
for (int type = maxJustify; need != 0 && type > 0; --type) {
int n = 0;
for (int i = 0; i < nPoints; ++i) {
@@ -2616,40 +2642,30 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int
QFixed ellipsisWidth;
QString ellipsisText;
{
- QChar ellipsisChar(0x2026);
-
QFontEngine *fe = fnt.d->engineForScript(QChar::Script_Common);
+ QFontEngine *engine = fe->type() == QFontEngine::Multi ? static_cast<QFontEngineMulti *>(fe)->engine(0) : fe;
- QGlyphLayoutArray<1> ellipsisGlyph;
- {
- QFontEngine *feForEllipsis = (fe->type() == QFontEngine::Multi)
- ? static_cast<QFontEngineMulti *>(fe)->engine(0)
- : fe;
+ QChar ellipsisChar(0x2026);
- if (feForEllipsis->type() == QFontEngine::Mac)
- feForEllipsis = fe;
+ glyph_t glyph = engine->glyphIndex(ellipsisChar.unicode());
- int nGlyphs = 1;
- if (!feForEllipsis->stringToCMap(&ellipsisChar, 1, &ellipsisGlyph, &nGlyphs, 0))
- Q_UNREACHABLE();
- Q_ASSERT(nGlyphs == 1);
- }
+ QGlyphLayout glyphs;
+ glyphs.numGlyphs = 1;
+ glyphs.glyphs = &glyph;
+ glyphs.advances = &ellipsisWidth;
+
+ if (glyph != 0) {
+ engine->recalcAdvances(&glyphs, 0);
- if (ellipsisGlyph.glyphs[0]) {
- ellipsisWidth = ellipsisGlyph.advances[0];
ellipsisText = ellipsisChar;
} else {
- QString dotDotDot(QLatin1String("..."));
+ glyph = engine->glyphIndex('.');
+ if (glyph != 0) {
+ engine->recalcAdvances(&glyphs, 0);
- QGlyphLayoutArray<3> glyphs;
- int nGlyphs = 3;
- if (!fe->stringToCMap(dotDotDot.constData(), 3, &glyphs, &nGlyphs, 0))
- Q_UNREACHABLE();
- Q_ASSERT(nGlyphs == 3);
-
- for (int i = 0; i < nGlyphs; ++i)
- ellipsisWidth += glyphs.advances[i];
- ellipsisText = dotDotDot;
+ ellipsisWidth *= 3;
+ ellipsisText = QStringLiteral("...");
+ }
}
}
diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h
index 1616a78937..342a94de66 100644
--- a/src/gui/text/qtextengine_p.h
+++ b/src/gui/text/qtextengine_p.h
@@ -89,35 +89,6 @@ class QAbstractTextDocumentLayout;
typedef quint32 glyph_t;
-#ifdef __xlC__
-typedef unsigned q_hb_bitfield;
-#else
-typedef quint8 q_hb_bitfield;
-#endif
-
-typedef struct {
- typedef enum {
- NoJustification= 0, /* Justification can't be applied after this glyph */
- Arabic_Space = 1, /* This glyph represents a space inside arabic text */
- Character = 2, /* Inter-character justification point follows this glyph */
- Space = 4, /* This glyph represents a blank outside an Arabic run */
- Arabic_Normal = 7, /* Normal Middle-Of-Word glyph that connects to the right (begin) */
- Arabic_Waw = 8, /* Next character is final form of Waw/Ain/Qaf/Fa */
- Arabic_BaRa = 9, /* Next two chars are Ba + Ra/Ya/AlefMaksura */
- Arabic_Alef = 10, /* Next character is final form of Alef/Tah/Lam/Kaf/Gaf */
- Arabic_HaaDal = 11, /* Next character is final form of Haa/Dal/Taa Marbutah */
- Arabic_Seen = 12, /* Initial or Medial form Of Seen/Sad */
- Arabic_Kashida = 13 /* Kashida(U+640) in middle of word */
- } JustificationClass;
-
- q_hb_bitfield justification :4; /* Justification class */
- q_hb_bitfield clusterStart :1; /* First glyph of representation of cluster */
- q_hb_bitfield mark :1; /* needs to be positioned around base char */
- q_hb_bitfield zeroWidth :1; /* ZWJ, ZWNJ etc, with no width */
- q_hb_bitfield dontPrint :1;
- q_hb_bitfield combiningClass :8;
-} QGlyphAttributes;
-
// this uses the same coordinate system as Qt, but a different one to freetype.
// * y is usually negative, and is equal to the ascent.
// * negative yoff means the following stuff is drawn higher up.
@@ -188,6 +159,14 @@ struct QGlyphJustification
};
Q_DECLARE_TYPEINFO(QGlyphJustification, Q_PRIMITIVE_TYPE);
+struct QGlyphAttributes {
+ uchar clusterStart : 1;
+ uchar dontPrint : 1;
+ uchar justification : 4;
+ uchar reserved : 2;
+};
+Q_STATIC_ASSERT(sizeof(QGlyphAttributes) == 1);
+
struct QGlyphLayout
{
enum {
@@ -200,7 +179,7 @@ struct QGlyphLayout
glyph_t *glyphs; // 4 bytes per element
QFixed *advances; // 4 bytes per element
QGlyphJustification *justifications; // 4 bytes per element
- QGlyphAttributes *attributes; // 2 bytes per element
+ QGlyphAttributes *attributes; // 1 byte per element
int numGlyphs;