summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@digia.com>2014-02-28 17:03:57 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-04 15:59:05 +0100
commit4b2f35d04ca3c2e037b4d0edd8b2350051cc572c (patch)
treeb6cf33e9cba3e55b11be748fa37fd44b09021b54 /src/gui/kernel
parentfe2ce05d23a52d27e50270d22eb9fff9ab091dd4 (diff)
Dynamic GL: remove exporting symbols
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 <Friedemann.Kleint@digia.com> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qopenglcontext.cpp76
-rw-r--r--src/gui/kernel/qopenglcontext.h12
2 files changed, 85 insertions, 3 deletions
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
@@ -960,6 +961,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
*/
QOpenGLVersionFunctionsBackend *QOpenGLContext::functionsBackend(const QOpenGLVersionStatus &v) const
diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h
index ce34a2d5a5..06a7b723b4 100644
--- a/src/gui/kernel/qopenglcontext.h
+++ b/src/gui/kernel/qopenglcontext.h
@@ -192,6 +192,18 @@ public:
QSet<QByteArray> extensions() const;
bool hasExtension(const QByteArray &extension) const;
+ static void *openGLModuleHandle();
+
+ enum OpenGLModuleType {
+ DesktopGL,
+ GLES2,
+ GLES1
+ };
+
+ static OpenGLModuleType openGLModuleType();
+
+ bool isES() const;
+
Q_SIGNALS:
void aboutToBeDestroyed();