From 4b2f35d04ca3c2e037b4d0edd8b2350051cc572c Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 28 Feb 2014 17:03:57 +0100 Subject: Dynamic GL: remove exporting symbols MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the opengl proxy for now. Later it will either be moved into a separate library or replaced by a QOpenGLFunctions-based approach. This means that the -opengl dynamic configuration is not usable for the time being. The rest of the enablers remain in place. The convenience function QOpenGLFunctions::isES() is now moved to QOpenGLContext and is changed to check the renderable type. This is extremely useful since besides supporting dynamic GL it solves also the problem of GL_ARB_ES2_compatibility (i.e. it triggers the real ES path when creating an ES-compatible context with a desktop OpenGL implementation). Task-number: QTBUG-36483 Task-number: QTBUG-37172 Change-Id: I045be3fc16e9043e1528cf48e6bf0903da4fa7ca Reviewed-by: Friedemann Kleint Reviewed-by: Jørgen Lind --- examples/opengl/contextinfo/widget.cpp | 4 +- src/gui/kernel/qopenglcontext.cpp | 76 +- src/gui/kernel/qopenglcontext.h | 12 + src/gui/opengl/qopenglbuffer.cpp | 2 +- src/gui/opengl/qopengldebug.cpp | 3 +- src/gui/opengl/qopenglengineshadermanager.cpp | 2 +- src/gui/opengl/qopenglframebufferobject.cpp | 14 +- src/gui/opengl/qopenglframebufferobject_p.h | 7 +- src/gui/opengl/qopenglfunctions.cpp | 94 +- src/gui/opengl/qopenglfunctions.h | 9 - src/gui/opengl/qopenglpaintengine.cpp | 10 +- src/gui/opengl/qopenglproxy_win.cpp | 4597 -------------------- src/gui/opengl/qopenglshaderprogram.cpp | 10 +- src/gui/opengl/qopengltexture.cpp | 32 +- src/gui/opengl/qopengltextureglyphcache.cpp | 6 +- src/gui/opengl/qopengltexturehelper.cpp | 9 +- src/gui/opengl/qopengltimerquery.cpp | 10 +- src/gui/opengl/qopenglvertexarrayobject.cpp | 4 +- src/gui/painting/qplatformbackingstore.cpp | 2 +- .../gl2paintengineex/qglengineshadermanager.cpp | 2 +- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 12 +- .../gl2paintengineex/qtextureglyphcache_gl.cpp | 4 +- src/opengl/qgl.cpp | 79 +- src/opengl/qgl_qpa.cpp | 2 +- src/opengl/qglbuffer.cpp | 2 +- src/opengl/qglframebufferobject.cpp | 14 +- src/opengl/qglframebufferobject_p.h | 4 +- src/opengl/qglfunctions.cpp | 8 +- src/opengl/qglpixelbuffer.cpp | 6 +- src/opengl/qglshaderprogram.cpp | 14 +- .../eglconvenience/qeglconvenience.cpp | 10 +- .../eglconvenience/qeglplatformcontext.cpp | 6 +- .../platforms/windows/qwindowsintegration.cpp | 7 +- .../platforms/windows/qwindowsnativeinterface.cpp | 4 +- src/plugins/platforms/windows/qwindowswindow.cpp | 2 +- tests/auto/opengl/qgl/tst_qgl.cpp | 8 +- .../auto/opengl/qglfunctions/tst_qglfunctions.cpp | 2 +- tests/auto/opengl/qglthreads/tst_qglthreads.cpp | 2 +- .../auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp | 5 +- 39 files changed, 255 insertions(+), 4841 deletions(-) delete mode 100644 src/gui/opengl/qopenglproxy_win.cpp diff --git a/examples/opengl/contextinfo/widget.cpp b/examples/opengl/contextinfo/widget.cpp index 13cec3b3f8..6d4b97ca8f 100644 --- a/examples/opengl/contextinfo/widget.cpp +++ b/examples/opengl/contextinfo/widget.cpp @@ -337,9 +337,9 @@ void Widget::renderWindowReady() const char *gltype[] = { "Desktop", "GLES 2", "GLES 1" }; m_output->append(tr("\nQt OpenGL configuration: %1") - .arg(QString::fromLatin1(gltype[QOpenGLFunctions::platformGLType()]))); + .arg(QString::fromLatin1(gltype[QOpenGLContext::openGLModuleType()]))); m_output->append(tr("Qt OpenGL library handle: %1") - .arg(QString::number(qintptr(QOpenGLFunctions::platformGLHandle()), 16))); + .arg(QString::number(qintptr(QOpenGLContext::openGLModuleHandle()), 16))); QList extensionList = context->extensions().toList(); std::sort(extensionList.begin(), extensionList.end()); diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 7257663799..357beb4e24 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -338,7 +338,8 @@ int QOpenGLContextPrivate::maxTextureSize() glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size); #ifndef QT_OPENGL_ES - if (!QOpenGLFunctions::isES()) { + Q_Q(QOpenGLContext); + if (!q->isES()) { GLenum proxy = GL_PROXY_TEXTURE_2D; GLint size; @@ -643,8 +644,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 @@ -959,6 +960,75 @@ 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. + + \sa openGLModuleType() + + \since 5.3 + */ +void *QOpenGLContext::openGLModuleHandle() +{ + return 0; +} + +/*! + \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(). + + \since 5.3 + */ +QOpenGLContext::OpenGLModuleType QOpenGLContext::openGLModuleType() +{ +#if 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 */ 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 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/opengl/qopenglbuffer.cpp b/src/gui/opengl/qopenglbuffer.cpp index a4c1e538ee..fe121f126f 100644 --- a/src/gui/opengl/qopenglbuffer.cpp +++ b/src/gui/opengl/qopenglbuffer.cpp @@ -333,7 +333,7 @@ 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; diff --git a/src/gui/opengl/qopengldebug.cpp b/src/gui/opengl/qopengldebug.cpp index 2355d0a8a7..cc6e945954 100644 --- a/src/gui/opengl/qopengldebug.cpp +++ b/src/gui/opengl/qopengldebug.cpp @@ -43,7 +43,6 @@ #include #include #include -#include #include "qopengldebug.h" @@ -1370,7 +1369,7 @@ bool QOpenGLDebugLogger::initialize() // through wglGetProcAddress #if defined(Q_OS_WIN) && !defined(QT_OPENGL_ES_2) { - HMODULE handle = static_cast(QOpenGLFunctions::platformGLHandle()); + HMODULE handle = static_cast(QOpenGLContext::openGLModuleHandle()); if (!handle) handle = GetModuleHandleA("opengl32.dll"); d->glGetPointerv = reinterpret_cast(GetProcAddress(handle, QByteArrayLiteral("glGetPointerv"))); 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/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp index 9953b4e889..db1ea1b1a1 100644 --- a/src/gui/opengl/qopenglframebufferobject.cpp +++ b/src/gui/opengl/qopenglframebufferobject.cpp @@ -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); } 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..9a52ae2a9f 100644 --- a/src/gui/opengl/qopenglfunctions.cpp +++ b/src/gui/opengl/qopenglfunctions.cpp @@ -249,7 +249,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 +271,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 +292,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 +356,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")) @@ -2511,88 +2515,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..8b84a460a3 100644 --- a/src/gui/opengl/qopenglfunctions.h +++ b/src/gui/opengl/qopenglfunctions.h @@ -311,15 +311,6 @@ 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; } - protected: QOpenGLFunctionsPrivate *d_ptr; static bool isInitialized(const QOpenGLFunctionsPrivate *d) { return d != 0; } diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp index 63127668a5..7fa80c5343 100644 --- a/src/gui/opengl/qopenglpaintengine.cpp +++ b/src/gui/opengl/qopenglpaintengine.cpp @@ -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. @@ -542,7 +542,7 @@ void QOpenGL2PaintEngineEx::beginNativePainting() d->funcs.glDisableVertexAttribArray(i); #ifndef QT_OPENGL_ES_2 - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { Q_ASSERT(QOpenGLContext::currentContext()); const QOpenGLContext *ctx = d->ctx; const QSurfaceFormat &fmt = d->device->context()->format(); @@ -600,7 +600,7 @@ void QOpenGL2PaintEngineExPrivate::resetGLState() 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); @@ -1335,7 +1335,7 @@ void QOpenGL2PaintEngineEx::renderHintsChanged() state()->renderHintsChanged = true; #ifndef QT_OPENGL_ES_2 - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { if ((state()->renderHints & QPainter::Antialiasing) || (state()->renderHints & QPainter::HighQualityAntialiasing)) glEnable(GL_MULTISAMPLE); @@ -2012,7 +2012,7 @@ bool QOpenGL2PaintEngineEx::begin(QPaintDevice *pdev) d->glyphCacheFormat = QFontEngine::Format_A8; #ifndef QT_OPENGL_ES_2 - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { glDisable(GL_MULTISAMPLE); d->glyphCacheFormat = QFontEngine::Format_A32; d->multisamplingAlwaysEnabled = false; 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 -#include -#include -#include -#include -// Must not include QOpenGLFunctions or anything that pulls in qopengl.h. -// Otherwise we end up with errors about inconsistent linkage. -#include -#include - -#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(""); - } - 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(resolveFunc("wglCopyContext")); - CreateContext = reinterpret_cast(resolveFunc("wglCreateContext")); - CreateLayerContext = reinterpret_cast(resolveFunc("wglCreateLayerContext")); - DeleteContext = reinterpret_cast(resolveFunc("wglDeleteContext")); - GetCurrentContext = reinterpret_cast(resolveFunc("wglGetCurrentContext")); - GetCurrentDC = reinterpret_cast(resolveFunc("wglGetCurrentDC")); - GetProcAddress = reinterpret_cast(resolveFunc("wglGetProcAddress")); - MakeCurrent = reinterpret_cast(resolveFunc("wglMakeCurrent")); - ShareLists = reinterpret_cast(resolveFunc("wglShareLists")); - UseFontBitmapsW = reinterpret_cast(resolveFunc("wglUseFontBitmapsW")); - UseFontOutlinesW = reinterpret_cast(resolveFunc("wglUseFontOutlinesW")); - DescribeLayerPlane = reinterpret_cast(resolveFunc("wglDescribeLayerPlane")); - SetLayerPaletteEntries = reinterpret_cast(resolveFunc("wglSetLayerPaletteEntries")); - GetLayerPaletteEntries = reinterpret_cast(resolveFunc("wglGetLayerPaletteEntries")); - RealizeLayerPalette = reinterpret_cast(resolveFunc("wglRealizeLayerPalette")); - SwapLayerBuffers = reinterpret_cast(resolveFunc("wglSwapLayerBuffers")); - SwapMultipleBuffers = reinterpret_cast(resolveFunc("wglSwapMultipleBuffers")); -} - -void QWindowsOpenGL::resolveEGL() -{ - EGL_GetError = reinterpret_cast(resolveEglFunc("eglGetError")); - EGL_GetDisplay = reinterpret_cast(resolveEglFunc("eglGetDisplay")); - EGL_Initialize = reinterpret_cast(resolveEglFunc("eglInitialize")); - EGL_Terminate = reinterpret_cast(resolveEglFunc("eglTerminate")); - EGL_QueryString = reinterpret_cast(resolveEglFunc("eglQueryString")); - EGL_GetConfigs = reinterpret_cast(resolveEglFunc("eglGetConfigs")); - EGL_ChooseConfig = reinterpret_cast(resolveEglFunc("eglChooseConfig")); - EGL_GetConfigAttrib = reinterpret_cast(resolveEglFunc("eglGetConfigAttrib")); - EGL_CreateWindowSurface = reinterpret_cast(resolveEglFunc("eglCreateWindowSurface")); - EGL_CreatePbufferSurface = reinterpret_cast(resolveEglFunc("eglCreatePbufferSurface")); - EGL_CreatePixmapSurface = reinterpret_cast(resolveEglFunc("eglCreatePixmapSurface")); - EGL_DestroySurface = reinterpret_cast(resolveEglFunc("eglDestroySurface")); - EGL_QuerySurface = reinterpret_cast(resolveEglFunc("eglQuerySurface")); - EGL_BindAPI = reinterpret_cast(resolveEglFunc("eglBindAPI")); - EGL_QueryAPI = reinterpret_cast(resolveEglFunc("eglQueryAPI")); - EGL_WaitClient = reinterpret_cast(resolveEglFunc("eglWaitClient")); - EGL_ReleaseThread = reinterpret_cast(resolveEglFunc("eglReleaseThread")); - EGL_CreatePbufferFromClientBuffer = reinterpret_cast(resolveEglFunc("eglCreatePbufferFromClientBuffer")); - EGL_SurfaceAttrib = reinterpret_cast(resolveEglFunc("eglSurfaceAttrib")); - EGL_BindTexImage = reinterpret_cast(resolveEglFunc("eglBindTexImage")); - EGL_ReleaseTexImage = reinterpret_cast(resolveEglFunc("eglReleaseTexImage")); - EGL_SwapInterval = reinterpret_cast(resolveEglFunc("eglSwapInterval")); - EGL_CreateContext = reinterpret_cast(resolveEglFunc("eglCreateContext")); - EGL_DestroyContext = reinterpret_cast(resolveEglFunc("eglDestroyContext")); - EGL_MakeCurrent = reinterpret_cast(resolveEglFunc("eglMakeCurrent")); - EGL_GetCurrentContext = reinterpret_cast(resolveEglFunc("eglGetCurrentContext")); - EGL_GetCurrentSurface = reinterpret_cast(resolveEglFunc("eglGetCurrentSurface")); - EGL_GetCurrentDisplay = reinterpret_cast(resolveEglFunc("eglGetCurrentDisplay")); - EGL_QueryContext = reinterpret_cast(resolveEglFunc("eglQueryContext")); - EGL_WaitGL = reinterpret_cast(resolveEglFunc("eglWaitGL")); - EGL_WaitNative = reinterpret_cast(resolveEglFunc("eglWaitNative")); - EGL_SwapBuffers = reinterpret_cast(resolveEglFunc("eglSwapBuffers")); - EGL_CopyBuffers = reinterpret_cast(resolveEglFunc("eglCopyBuffers")); - EGL_GetProcAddress = reinterpret_cast<__eglMustCastToProperFunctionPointerType (EGLAPIENTRY * )(const char *)>(resolveEglFunc("eglGetProcAddress")); -} - -void QWindowsOpenGL::resolveGLCommon() -{ - Viewport = reinterpret_cast(resolveFunc("glViewport")); - IsEnabled = reinterpret_cast(resolveFunc("glIsEnabled")); - GetTexParameteriv = reinterpret_cast(resolveFunc("glGetTexParameteriv")); - GetTexParameterfv = reinterpret_cast(resolveFunc("glGetTexParameterfv")); - GetString = reinterpret_cast(resolveFunc("glGetString")); - GetIntegerv = reinterpret_cast(resolveFunc("glGetIntegerv")); - GetFloatv = reinterpret_cast(resolveFunc("glGetFloatv")); - GetError = reinterpret_cast(resolveFunc("glGetError")); - GetBooleanv = reinterpret_cast(resolveFunc("glGetBooleanv")); - ReadPixels = reinterpret_cast(resolveFunc("glReadPixels")); - PixelStorei = reinterpret_cast(resolveFunc("glPixelStorei")); - DepthFunc = reinterpret_cast(resolveFunc("glDepthFunc")); - StencilOp = reinterpret_cast(resolveFunc("glStencilOp")); - StencilFunc = reinterpret_cast(resolveFunc("glStencilFunc")); - BlendFunc = reinterpret_cast(resolveFunc("glBlendFunc")); - Flush = reinterpret_cast(resolveFunc("glFlush")); - Finish = reinterpret_cast(resolveFunc("glFinish")); - Enable = reinterpret_cast(resolveFunc("glEnable")); - Disable = reinterpret_cast(resolveFunc("glDisable")); - DepthMask = reinterpret_cast(resolveFunc("glDepthMask")); - ColorMask = reinterpret_cast(resolveFunc("glColorMask")); - StencilMask = reinterpret_cast(resolveFunc("glStencilMask")); - ClearStencil = reinterpret_cast(resolveFunc("glClearStencil")); - ClearColor = reinterpret_cast(resolveFunc("glClearColor")); - Clear = reinterpret_cast(resolveFunc("glClear")); - TexImage2D = reinterpret_cast(resolveFunc("glTexImage2D")); - TexParameteriv = reinterpret_cast(resolveFunc("glTexParameteriv")); - TexParameteri = reinterpret_cast(resolveFunc("glTexParameteri")); - TexParameterfv = reinterpret_cast(resolveFunc("glTexParameterfv")); - TexParameterf = reinterpret_cast(resolveFunc("glTexParameterf")); - Scissor = reinterpret_cast(resolveFunc("glScissor")); - LineWidth = reinterpret_cast(resolveFunc("glLineWidth")); - Hint = reinterpret_cast(resolveFunc("glHint")); - FrontFace = reinterpret_cast(resolveFunc("glFrontFace")); - CullFace = reinterpret_cast(resolveFunc("glCullFace")); - - IsTexture = reinterpret_cast(resolveFunc("glIsTexture")); - GenTextures = reinterpret_cast(resolveFunc("glGenTextures")); - DeleteTextures = reinterpret_cast(resolveFunc("glDeleteTextures")); - BindTexture = reinterpret_cast(resolveFunc("glBindTexture")); - TexSubImage2D = reinterpret_cast(resolveFunc("glTexSubImage2D")); - CopyTexSubImage2D = reinterpret_cast(resolveFunc("glCopyTexSubImage2D")); - CopyTexImage2D = reinterpret_cast(resolveFunc("glCopyTexImage2D")); - PolygonOffset = reinterpret_cast(resolveFunc("glPolygonOffset")); - DrawElements = reinterpret_cast(resolveFunc("glDrawElements")); - DrawArrays = reinterpret_cast(resolveFunc("glDrawArrays")); -} - -void QWindowsOpenGL::resolveGL11() -{ - DepthRange = reinterpret_cast(resolveFunc("glDepthRange")); - GetTexImage = reinterpret_cast(resolveFunc("glGetTexImage")); - LogicOp = reinterpret_cast(resolveFunc("glLogicOp")); - ClearDepth = reinterpret_cast(resolveFunc("glClearDepth")); - PolygonMode = reinterpret_cast(resolveFunc("glPolygonMode")); - PointSize = reinterpret_cast(resolveFunc("glPointSize")); - GetTexLevelParameteriv = reinterpret_cast(resolveFunc("glGetTexLevelParameteriv")); - GetTexLevelParameterfv = reinterpret_cast(resolveFunc("glGetTexLevelParameterfv")); - GetDoublev = reinterpret_cast(resolveFunc("glGetDoublev")); - PixelStoref = reinterpret_cast(resolveFunc("glPixelStoref")); - ReadBuffer = reinterpret_cast(resolveFunc("glReadBuffer")); - DrawBuffer = reinterpret_cast(resolveFunc("glDrawBuffer")); - TexImage1D = reinterpret_cast(resolveFunc("glTexImage1D")); - - Translatef = reinterpret_cast(resolveFunc("glTranslatef")); - Translated = reinterpret_cast(resolveFunc("glTranslated")); - Scalef = reinterpret_cast(resolveFunc("glScalef")); - Scaled = reinterpret_cast(resolveFunc("glScaled")); - Rotatef = reinterpret_cast(resolveFunc("glRotatef")); - Rotated = reinterpret_cast(resolveFunc("glRotated")); - PushMatrix = reinterpret_cast(resolveFunc("glPushMatrix")); - PopMatrix = reinterpret_cast(resolveFunc("glPopMatrix")); - Ortho = reinterpret_cast(resolveFunc("glOrtho")); - MultMatrixd = reinterpret_cast(resolveFunc("glMultMatrixd")); - MultMatrixf = reinterpret_cast(resolveFunc("glMultMatrixf")); - MatrixMode = reinterpret_cast(resolveFunc("glMatrixMode")); - LoadMatrixd = reinterpret_cast(resolveFunc("glLoadMatrixd")); - LoadMatrixf = reinterpret_cast(resolveFunc("glLoadMatrixf")); - LoadIdentity = reinterpret_cast(resolveFunc("glLoadIdentity")); - Frustum = reinterpret_cast(resolveFunc("glFrustum")); - IsList = reinterpret_cast(resolveFunc("glIsList")); - GetTexGeniv = reinterpret_cast(resolveFunc("glGetTexGeniv")); - GetTexGenfv = reinterpret_cast(resolveFunc("glGetTexGenfv")); - GetTexGendv = reinterpret_cast(resolveFunc("glGetTexGendv")); - GetTexEnviv = reinterpret_cast(resolveFunc("glGetTexEnviv")); - GetTexEnvfv = reinterpret_cast(resolveFunc("glGetTexEnvfv")); - GetPolygonStipple = reinterpret_cast(resolveFunc("glGetPolygonStipple")); - GetPixelMapusv = reinterpret_cast(resolveFunc("glGetPixelMapusv")); - GetPixelMapuiv = reinterpret_cast(resolveFunc("glGetPixelMapuiv")); - GetPixelMapfv = reinterpret_cast(resolveFunc("glGetPixelMapfv")); - GetMaterialiv = reinterpret_cast(resolveFunc("glGetMaterialiv")); - GetMaterialfv = reinterpret_cast(resolveFunc("glGetMaterialfv")); - GetMapiv = reinterpret_cast(resolveFunc("glGetMapiv")); - GetMapfv = reinterpret_cast(resolveFunc("glGetMapfv")); - GetMapdv = reinterpret_cast(resolveFunc("glGetMapdv")); - GetLightiv = reinterpret_cast(resolveFunc("glGetLightiv")); - GetLightfv = reinterpret_cast(resolveFunc("glGetLightfv")); - GetClipPlane = reinterpret_cast(resolveFunc("glGetClipPlane")); - DrawPixels = reinterpret_cast(resolveFunc("glDrawPixels")); - CopyPixels = reinterpret_cast(resolveFunc("glCopyPixels")); - PixelMapusv = reinterpret_cast(resolveFunc("glPixelMapusv")); - PixelMapuiv = reinterpret_cast(resolveFunc("glPixelMapuiv")); - PixelMapfv = reinterpret_cast(resolveFunc("glPixelMapfv")); - PixelTransferi = reinterpret_cast(resolveFunc("glPixelTransferi")); - PixelTransferf = reinterpret_cast(resolveFunc("glPixelTransferf")); - PixelZoom = reinterpret_cast(resolveFunc("glPixelZoom")); - AlphaFunc = reinterpret_cast(resolveFunc("glAlphaFunc")); - EvalPoint2 = reinterpret_cast(resolveFunc("glEvalPoint2")); - EvalMesh2 = reinterpret_cast(resolveFunc("glEvalMesh2")); - EvalPoint1 = reinterpret_cast(resolveFunc("glEvalPoint1")); - EvalMesh1 = reinterpret_cast(resolveFunc("glEvalMesh1")); - EvalCoord2fv = reinterpret_cast(resolveFunc("glEvalCoord2fv")); - EvalCoord2f = reinterpret_cast(resolveFunc("glEvalCoord2f")); - EvalCoord2dv = reinterpret_cast(resolveFunc("glEvalCoord2dv")); - EvalCoord2d = reinterpret_cast(resolveFunc("glEvalCoord2d")); - EvalCoord1fv = reinterpret_cast(resolveFunc("glEvalCoord1fv")); - EvalCoord1f = reinterpret_cast(resolveFunc("glEvalCoord1f")); - EvalCoord1dv = reinterpret_cast(resolveFunc("glEvalCoord1dv")); - EvalCoord1d = reinterpret_cast(resolveFunc("glEvalCoord1d")); - MapGrid2f = reinterpret_cast(resolveFunc("glMapGrid2f")); - MapGrid2d = reinterpret_cast(resolveFunc("glMapGrid2d")); - MapGrid1f = reinterpret_cast(resolveFunc("glMapGrid1f")); - MapGrid1d = reinterpret_cast(resolveFunc("glMapGrid1d")); - Map2f = reinterpret_cast(resolveFunc("glMap2f")); - Map2d = reinterpret_cast(resolveFunc("glMap2d")); - Map1f = reinterpret_cast(resolveFunc("glMap1f")); - Map1d = reinterpret_cast(resolveFunc("glMap1d")); - PushAttrib = reinterpret_cast(resolveFunc("glPushAttrib")); - PopAttrib = reinterpret_cast(resolveFunc("glPopAttrib")); - Accum = reinterpret_cast(resolveFunc("glAccum")); - IndexMask = reinterpret_cast(resolveFunc("glIndexMask")); - ClearIndex = reinterpret_cast(resolveFunc("glClearIndex")); - ClearAccum = reinterpret_cast(resolveFunc("glClearAccum")); - PushName = reinterpret_cast(resolveFunc("glPushName")); - PopName = reinterpret_cast(resolveFunc("glPopName")); - PassThrough = reinterpret_cast(resolveFunc("glPassThrough")); - LoadName = reinterpret_cast(resolveFunc("glLoadName")); - InitNames = reinterpret_cast(resolveFunc("glInitNames")); - RenderMode = reinterpret_cast(resolveFunc("glRenderMode")); - SelectBuffer = reinterpret_cast(resolveFunc("glSelectBuffer")); - FeedbackBuffer = reinterpret_cast(resolveFunc("glFeedbackBuffer")); - TexGeniv = reinterpret_cast(resolveFunc("glTexGeniv")); - TexGeni = reinterpret_cast(resolveFunc("glTexGeni")); - TexGenfv = reinterpret_cast(resolveFunc("glTexGenfv")); - TexGenf = reinterpret_cast(resolveFunc("glTexGenf")); - TexGendv = reinterpret_cast(resolveFunc("glTexGendv")); - TexGend = reinterpret_cast(resolveFunc("glTexGend")); - TexEnviv = reinterpret_cast(resolveFunc("glTexEnviv")); - TexEnvi = reinterpret_cast(resolveFunc("glTexEnvi")); - TexEnvfv = reinterpret_cast(resolveFunc("glTexEnvfv")); - TexEnvf = reinterpret_cast(resolveFunc("glTexEnvf")); - ShadeModel = reinterpret_cast(resolveFunc("glShadeModel")); - PolygonStipple = reinterpret_cast(resolveFunc("glPolygonStipple")); - Materialiv = reinterpret_cast(resolveFunc("glMaterialiv")); - Materiali = reinterpret_cast(resolveFunc("glMateriali")); - Materialfv = reinterpret_cast(resolveFunc("glMaterialfv")); - Materialf = reinterpret_cast(resolveFunc("glMaterialf")); - LineStipple = reinterpret_cast(resolveFunc("glLineStipple")); - LightModeliv = reinterpret_cast(resolveFunc("glLightModeliv")); - LightModeli = reinterpret_cast(resolveFunc("glLightModeli")); - LightModelfv = reinterpret_cast(resolveFunc("glLightModelfv")); - LightModelf = reinterpret_cast(resolveFunc("glLightModelf")); - Lightiv = reinterpret_cast(resolveFunc("glLightiv")); - Lighti = reinterpret_cast(resolveFunc("glLighti")); - Lightfv = reinterpret_cast(resolveFunc("glLightfv")); - Lightf = reinterpret_cast(resolveFunc("glLightf")); - Fogiv = reinterpret_cast(resolveFunc("glFogiv")); - Fogi = reinterpret_cast(resolveFunc("glFogi")); - Fogfv = reinterpret_cast(resolveFunc("glFogfv")); - Fogf = reinterpret_cast(resolveFunc("glFogf")); - ColorMaterial = reinterpret_cast(resolveFunc("glColorMaterial")); - ClipPlane = reinterpret_cast(resolveFunc("glClipPlane")); - Vertex4sv = reinterpret_cast(resolveFunc("glVertex4sv")); - Vertex4s = reinterpret_cast(resolveFunc("glVertex4s")); - Vertex4iv = reinterpret_cast(resolveFunc("glVertex4iv")); - Vertex4i = reinterpret_cast(resolveFunc("glVertex4i")); - Vertex4fv = reinterpret_cast(resolveFunc("glVertex4fv")); - Vertex4f = reinterpret_cast(resolveFunc("glVertex4f")); - Vertex4dv = reinterpret_cast(resolveFunc("glVertex4dv")); - Vertex4d = reinterpret_cast(resolveFunc("glVertex4d")); - Vertex3sv = reinterpret_cast(resolveFunc("glVertex3sv")); - Vertex3s = reinterpret_cast(resolveFunc("glVertex3s")); - Vertex3iv = reinterpret_cast(resolveFunc("glVertex3iv")); - Vertex3i = reinterpret_cast(resolveFunc("glVertex3i")); - Vertex3fv = reinterpret_cast(resolveFunc("glVertex3fv")); - Vertex3f = reinterpret_cast(resolveFunc("glVertex3f")); - Vertex3dv = reinterpret_cast(resolveFunc("glVertex3dv")); - Vertex3d = reinterpret_cast(resolveFunc("glVertex3d")); - Vertex2sv = reinterpret_cast(resolveFunc("glVertex2sv")); - Vertex2s = reinterpret_cast(resolveFunc("glVertex2s")); - Vertex2iv = reinterpret_cast(resolveFunc("glVertex2iv")); - Vertex2i = reinterpret_cast(resolveFunc("glVertex2i")); - Vertex2fv = reinterpret_cast(resolveFunc("glVertex2fv")); - Vertex2f = reinterpret_cast(resolveFunc("glVertex2f")); - Vertex2dv = reinterpret_cast(resolveFunc("glVertex2dv")); - Vertex2d = reinterpret_cast(resolveFunc("glVertex2d")); - TexCoord4sv = reinterpret_cast(resolveFunc("glTexCoord4sv")); - TexCoord4s = reinterpret_cast(resolveFunc("glTexCoord4s")); - TexCoord4iv = reinterpret_cast(resolveFunc("glTexCoord4iv")); - TexCoord4i = reinterpret_cast(resolveFunc("glTexCoord4i")); - TexCoord4fv = reinterpret_cast(resolveFunc("glTexCoord4fv")); - TexCoord4f = reinterpret_cast(resolveFunc("glTexCoord4f")); - TexCoord4dv = reinterpret_cast(resolveFunc("glTexCoord4dv")); - TexCoord4d = reinterpret_cast(resolveFunc("glTexCoord4d")); - TexCoord3sv = reinterpret_cast(resolveFunc("glTexCoord3sv")); - TexCoord3s = reinterpret_cast(resolveFunc("glTexCoord3s")); - TexCoord3iv = reinterpret_cast(resolveFunc("glTexCoord3iv")); - TexCoord3i = reinterpret_cast(resolveFunc("glTexCoord3i")); - TexCoord3fv = reinterpret_cast(resolveFunc("glTexCoord3fv")); - TexCoord3f = reinterpret_cast(resolveFunc("glTexCoord3f")); - TexCoord3dv = reinterpret_cast(resolveFunc("glTexCoord3dv")); - TexCoord3d = reinterpret_cast(resolveFunc("glTexCoord3d")); - TexCoord2sv = reinterpret_cast(resolveFunc("glTexCoord2sv")); - TexCoord2s = reinterpret_cast(resolveFunc("glTexCoord2s")); - TexCoord2iv = reinterpret_cast(resolveFunc("glTexCoord2iv")); - TexCoord2i = reinterpret_cast(resolveFunc("glTexCoord2i")); - TexCoord2fv = reinterpret_cast(resolveFunc("glTexCoord2fv")); - TexCoord2f = reinterpret_cast(resolveFunc("glTexCoord2f")); - TexCoord2dv = reinterpret_cast(resolveFunc("glTexCoord2dv")); - TexCoord2d = reinterpret_cast(resolveFunc("glTexCoord2d")); - TexCoord1sv = reinterpret_cast(resolveFunc("glTexCoord1sv")); - TexCoord1s = reinterpret_cast(resolveFunc("glTexCoord1s")); - TexCoord1iv = reinterpret_cast(resolveFunc("glTexCoord1iv")); - TexCoord1i = reinterpret_cast(resolveFunc("glTexCoord1i")); - TexCoord1fv = reinterpret_cast(resolveFunc("glTexCoord1fv")); - TexCoord1f = reinterpret_cast(resolveFunc("glTexCoord1f")); - TexCoord1dv = reinterpret_cast(resolveFunc("glTexCoord1dv")); - TexCoord1d = reinterpret_cast(resolveFunc("glTexCoord1d")); - Rectsv = reinterpret_cast(resolveFunc("glRectsv")); - Rects = reinterpret_cast(resolveFunc("glRects")); - Rectiv = reinterpret_cast(resolveFunc("glRectiv")); - Recti = reinterpret_cast(resolveFunc("glRecti")); - Rectfv = reinterpret_cast(resolveFunc("glRectfv")); - Rectf = reinterpret_cast(resolveFunc("glRectf")); - Rectdv = reinterpret_cast(resolveFunc("glRectdv")); - Rectd = reinterpret_cast(resolveFunc("glRectd")); - RasterPos4sv = reinterpret_cast(resolveFunc("glRasterPos4sv")); - RasterPos4s = reinterpret_cast(resolveFunc("glRasterPos4s")); - RasterPos4iv = reinterpret_cast(resolveFunc("glRasterPos4iv")); - RasterPos4i = reinterpret_cast(resolveFunc("glRasterPos4i")); - RasterPos4fv = reinterpret_cast(resolveFunc("glRasterPos4fv")); - RasterPos4f = reinterpret_cast(resolveFunc("glRasterPos4f")); - RasterPos4dv = reinterpret_cast(resolveFunc("glRasterPos4dv")); - RasterPos4d = reinterpret_cast(resolveFunc("glRasterPos4d")); - RasterPos3sv = reinterpret_cast(resolveFunc("glRasterPos3sv")); - RasterPos3s = reinterpret_cast(resolveFunc("glRasterPos3s")); - RasterPos3iv = reinterpret_cast(resolveFunc("glRasterPos3iv")); - RasterPos3i = reinterpret_cast(resolveFunc("glRasterPos3i")); - RasterPos3fv = reinterpret_cast(resolveFunc("glRasterPos3fv")); - RasterPos3f = reinterpret_cast(resolveFunc("glRasterPos3f")); - RasterPos3dv = reinterpret_cast(resolveFunc("glRasterPos3dv")); - RasterPos3d = reinterpret_cast(resolveFunc("glRasterPos3d")); - RasterPos2sv = reinterpret_cast(resolveFunc("glRasterPos2sv")); - RasterPos2s = reinterpret_cast(resolveFunc("glRasterPos2s")); - RasterPos2iv = reinterpret_cast(resolveFunc("glRasterPos2iv")); - RasterPos2i = reinterpret_cast(resolveFunc("glRasterPos2i")); - RasterPos2fv = reinterpret_cast(resolveFunc("glRasterPos2fv")); - RasterPos2f = reinterpret_cast(resolveFunc("glRasterPos2f")); - RasterPos2dv = reinterpret_cast(resolveFunc("glRasterPos2dv")); - RasterPos2d = reinterpret_cast(resolveFunc("glRasterPos2d")); - Normal3sv = reinterpret_cast(resolveFunc("glNormal3sv")); - Normal3s = reinterpret_cast(resolveFunc("glNormal3s")); - Normal3iv = reinterpret_cast(resolveFunc("glNormal3iv")); - Normal3i = reinterpret_cast(resolveFunc("glNormal3i")); - Normal3fv = reinterpret_cast(resolveFunc("glNormal3fv")); - Normal3f = reinterpret_cast(resolveFunc("glNormal3f")); - Normal3dv = reinterpret_cast(resolveFunc("glNormal3dv")); - Normal3d = reinterpret_cast(resolveFunc("glNormal3d")); - Normal3bv = reinterpret_cast(resolveFunc("glNormal3bv")); - Normal3b = reinterpret_cast(resolveFunc("glNormal3b")); - Indexsv = reinterpret_cast(resolveFunc("glIndexsv")); - Indexs = reinterpret_cast(resolveFunc("glIndexs")); - Indexiv = reinterpret_cast(resolveFunc("glIndexiv")); - Indexi = reinterpret_cast(resolveFunc("glIndexi")); - Indexfv = reinterpret_cast(resolveFunc("glIndexfv")); - Indexf = reinterpret_cast(resolveFunc("glIndexf")); - Indexdv = reinterpret_cast(resolveFunc("glIndexdv")); - Indexd = reinterpret_cast(resolveFunc("glIndexd")); - End = reinterpret_cast(resolveFunc("glEnd")); - EdgeFlagv = reinterpret_cast(resolveFunc("glEdgeFlagv")); - EdgeFlag = reinterpret_cast(resolveFunc("glEdgeFlag")); - Color4usv = reinterpret_cast(resolveFunc("glColor4usv")); - Color4us = reinterpret_cast(resolveFunc("glColor4us")); - Color4uiv = reinterpret_cast(resolveFunc("glColor4uiv")); - Color4ui = reinterpret_cast(resolveFunc("glColor4ui")); - Color4ubv = reinterpret_cast(resolveFunc("glColor4ubv")); - Color4ub = reinterpret_cast(resolveFunc("glColor4ub")); - Color4sv = reinterpret_cast(resolveFunc("glColor4sv")); - Color4s = reinterpret_cast(resolveFunc("glColor4s")); - Color4iv = reinterpret_cast(resolveFunc("glColor4iv")); - Color4i = reinterpret_cast(resolveFunc("glColor4i")); - Color4fv = reinterpret_cast(resolveFunc("glColor4fv")); - Color4f = reinterpret_cast(resolveFunc("glColor4f")); - Color4dv = reinterpret_cast(resolveFunc("glColor4dv")); - Color4d = reinterpret_cast(resolveFunc("glColor4d")); - Color4bv = reinterpret_cast(resolveFunc("glColor4bv")); - Color4b = reinterpret_cast(resolveFunc("glColor4b")); - Color3usv = reinterpret_cast(resolveFunc("glColor3usv")); - Color3us = reinterpret_cast(resolveFunc("glColor3us")); - Color3uiv = reinterpret_cast(resolveFunc("glColor3uiv")); - Color3ui = reinterpret_cast(resolveFunc("glColor3ui")); - Color3ubv = reinterpret_cast(resolveFunc("glColor3ubv")); - Color3ub = reinterpret_cast(resolveFunc("glColor3ub")); - Color3sv = reinterpret_cast(resolveFunc("glColor3sv")); - Color3s = reinterpret_cast(resolveFunc("glColor3s")); - Color3iv = reinterpret_cast(resolveFunc("glColor3iv")); - Color3i = reinterpret_cast(resolveFunc("glColor3i")); - Color3fv = reinterpret_cast(resolveFunc("glColor3fv")); - Color3f = reinterpret_cast(resolveFunc("glColor3f")); - Color3dv = reinterpret_cast(resolveFunc("glColor3dv")); - Color3d = reinterpret_cast(resolveFunc("glColor3d")); - Color3bv = reinterpret_cast(resolveFunc("glColor3bv")); - Color3b = reinterpret_cast(resolveFunc("glColor3b")); - Bitmap = reinterpret_cast(resolveFunc("glBitmap")); - Begin = reinterpret_cast(resolveFunc("glBegin")); - ListBase = reinterpret_cast(resolveFunc("glListBase")); - GenLists = reinterpret_cast(resolveFunc("glGenLists")); - DeleteLists = reinterpret_cast(resolveFunc("glDeleteLists")); - CallLists = reinterpret_cast(resolveFunc("glCallLists")); - CallList = reinterpret_cast(resolveFunc("glCallList")); - EndList = reinterpret_cast(resolveFunc("glEndList")); - NewList = reinterpret_cast(resolveFunc("glNewList")); - - Indexubv = reinterpret_cast(resolveFunc("glIndexubv")); - Indexub = reinterpret_cast(resolveFunc("glIndexub")); - TexSubImage1D = reinterpret_cast(resolveFunc("glTexSubImage1D")); - CopyTexSubImage1D = reinterpret_cast(resolveFunc("glCopyTexSubImage1D")); - CopyTexImage1D = reinterpret_cast(resolveFunc("glCopyTexImage1D")); - GetPointerv = reinterpret_cast(resolveFunc("glGetPointerv")); - - PushClientAttrib = reinterpret_cast(resolveFunc("glPushClientAttrib")); - PopClientAttrib = reinterpret_cast(resolveFunc("glPopClientAttrib")); - PrioritizeTextures = reinterpret_cast(resolveFunc("glPrioritizeTextures")); - AreTexturesResident = reinterpret_cast(resolveFunc("glAreTexturesResident")); - VertexPointer = reinterpret_cast(resolveFunc("glVertexPointer")); - TexCoordPointer = reinterpret_cast(resolveFunc("glTexCoordPointer")); - NormalPointer = reinterpret_cast(resolveFunc("glNormalPointer")); - InterleavedArrays = reinterpret_cast(resolveFunc("glInterleavedArrays")); - IndexPointer = reinterpret_cast(resolveFunc("glIndexPointer")); - EnableClientState = reinterpret_cast(resolveFunc("glEnableClientState")); - EdgeFlagPointer = reinterpret_cast(resolveFunc("glEdgeFlagPointer")); - DisableClientState = reinterpret_cast(resolveFunc("glDisableClientState")); - ColorPointer = reinterpret_cast(resolveFunc("glColorPointer")); - ArrayElement = reinterpret_cast(resolveFunc("glArrayElement")); -} - -void QWindowsOpenGL::resolveGLES2() -{ - ActiveTexture = reinterpret_cast(resolveFunc("glActiveTexture")); - AttachShader = reinterpret_cast(resolveFunc("glAttachShader")); - BindAttribLocation = reinterpret_cast(resolveFunc("glBindAttribLocation")); - BindBuffer = reinterpret_cast(resolveFunc("glBindBuffer")); - BindFramebuffer = reinterpret_cast(resolveFunc("glBindFramebuffer")); - BindRenderbuffer = reinterpret_cast(resolveFunc("glBindRenderbuffer")); - BlendColor = reinterpret_cast(resolveFunc("glBlendColor")); - BlendEquation = reinterpret_cast(resolveFunc("glBlendEquation")); - BlendEquationSeparate = reinterpret_cast(resolveFunc("glBlendEquationSeparate")); - BlendFuncSeparate = reinterpret_cast(resolveFunc("glBlendFuncSeparate")); - BufferData = reinterpret_cast(resolveFunc("glBufferData")); - BufferSubData = reinterpret_cast(resolveFunc("glBufferSubData")); - CheckFramebufferStatus = reinterpret_cast(resolveFunc("glCheckFramebufferStatus")); - ClearDepthf = reinterpret_cast(resolveFunc("glClearDepthf")); - CompileShader = reinterpret_cast(resolveFunc("glCompileShader")); - CompressedTexImage2D = reinterpret_cast(resolveFunc("glCompressedTexImage2D")); - CompressedTexSubImage2D = reinterpret_cast(resolveFunc("glCompressedTexSubImage2D")); - CreateProgram = reinterpret_cast(resolveFunc("glCreateProgram")); - CreateShader = reinterpret_cast(resolveFunc("glCreateShader")); - DeleteBuffers = reinterpret_cast(resolveFunc("glDeleteBuffers")); - DeleteFramebuffers = reinterpret_cast(resolveFunc("glDeleteFramebuffers")); - DeleteProgram = reinterpret_cast(resolveFunc("glDeleteProgram")); - DeleteRenderbuffers = reinterpret_cast(resolveFunc("glDeleteRenderbuffers")); - DeleteShader = reinterpret_cast(resolveFunc("glDeleteShader")); - DepthRangef = reinterpret_cast(resolveFunc("glDepthRangef")); - DetachShader = reinterpret_cast(resolveFunc("glDetachShader")); - DisableVertexAttribArray = reinterpret_cast(resolveFunc("glDisableVertexAttribArray")); - EnableVertexAttribArray = reinterpret_cast(resolveFunc("glEnableVertexAttribArray")); - FramebufferRenderbuffer = reinterpret_cast(resolveFunc("glFramebufferRenderbuffer")); - FramebufferTexture2D = reinterpret_cast(resolveFunc("glFramebufferTexture2D")); - GenBuffers = reinterpret_cast(resolveFunc("glGenBuffers")); - GenerateMipmap = reinterpret_cast(resolveFunc("glGenerateMipmap")); - GenFramebuffers = reinterpret_cast(resolveFunc("glGenFramebuffers")); - GenRenderbuffers = reinterpret_cast(resolveFunc("glGenRenderbuffers")); - GetActiveAttrib = reinterpret_cast(resolveFunc("glGetActiveAttrib")); - GetActiveUniform = reinterpret_cast(resolveFunc("glGetActiveUniform")); - GetAttachedShaders = reinterpret_cast(resolveFunc("glGetAttachedShaders")); - GetAttribLocation = reinterpret_cast(resolveFunc("glGetAttribLocation")); - GetBufferParameteriv = reinterpret_cast(resolveFunc("glGetBufferParameteriv")); - GetFramebufferAttachmentParameteriv = reinterpret_cast(resolveFunc("glGetFramebufferAttachmentParameteriv")); - GetProgramiv = reinterpret_cast(resolveFunc("glGetProgramiv")); - GetProgramInfoLog = reinterpret_cast(resolveFunc("glGetProgramInfoLog")); - GetRenderbufferParameteriv = reinterpret_cast(resolveFunc("glGetRenderbufferParameteriv")); - GetShaderiv = reinterpret_cast(resolveFunc("glGetShaderiv")); - GetShaderInfoLog = reinterpret_cast(resolveFunc("glGetShaderInfoLog")); - GetShaderPrecisionFormat = reinterpret_cast(resolveFunc("glGetShaderPrecisionFormat")); - GetShaderSource = reinterpret_cast(resolveFunc("glGetShaderSource")); - GetUniformfv = reinterpret_cast(resolveFunc("glGetUniformfv")); - GetUniformiv = reinterpret_cast(resolveFunc("glGetUniformiv")); - GetUniformLocation = reinterpret_cast(resolveFunc("glGetUniformLocation")); - GetVertexAttribfv = reinterpret_cast(resolveFunc("glGetVertexAttribfv")); - GetVertexAttribiv = reinterpret_cast(resolveFunc("glGetVertexAttribiv")); - GetVertexAttribPointerv = reinterpret_cast(resolveFunc("glGetVertexAttribPointerv")); - IsBuffer = reinterpret_cast(resolveFunc("glIsBuffer")); - IsFramebuffer = reinterpret_cast(resolveFunc("glIsFramebuffer")); - IsProgram = reinterpret_cast(resolveFunc("glIsProgram")); - IsRenderbuffer = reinterpret_cast(resolveFunc("glIsRenderbuffer")); - IsShader = reinterpret_cast(resolveFunc("glIsShader")); - LinkProgram = reinterpret_cast(resolveFunc("glLinkProgram")); - ReleaseShaderCompiler = reinterpret_cast(resolveFunc("glReleaseShaderCompiler")); - RenderbufferStorage = reinterpret_cast(resolveFunc("glRenderbufferStorage")); - SampleCoverage = reinterpret_cast(resolveFunc("glSampleCoverage")); - ShaderBinary = reinterpret_cast(resolveFunc("glShaderBinary")); - ShaderSource = reinterpret_cast(resolveFunc("glShaderSource")); - StencilFuncSeparate = reinterpret_cast(resolveFunc("glStencilFuncSeparate")); - StencilMaskSeparate = reinterpret_cast(resolveFunc("glStencilMaskSeparate")); - StencilOpSeparate = reinterpret_cast(resolveFunc("glStencilOpSeparate")); - Uniform1f = reinterpret_cast(resolveFunc("glUniform1f")); - Uniform1fv = reinterpret_cast(resolveFunc("glUniform1fv")); - Uniform1i = reinterpret_cast(resolveFunc("glUniform1i")); - Uniform1iv = reinterpret_cast(resolveFunc("glUniform1iv")); - Uniform2f = reinterpret_cast(resolveFunc("glUniform2f")); - Uniform2fv = reinterpret_cast(resolveFunc("glUniform2fv")); - Uniform2i = reinterpret_cast(resolveFunc("glUniform2i")); - Uniform2iv = reinterpret_cast(resolveFunc("glUniform2iv")); - Uniform3f = reinterpret_cast(resolveFunc("glUniform3f")); - Uniform3fv = reinterpret_cast(resolveFunc("glUniform3fv")); - Uniform3i = reinterpret_cast(resolveFunc("glUniform3i")); - Uniform3iv = reinterpret_cast(resolveFunc("glUniform3iv")); - Uniform4f = reinterpret_cast(resolveFunc("glUniform4f")); - Uniform4fv = reinterpret_cast(resolveFunc("glUniform4fv")); - Uniform4i = reinterpret_cast(resolveFunc("glUniform4i")); - Uniform4iv = reinterpret_cast(resolveFunc("glUniform4iv")); - UniformMatrix2fv = reinterpret_cast(resolveFunc("glUniformMatrix2fv")); - UniformMatrix3fv = reinterpret_cast(resolveFunc("glUniformMatrix3fv")); - UniformMatrix4fv = reinterpret_cast(resolveFunc("glUniformMatrix4fv")); - UseProgram = reinterpret_cast(resolveFunc("glUseProgram")); - ValidateProgram = reinterpret_cast(resolveFunc("glValidateProgram")); - VertexAttrib1f = reinterpret_cast(resolveFunc("glVertexAttrib1f")); - VertexAttrib1fv = reinterpret_cast(resolveFunc("glVertexAttrib1fv")); - VertexAttrib2f = reinterpret_cast(resolveFunc("glVertexAttrib2f")); - VertexAttrib2fv = reinterpret_cast(resolveFunc("glVertexAttrib2fv")); - VertexAttrib3f = reinterpret_cast(resolveFunc("glVertexAttrib3f")); - VertexAttrib3fv = reinterpret_cast(resolveFunc("glVertexAttrib3fv")); - VertexAttrib4f = reinterpret_cast(resolveFunc("glVertexAttrib4f")); - VertexAttrib4fv = reinterpret_cast(resolveFunc("glVertexAttrib4fv")); - VertexAttribPointer = reinterpret_cast(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(::GetProcAddress(lib, "wglCreateContext")); - if (!CreateContext) - goto cleanup; - DeleteContext = reinterpret_cast(::GetProcAddress(lib, "wglDeleteContext")); - if (!DeleteContext) - goto cleanup; - MakeCurrent = reinterpret_cast(::GetProcAddress(lib, "wglMakeCurrent")); - if (!MakeCurrent) - goto cleanup; - WGL_GetProcAddress = reinterpret_cast(::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 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..08930b558e 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(4, 0)) { d->tessellationFuncs = context->versionFunctions(); d->tessellationFuncs->initializeOpenGLFunctions(); @@ -3273,7 +3273,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(3, 2)); #else // No geometry shader support in OpenGL ES2 @@ -3281,7 +3281,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(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..901c564a8b 100644 --- a/src/gui/opengl/qopengltexture.cpp +++ b/src/gui/opengl/qopengltexture.cpp @@ -2430,7 +2430,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 +2487,7 @@ bool QOpenGLTexture::hasFeature(Feature feature) } } - if (QOpenGLFunctions::isES()) + if (ctx->isES()) #endif { switch (feature) { @@ -2522,7 +2522,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 +2559,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 +2596,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); @@ -2706,7 +2706,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); @@ -2733,7 +2733,7 @@ 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 +2782,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); @@ -2972,7 +2972,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); @@ -3000,7 +3000,7 @@ void QOpenGLTexture::setBorderColor(QColor color) 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); @@ -3031,7 +3031,7 @@ void QOpenGLTexture::setBorderColor(float r, float g, float b, float a) 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); @@ -3064,7 +3064,7 @@ void QOpenGLTexture::setBorderColor(int r, int g, int b, int a) 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); @@ -3170,7 +3170,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 +3207,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); @@ -3243,7 +3243,7 @@ float QOpenGLTexture::maximumLevelOfDetail() const 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); @@ -3282,7 +3282,7 @@ QPair 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/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp index 356f68b49b..92eb9be80c 100644 --- a/src/gui/opengl/qopengltextureglyphcache.cpp +++ b/src/gui/opengl/qopengltextureglyphcache.cpp @@ -378,7 +378,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) { @@ -396,7 +396,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]); } @@ -409,7 +409,7 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed #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 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 -#include 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(context->getProcAddress(QByteArrayLiteral("glTextureParameteriEXT"))); TextureParameterivEXT = reinterpret_cast(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(context->getProcAddress(QByteArrayLiteral("glTextureImage3DMultisampleNV"))); TextureImage2DMultisampleNV = reinterpret_cast(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(QOpenGLFunctions::platformGLHandle()); + HMODULE handle = static_cast(QOpenGLContext::openGLModuleHandle()); if (!handle) handle = GetModuleHandleA("opengl32.dll"); @@ -191,7 +190,7 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context) TexSubImage1D = reinterpret_cast(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(context->getProcAddress(QByteArrayLiteral("glTexImage3DOES"))); TexSubImage3D = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glTexSubImage3DOES"))); CompressedTexImage3D = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glCompressedTexImage3DOES"))); diff --git a/src/gui/opengl/qopengltimerquery.cpp b/src/gui/opengl/qopengltimerquery.cpp index c756e3f527..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); 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(context->getProcAddress(QByteArrayLiteral("glGenVertexArraysOES"))); DeleteVertexArrays = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glDeleteVertexArraysOES"))); BindVertexArray = reinterpret_cast(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/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp index 15459dd748..b4ea8e4842 100644 --- a/src/gui/painting/qplatformbackingstore.cpp +++ b/src/gui/painting/qplatformbackingstore.cpp @@ -286,7 +286,7 @@ GLuint QPlatformBackingStore::toTexture(const QRegion &dirtyRegion) const glGenTextures(1, &d_ptr->textureId); glBindTexture(GL_TEXTURE_2D, d_ptr->textureId); #ifndef QT_OPENGL_ES_2 - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); } diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp index 394eb99307..56f3f5ad0a 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp @@ -163,7 +163,7 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) code[NonPremultipliedImageSrcFragmentShader] = qglslNonPremultipliedImageSrcFragmentShader; code[CustomImageSrcFragmentShader] = qglslCustomSrcFragmentShader; // Calls "customShader", which must be appended code[SolidBrushSrcFragmentShader] = qglslSolidBrushSrcFragmentShader; - if (!QOpenGLFunctions::isES()) + if (!context->contextHandle()->isES()) code[TextureBrushSrcFragmentShader] = qglslTextureBrushSrcFragmentShader_desktop; else code[TextureBrushSrcFragmentShader] = qglslTextureBrushSrcFragmentShader_ES; diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index b8c039d0e2..fd64a4a71f 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -539,7 +539,7 @@ void QGL2PaintEngineEx::beginNativePainting() d->funcs.glDisableVertexAttribArray(i); #ifndef QT_OPENGL_ES_2 - if (!QOpenGLFunctions::isES()) { + if (!d->ctx->contextHandle()->isES()) { const QGLContext *ctx = d->ctx; const QGLFormat &fmt = d->device->format(); if (fmt.majorVersion() < 3 || (fmt.majorVersion() == 3 && fmt.minorVersion() < 1) @@ -597,7 +597,7 @@ void QGL2PaintEngineExPrivate::resetGLState() ctx->d_func()->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, false); ctx->d_func()->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false); #ifndef QT_OPENGL_ES_2 - if (!QOpenGLFunctions::isES()) { + if (!ctx->contextHandle()->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); @@ -1353,10 +1353,11 @@ void QGL2PaintEngineEx::compositionModeChanged() void QGL2PaintEngineEx::renderHintsChanged() { + Q_D(QGL2PaintEngineEx); state()->renderHintsChanged = true; #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (!d->ctx->contextHandle()->isES()) { if ((state()->renderHints & QPainter::Antialiasing) || (state()->renderHints & QPainter::HighQualityAntialiasing)) glEnable(GL_MULTISAMPLE); @@ -1365,7 +1366,6 @@ void QGL2PaintEngineEx::renderHintsChanged() } #endif - Q_D(QGL2PaintEngineEx); d->lastTextureUsed = GLuint(-1); d->brushTextureDirty = true; // qDebug("QGL2PaintEngineEx::renderHintsChanged() not implemented!"); @@ -2032,14 +2032,14 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) glDisable(GL_SCISSOR_TEST); #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) + if (!d->ctx->contextHandle()->isES()) glDisable(GL_MULTISAMPLE); #endif d->glyphCacheFormat = QFontEngine::Format_A8; #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (!d->ctx->contextHandle()->isES()) { d->glyphCacheFormat = QFontEngine::Format_A32; d->multisamplingAlwaysEnabled = false; } else { diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index f9f2670375..b1e289254f 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -319,7 +319,7 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed sub uchar g = src[x] >> 8; uchar b = src[x]; quint32 avg = (quint32(r) + quint32(g) + quint32(b) + 1) / 3; // "+1" for rounding. - if (QOpenGLFunctions::isES()) { + if (ctx->contextHandle()->isES()) { // swizzle the bits to accommodate for the GL_RGBA upload. src[x] = (avg << 24) | (quint32(r) << 0) | (quint32(g) << 8) | (quint32(b) << 16); } else { @@ -333,7 +333,7 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed sub if (mask.format() == QImage::Format_RGB32) { GLenum format = GL_RGBA; #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) + if (!ctx->contextHandle()->isES()) format = GL_BGRA; #endif glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, format, GL_UNSIGNED_BYTE, mask.bits()); diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index e027de02e0..1bdc9b84e0 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1700,7 +1700,7 @@ QImage qt_gl_read_texture(const QSize &size, bool alpha_format, bool include_alp int w = size.width(); int h = size.height(); #ifndef QT_OPENGL_ES - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { //### glGetTexImage not in GL ES 2.0, need to do something else here! glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, img.bits()); } @@ -2284,7 +2284,8 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G glBindTexture(target, tx_id); glTexParameteri(target, GL_TEXTURE_MAG_FILTER, filtering); - bool genMipmap = !QOpenGLFunctions::isES(); + QOpenGLContext *ctx = QOpenGLContext::currentContext(); + bool genMipmap = !ctx->isES(); if (glFormat.directRendering() && (qgl_extensions()->hasOpenGLExtension(QOpenGLExtensions::GenerateMipmap)) && target == GL_TEXTURE_2D @@ -2426,7 +2427,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G printf(" - did byte swapping (%d ms)\n", time.elapsed()); #endif } - if (QOpenGLFunctions::isES()) { + if (ctx->isES()) { // OpenGL/ES requires that the internal and external formats be // identical. internalFormat = externalFormat; @@ -2439,7 +2440,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G const QImage &constRef = img; // to avoid detach in bits()... glTexImage2D(target, 0, internalFormat, img.width(), img.height(), 0, externalFormat, pixel_type, constRef.bits()); - if (genMipmap && QOpenGLFunctions::isES()) + if (genMipmap && ctx->isES()) functions->glGenerateMipmap(target); #ifndef QT_NO_DEBUG GLenum error = glGetError(); @@ -2516,13 +2517,15 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, /*! \internal */ int QGLContextPrivate::maxTextureSize() { + Q_Q(QGLContext); + if (max_texture_size != -1) return max_texture_size; glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size); #ifndef QT_OPENGL_ES - if (!QOpenGLFunctions::isES()) { + if (!q->contextHandle()->isES()) { GLenum proxy = GL_PROXY_TEXTURE_2D; GLint size; @@ -2700,7 +2703,7 @@ static void qDrawTextureRect(const QRectF &target, GLint textureWidth, GLint tex Q_UNUSED(textureHeight); Q_UNUSED(textureTarget); #else - if (textureTarget != GL_TEXTURE_2D && !QOpenGLFunctions::isES()) { + if (textureTarget != GL_TEXTURE_2D && !QOpenGLContext::currentContext()->isES()) { if (textureWidth == -1 || textureHeight == -1) { glGetTexLevelParameteriv(textureTarget, 0, GL_TEXTURE_WIDTH, &textureWidth); glGetTexLevelParameteriv(textureTarget, 0, GL_TEXTURE_HEIGHT, &textureHeight); @@ -2767,7 +2770,7 @@ void QGLContext::drawTexture(const QRectF &target, GLuint textureId, GLenum text #endif #ifndef QT_OPENGL_ES_2 - if (!QOpenGLFunctions::isES()) { + if (!contextHandle()->isES()) { #ifdef QT_OPENGL_ES if (textureTarget != GL_TEXTURE_2D) { qWarning("QGLContext::drawTexture(): texture target must be GL_TEXTURE_2D on OpenGL ES"); @@ -2829,7 +2832,7 @@ void QGLContext::drawTexture(const QPointF &point, GLuint textureId, GLenum text Q_UNUSED(textureId); Q_UNUSED(textureTarget); #else - if (!QOpenGLFunctions::isES()) { + if (!contextHandle()->isES()) { const bool wasEnabled = glIsEnabled(GL_TEXTURE_2D); GLint oldTexture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &oldTexture); @@ -4172,7 +4175,7 @@ void QGLWidget::glDraw() return; makeCurrent(); #ifndef QT_OPENGL_ES - if (d->glcx->deviceIsPixmap() && !QOpenGLFunctions::isES()) + if (d->glcx->deviceIsPixmap() && !d->glcx->contextHandle()->isES()) glDrawBuffer(GL_FRONT); #endif QSize readback_target_size = d->glcx->d_ptr->readback_target_size; @@ -4215,20 +4218,18 @@ void QGLWidget::qglColor(const QColor& c) const #ifdef QT_OPENGL_ES glColor4f(c.redF(), c.greenF(), c.blueF(), c.alphaF()); #else - if (!QOpenGLFunctions::isES()) { - Q_D(const QGLWidget); - const QGLContext *ctx = QGLContext::currentContext(); - if (ctx) { - if (ctx->format().rgba()) - glColor4f(c.redF(), c.greenF(), c.blueF(), c.alphaF()); - else if (!d->cmap.isEmpty()) { // QGLColormap in use? - int i = d->cmap.find(c.rgb()); - if (i < 0) - i = d->cmap.findNearest(c.rgb()); - glIndexi(i); - } else - glIndexi(ctx->colorIndex(c)); - } + Q_D(const QGLWidget); + const QGLContext *ctx = QGLContext::currentContext(); + if (ctx && !ctx->contextHandle()->isES()) { + if (ctx->format().rgba()) + glColor4f(c.redF(), c.greenF(), c.blueF(), c.alphaF()); + else if (!d->cmap.isEmpty()) { // QGLColormap in use? + int i = d->cmap.find(c.rgb()); + if (i < 0) + i = d->cmap.findNearest(c.rgb()); + glIndexi(i); + } else + glIndexi(ctx->colorIndex(c)); } #endif //QT_OPENGL_ES #else @@ -4249,20 +4250,18 @@ void QGLWidget::qglClearColor(const QColor& c) const #ifdef QT_OPENGL_ES glClearColor(c.redF(), c.greenF(), c.blueF(), c.alphaF()); #else - if (!QOpenGLFunctions::isES()) { - Q_D(const QGLWidget); - const QGLContext *ctx = QGLContext::currentContext(); - if (ctx) { - if (ctx->format().rgba()) - glClearColor(c.redF(), c.greenF(), c.blueF(), c.alphaF()); - else if (!d->cmap.isEmpty()) { // QGLColormap in use? - int i = d->cmap.find(c.rgb()); - if (i < 0) - i = d->cmap.findNearest(c.rgb()); - glClearIndex(i); - } else { - glClearIndex(ctx->colorIndex(c)); - } + Q_D(const QGLWidget); + const QGLContext *ctx = QGLContext::currentContext(); + if (ctx && !ctx->contextHandle()->isES()) { + if (ctx->format().rgba()) + glClearColor(c.redF(), c.greenF(), c.blueF(), c.alphaF()); + else if (!d->cmap.isEmpty()) { // QGLColormap in use? + int i = d->cmap.find(c.rgb()); + if (i < 0) + i = d->cmap.findNearest(c.rgb()); + glClearIndex(i); + } else { + glClearIndex(ctx->colorIndex(c)); } } else { glClearColor(c.redF(), c.greenF(), c.blueF(), c.alphaF()); @@ -4427,7 +4426,8 @@ static void qt_gl_draw_text(QPainter *p, int x, int y, const QString &str, void QGLWidget::renderText(int x, int y, const QString &str, const QFont &font) { #ifndef QT_OPENGL_ES - if (!QOpenGLFunctions::isES()) { + Q_D(QGLWidget); + if (!d->glcx->contextHandle()->isES()) { Q_D(QGLWidget); if (str.isEmpty() || !isValid()) return; @@ -4522,7 +4522,8 @@ void QGLWidget::renderText(int x, int y, const QString &str, const QFont &font) void QGLWidget::renderText(double x, double y, double z, const QString &str, const QFont &font) { #ifndef QT_OPENGL_ES - if (!QOpenGLFunctions::isES()) { + Q_D(QGLWidget); + if (!d->glcx->contextHandle()->isES()) { Q_D(QGLWidget); if (str.isEmpty() || !isValid()) return; diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index 4f4df8d2e4..fe4d1c363c 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -321,7 +321,7 @@ QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) d->context = new QOpenGLContext; #if !defined(QT_OPENGL_ES) - if (!QOpenGLFunctions::isES()) { + if (QOpenGLContext::openGLModuleType() == QOpenGLContext::DesktopGL) { // On desktop, request latest released version QSurfaceFormat format; #if defined(Q_OS_MAC) diff --git a/src/opengl/qglbuffer.cpp b/src/opengl/qglbuffer.cpp index 5491bad628..0bcb9d4f1f 100644 --- a/src/opengl/qglbuffer.cpp +++ b/src/opengl/qglbuffer.cpp @@ -344,7 +344,7 @@ void QGLBuffer::destroy() bool QGLBuffer::read(int offset, void *data, int count) { #if !defined(QT_OPENGL_ES) - if (QOpenGLFunctions::platformGLType() != QOpenGLFunctions::GLES1) { + if (QOpenGLContext::openGLModuleType() != QOpenGLContext::GLES1) { Q_D(QGLBuffer); if (!d->funcs->hasOpenGLFeature(QOpenGLFunctions::Buffers) || !d->guard->id()) return false; diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index b4821ccf61..d636da91b5 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -595,7 +595,7 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, GL_DEPTH_COMPONENT16, size.width(), size.height()); } #else - if (QOpenGLFunctions::isES()) { + if (ctx->contextHandle()->isES()) { if (funcs.hasOpenGLExtension(QOpenGLExtensions::Depth24)) funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, GL_DEPTH_COMPONENT24, size.width(), size.height()); @@ -617,7 +617,7 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, size.width(), size.height()); } #else - if (QOpenGLFunctions::isES()) { + if (ctx->contextHandle()->isES()) { if (funcs.hasOpenGLExtension(QOpenGLExtensions::Depth24)) { funcs.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, size.width(), size.height()); @@ -647,7 +647,7 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, #ifdef QT_OPENGL_ES GLenum storage = GL_STENCIL_INDEX8; #else - GLenum storage = QOpenGLFunctions::isES() ? GL_STENCIL_INDEX8 : GL_STENCIL_INDEX; + GLenum storage = ctx->contextHandle()->isES() ? GL_STENCIL_INDEX8 : GL_STENCIL_INDEX; #endif if (samples != 0 && funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)) @@ -849,7 +849,7 @@ QGLFramebufferObject::QGLFramebufferObject(const QSize &size, GLenum target) Q_D(QGLFramebufferObject); 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 @@ -869,7 +869,7 @@ QGLFramebufferObject::QGLFramebufferObject(int width, int height, GLenum target) Q_D(QGLFramebufferObject); 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 @@ -926,7 +926,7 @@ QGLFramebufferObject::QGLFramebufferObject(int width, int height, Attachment att #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); } @@ -953,7 +953,7 @@ QGLFramebufferObject::QGLFramebufferObject(const QSize &size, Attachment attachm #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); } diff --git a/src/opengl/qglframebufferobject_p.h b/src/opengl/qglframebufferobject_p.h index 3b36c5c2b6..0edce5da2f 100644 --- a/src/opengl/qglframebufferobject_p.h +++ b/src/opengl/qglframebufferobject_p.h @@ -71,7 +71,9 @@ public: mipmap(false) { #ifndef QT_OPENGL_ES_2 - internal_format = QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8; + 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/opengl/qglfunctions.cpp b/src/opengl/qglfunctions.cpp index e75f9cf915..7dc30d5319 100644 --- a/src/opengl/qglfunctions.cpp +++ b/src/opengl/qglfunctions.cpp @@ -213,7 +213,9 @@ QGLFunctions::QGLFunctions(const QGLContext *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 = QGLFunctions::Multitexture | QGLFunctions::Shaders | QGLFunctions::Buffers | @@ -232,7 +234,8 @@ static int qt_gl_resolve_features() if (extensions.match("GL_IMG_texture_npot")) features |= QGLFunctions::NPOTTextures; return features; - } if (QOpenGLFunctions::platformGLType() == QOpenGLFunctions::GLES1) { + } else if (ctx->isES()) { + // OpenGL ES 1 int features = QGLFunctions::Multitexture | QGLFunctions::Buffers | QGLFunctions::CompressedTextures | @@ -252,6 +255,7 @@ static int qt_gl_resolve_features() features |= QGLFunctions::NPOTTextures; return features; } else { + // OpenGL int features = 0; QGLFormat::OpenGLVersionFlags versions = QGLFormat::openGLVersionFlags(); QOpenGLExtensionMatcher extensions; diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp index 51e7648d72..32b18bfda4 100644 --- a/src/opengl/qglpixelbuffer.cpp +++ b/src/opengl/qglpixelbuffer.cpp @@ -361,7 +361,7 @@ void QGLPixelBuffer::updateDynamicTexture(GLuint texture_id) const glBindTexture(GL_TEXTURE_2D, texture_id); #ifndef QT_OPENGL_ES - GLenum format = QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8; + GLenum format = ctx->isES() ? GL_RGBA : GL_RGBA8; glCopyTexImage2D(GL_TEXTURE_2D, 0, format, 0, 0, d->req_size.width(), d->req_size.height(), 0); #else glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, d->req_size.width(), d->req_size.height(), 0); @@ -488,7 +488,7 @@ GLuint QGLPixelBuffer::bindTexture(const QImage &image, GLenum target) { Q_D(QGLPixelBuffer); #ifndef QT_OPENGL_ES - GLenum format = QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8; + GLenum format = QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8; return d->qctx->bindTexture(image, target, GLint(format)); #else return d->qctx->bindTexture(image, target, GL_RGBA); @@ -507,7 +507,7 @@ GLuint QGLPixelBuffer::bindTexture(const QPixmap &pixmap, GLenum target) { Q_D(QGLPixelBuffer); #ifndef QT_OPENGL_ES - GLenum format = QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8; + GLenum format = QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8; return d->qctx->bindTexture(pixmap, target, GLint(format)); #else return d->qctx->bindTexture(pixmap, target, GL_RGBA); diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index 6b8d38ef42..7261b68a88 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -248,7 +248,7 @@ bool QGLShaderPrivate::create() shader = glfuncs->glCreateShader(GL_VERTEX_SHADER); #if !defined(QT_OPENGL_ES_2) else if (shaderType == QGLShader::Geometry - && !QOpenGLFunctions::isES()) + && !context->contextHandle()->isES()) shader = glfuncs->glCreateShader(GL_GEOMETRY_SHADER_EXT); #endif else @@ -430,14 +430,14 @@ bool QGLShader::compileSourceCode(const char *source) srclen.append(GLint(headerLen)); } #ifdef QGL_DEFINE_QUALIFIERS - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { src.append(qualifierDefines); srclen.append(GLint(sizeof(qualifierDefines) - 1)); } #endif #ifdef QGL_REDEFINE_HIGHP if (d->shaderType == Fragment - && QOpenGLFunctions::isES()) { + && QOpenGLContext::currentContext()->isES()) { src.append(redefineHighp); srclen.append(GLint(sizeof(redefineHighp) - 1)); } @@ -567,8 +567,8 @@ public: void initializeGeometryShaderFunctions() { - if (!QOpenGLFunctions::isES()) { - QOpenGLContext *context = QOpenGLContext::currentContext(); + QOpenGLContext *context = QOpenGLContext::currentContext(); + if (!context->isES()) { glProgramParameteri = (type_glProgramParameteri) context->getProcAddress("glProgramParameteri"); @@ -936,7 +936,7 @@ bool QGLShaderProgram::link() #if !defined(QT_OPENGL_ES_2) // Set up the geometry shader parameters - if (!QOpenGLFunctions::isES() + if (!QOpenGLContext::currentContext()->isES() && d->glfuncs->glProgramParameteri) { foreach (QGLShader *shader, d->shaders) { if (shader->shaderType() & QGLShader::Geometry) { @@ -3068,7 +3068,7 @@ int QGLShaderProgram::maxGeometryOutputVertices() const { GLint n = 0; #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) + if (!QOpenGLContext::currentContext()->isES()) glGetIntegerv(GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT, &n); #endif return n; diff --git a/src/platformsupport/eglconvenience/qeglconvenience.cpp b/src/platformsupport/eglconvenience/qeglconvenience.cpp index a36d0b83d4..790467150f 100644 --- a/src/platformsupport/eglconvenience/qeglconvenience.cpp +++ b/src/platformsupport/eglconvenience/qeglconvenience.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include -#include +#include #ifdef Q_OS_LINUX #include @@ -245,9 +245,11 @@ EGLConfig QEglConfigChooser::chooseConfig() break; #ifdef EGL_VERSION_1_4 case QSurfaceFormat::DefaultRenderableType: - if (!QOpenGLFunctions::isES()) +#ifndef QT_NO_OPENGL + if (QOpenGLContext::openGLModuleType() == QOpenGLContext::DesktopGL) configureAttributes.append(EGL_OPENGL_BIT); else +#endif // QT_NO_OPENGL configureAttributes.append(EGL_OPENGL_ES2_BIT); break; case QSurfaceFormat::OpenGL: @@ -361,7 +363,9 @@ QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config, && (renderableType & EGL_OPENGL_BIT)) format.setRenderableType(QSurfaceFormat::OpenGL); else if (referenceFormat.renderableType() == QSurfaceFormat::DefaultRenderableType - && !QOpenGLFunctions::isES() +#ifndef QT_NO_OPENGL + && QOpenGLContext::openGLModuleType() == QOpenGLContext::DesktopGL +#endif && (renderableType & EGL_OPENGL_BIT)) format.setRenderableType(QSurfaceFormat::OpenGL); #endif diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp index 3a34748fc7..630c77fba0 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp +++ b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp @@ -42,7 +42,7 @@ #include "qeglplatformcontext_p.h" #include "qeglconvenience_p.h" #include -#include +#include QT_BEGIN_NAMESPACE @@ -71,9 +71,11 @@ static inline void bindApi(const QSurfaceFormat &format) break; #ifdef EGL_VERSION_1_4 case QSurfaceFormat::DefaultRenderableType: - if (!QOpenGLFunctions::isES()) +#ifndef QT_NO_OPENGL + if (QOpenGLContext::openGLModuleType() == QOpenGLContext::DesktopGL) eglBindAPI(EGL_OPENGL_API); else +#endif // QT_NO_OPENGL eglBindAPI(EGL_OPENGL_ES_API); break; case QSurfaceFormat::OpenGL: diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 2a7a275060..64a842d492 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -234,7 +234,8 @@ bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) co return true; case ThreadedOpenGL: #if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC) - return QOpenGLFunctions::isES() ? QWindowsEGLContext::hasThreadedOpenGLCapability() : true; + return QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL + ? QWindowsEGLContext::hasThreadedOpenGLCapability() : true; # else return true; # endif // QT_OPENGL_ES_2 @@ -298,7 +299,7 @@ QPlatformOpenGLContext { qCDebug(lcQpaGl) << __FUNCTION__ << context->format(); #if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC) - if (QOpenGLFunctions::isES()){ + if (QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL) { if (d->m_staticEGLContext.isNull()) { QWindowsEGLStaticContext *staticContext = QWindowsEGLStaticContext::create(); if (!staticContext) @@ -309,7 +310,7 @@ QPlatformOpenGLContext } #endif #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (QOpenGLContext::openGLModuleType() == QOpenGLContext::DesktopGL) { if (d->m_staticOpenGLContext.isNull()) d->m_staticOpenGLContext = QSharedPointer(QOpenGLStaticContext::create()); diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp index f6d01d7ef7..7e15be1d19 100644 --- a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp +++ b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp @@ -125,7 +125,7 @@ void *QWindowsNativeInterface::nativeResourceForContext(const QByteArray &resour return 0; } #if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC) - if (QOpenGLFunctions::isES()) { + if (QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL) { QWindowsEGLContext *windowsEglContext = static_cast(context->handle()); if (resource == QByteArrayLiteral("eglDisplay")) return windowsEglContext->eglDisplay(); @@ -136,7 +136,7 @@ void *QWindowsNativeInterface::nativeResourceForContext(const QByteArray &resour } #endif // QT_OPENGL_ES_2 || QT_OPENGL_DYNAMIC #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (QOpenGLContext::openGLModuleType() == QOpenGLContext::DesktopGL) { QWindowsGLContext *windowsContext = static_cast(context->handle()); if (resource == QByteArrayLiteral("renderingContext")) return windowsContext->renderingContext(); diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index d77f587b92..3cf9481c17 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -880,7 +880,7 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data) if (aWindow->surfaceType() == QWindow::OpenGLSurface) { setFlag(OpenGLSurface); #if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC) - if (QOpenGLFunctions::isES()) + if (QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL) setFlag(OpenGL_ES2); #endif } diff --git a/tests/auto/opengl/qgl/tst_qgl.cpp b/tests/auto/opengl/qgl/tst_qgl.cpp index 57128e4a82..718b5263bf 100644 --- a/tests/auto/opengl/qgl/tst_qgl.cpp +++ b/tests/auto/opengl/qgl/tst_qgl.cpp @@ -752,7 +752,7 @@ void tst_QGL::openGLVersionCheck() #elif defined(QT_OPENGL_ES_2) QVERIFY(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0); #else - if (QOpenGLFunctions::isES()) + if (QOpenGLContext::currentContext()->isES()) QVERIFY(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0); else QVERIFY(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_1); @@ -1534,7 +1534,7 @@ void tst_QGL::fboFormat() #ifdef QT_OPENGL_ES_2 GL_RGBA; #else - QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8; + QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL ? GL_RGBA : GL_RGBA8; #endif QCOMPARE(int(format1.internalTextureFormat()), expectedFormat); @@ -1611,7 +1611,7 @@ void tst_QGL::fboFormat() #ifdef QT_OPENGL_ES_2 GL_RGBA #else - QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8 + QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL ? GL_RGBA : GL_RGBA8 #endif ); QVERIFY(!(format1c == format3c)); @@ -1624,7 +1624,7 @@ void tst_QGL::fboFormat() #ifdef QT_OPENGL_ES_2 GL_RGBA #else - QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8 + QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL ? GL_RGBA : GL_RGBA8 #endif ); QVERIFY(!(format1c == format4c)); diff --git a/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp b/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp index fea3c7b643..cdd820cf5b 100644 --- a/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp +++ b/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp @@ -96,7 +96,7 @@ void tst_QGLFunctions::features() funcs.initializeGLFunctions(); // Validate the features against what we expect for this platform. - if (QOpenGLFunctions::isES()) { + if (QOpenGLContext::currentContext()->isES()) { #if !defined(QT_OPENGL_ES) || defined(QT_OPENGL_ES_2) QGLFunctions::OpenGLFeatures allFeatures = (QGLFunctions::Multitexture | diff --git a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp index 765dc221dc..63c6cb658b 100644 --- a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp +++ b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp @@ -333,7 +333,7 @@ static inline float qrandom() { return (rand() % 100) / 100.f; } void renderAScene(int w, int h) { - if (QOpenGLFunctions::isES()) { + if (QOpenGLContext::currentContext()->isES()) { QGLFunctions funcs(QGLContext::currentContext()); Q_UNUSED(w); Q_UNUSED(h); diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp index 5f4284e79a..ba9652a170 100644 --- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp @@ -59,6 +59,7 @@ #include #ifndef QT_NO_OPENGL #include +#include #endif #include @@ -2596,8 +2597,8 @@ void tst_QMdiArea::nativeSubWindows() const QString platformName = QGuiApplication::platformName(); if (platformName != QLatin1String("xcb") && platformName != QLatin1String("windows")) QSKIP(qPrintable(QString::fromLatin1("nativeSubWindows() does not work on this platform (%1).").arg(platformName))); -#ifdef Q_OS_WIN - if (QOpenGLFunctions::isES()) +#if defined(Q_OS_WIN) && !defined(QT_NO_OPENGL) + if (QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL) QSKIP("nativeSubWindows() does not work with ANGLE on Windows, QTBUG-28545."); #endif { // Add native widgets after show. -- cgit v1.2.3