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 --- src/gui/kernel/qopenglcontext.cpp | 76 +++++++++++++++++++++++++++++++++++++-- src/gui/kernel/qopenglcontext.h | 12 +++++++ 2 files changed, 85 insertions(+), 3 deletions(-) (limited to 'src/gui/kernel') 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(); -- cgit v1.2.3