diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-01-27 14:45:11 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-14 10:51:44 +0100 |
commit | 97c187da3c1381bc55dd16976bf9fb3c773d0047 (patch) | |
tree | a101467c838879b025bdfb4b5f7b18a6ad8b3033 /tests | |
parent | f25aca5c658b018e3b510990d82e7195d0c3b7c0 (diff) |
Dynamic GL switch on Windows
The patch introduces a new build configuration on Windows which
can be requested by passing -opengl dynamic to configure.
Platforms other than Windows (including WinRT) are not affected.
The existing Angle and desktop configurations are not affected.
These continue to function as before and Angle remains the default.
In the future, when all modules have added support for the dynamic
path, as described below, the default configuration could be changed
to be the dynamic one. This would allow providing a single set of
binaries in the official builds instead of the current two.
When requesting dynamic GL, Angle is built but QT_OPENGL_ES[_2] are
never defined. Instead, the code path that has traditionally been
desktop GL only becomes the dynamic path that has to do runtime
checks. Qt modules and applications are not linked to opengl32.dll or
libegl/glesv2.dll in this case. Instead, QtGui exports all necessary
egl/egl/gl functions which will, under the hood, forward all requests
to a dynamically loaded EGL/WGL/GL implementation.
Porting guide (better said, changes needed to prepare your code to
work with dynamic GL builds when the fallback to Angle is utilized):
1. In !QT_OPENGL_ES[_2] code branches use QOpenGLFunctions::isES() to
differentiate between desktop and ES where needed. Keep in mind that
it is the desktop GL header (plus qopenglext.h) that is included,
not the GLES one.
QtGui's proxy will handle some differences, for example calling
glClearDepth will route to glClearDepthf when needed. The built-in
eglGetProcAddress is able to retrieve pointers for standard GLES2
functions too so code resolving OpenGL 2 functions will function
in any case.
2. QT_CONFIG will contain "opengl" and "dynamicgl" in dynamic builds,
but never "angle" or "opengles2".
3. The preprocessor define QT_OPENGL_DYNAMIC is also available in
dynamic builds. The usage of this is strongly discouraged and should
not be needed anywhere except for QtGui and the platform plugin.
4. Code in need of the library handle can use
QOpenGLFunctions::platformGLHandle().
The decision on which library to load is currently based on a simple
test that creates a dummy window/context and tries to resolve an
OpenGL 2 function. If this fails, it goes for Angle. This seems to work
well on Win7 PCs for example that do not have proper graphics drivers
providing OpenGL installed but are D3D9 capable using the default drivers.
Setting QT_OPENGL to desktop or angle skips the test and forces
usage of the given GL. There are also two new application attributes
that could be used for the same purpose.
If Angle is requested but the libraries are not present, desktop is
tried. If desktop is requested, or if angle is requested but nothing
works, the EGL/WGL functions will still be callable but will return 0.
This conveniently means that eglInitialize() and such will report a failure.
Debug messages can be enabled by setting QT_OPENGLPROXY_DEBUG. This will
tell which implementation is chosen.
The textures example application is ported to OpenGL 2, the GL 1
code path is removed.
[ChangeLog][QtGui] Qt builds on Windows can now be configured for
dynamic loading of the OpenGL implementation. This can be requested
by passing -opengl dynamic to configure. In this mode no modules will
link to opengl32.dll or Angle's libegl/libglesv2. Instead, QtGui will
dynamically choose between desktop and Angle during the first GL/EGL/WGL
call. This allows deploying applications with a single set of Qt libraries
with the ability of transparently falling back to Angle in case the
opengl32.dll is not suitable, due to missing graphics drivers for example.
Task-number: QTBUG-36483
Change-Id: I716fdebbf60b355b7d9ef57d1e069eef366b4ab9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/opengl/qgl/tst_qgl.cpp | 36 | ||||
-rw-r--r-- | tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp | 182 | ||||
-rw-r--r-- | tests/auto/opengl/qglthreads/tst_qglthreads.cpp | 93 | ||||
-rw-r--r-- | tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp | 4 |
4 files changed, 168 insertions, 147 deletions
diff --git a/tests/auto/opengl/qgl/tst_qgl.cpp b/tests/auto/opengl/qgl/tst_qgl.cpp index 1ec1d88802..57128e4a82 100644 --- a/tests/auto/opengl/qgl/tst_qgl.cpp +++ b/tests/auto/opengl/qgl/tst_qgl.cpp @@ -49,6 +49,7 @@ #include <qglframebufferobject.h> #include <qglcolormap.h> #include <qpaintengine.h> +#include <qopenglfunctions.h> #include <QGraphicsView> #include <QGraphicsProxyWidget> @@ -751,7 +752,10 @@ void tst_QGL::openGLVersionCheck() #elif defined(QT_OPENGL_ES_2) QVERIFY(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0); #else - QVERIFY(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_1); + if (QOpenGLFunctions::isES()) + QVERIFY(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0); + else + QVERIFY(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_1); #endif //defined(QT_OPENGL_ES_1) } #endif //QT_BUILD_INTERNAL @@ -1511,12 +1515,6 @@ void tst_QGL::colormap() QCOMPARE(cmap4.size(), 256); } -#ifndef QT_OPENGL_ES -#define DEFAULT_FORMAT GL_RGBA8 -#else -#define DEFAULT_FORMAT GL_RGBA -#endif - #ifndef GL_TEXTURE_3D #define GL_TEXTURE_3D 0x806F #endif @@ -1532,7 +1530,13 @@ void tst_QGL::fboFormat() QCOMPARE(format1.samples(), 0); QVERIFY(format1.attachment() == QGLFramebufferObject::NoAttachment); QCOMPARE(int(format1.textureTarget()), int(GL_TEXTURE_2D)); - QCOMPARE(int(format1.internalTextureFormat()), int(DEFAULT_FORMAT)); + int expectedFormat = +#ifdef QT_OPENGL_ES_2 + GL_RGBA; +#else + QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8; +#endif + QCOMPARE(int(format1.internalTextureFormat()), expectedFormat); // Modify the values and re-check. format1.setSamples(8); @@ -1603,14 +1607,26 @@ void tst_QGL::fboFormat() QGLFramebufferObjectFormat format4c; QVERIFY(format1c == format3c); QVERIFY(!(format1c != format3c)); - format3c.setInternalTextureFormat(DEFAULT_FORMAT); + format3c.setInternalTextureFormat( +#ifdef QT_OPENGL_ES_2 + GL_RGBA +#else + QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8 +#endif + ); QVERIFY(!(format1c == format3c)); QVERIFY(format1c != format3c); format4c = format1c; QVERIFY(format1c == format4c); QVERIFY(!(format1c != format4c)); - format4c.setInternalTextureFormat(DEFAULT_FORMAT); + format4c.setInternalTextureFormat( +#ifdef QT_OPENGL_ES_2 + GL_RGBA +#else + QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8 +#endif + ); QVERIFY(!(format1c == format4c)); QVERIFY(format1c != format4c); } diff --git a/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp b/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp index 975df7f554..fea3c7b643 100644 --- a/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp +++ b/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp @@ -96,97 +96,99 @@ void tst_QGLFunctions::features() funcs.initializeGLFunctions(); // Validate the features against what we expect for this platform. -#if defined(QT_OPENGL_ES_2) - QGLFunctions::OpenGLFeatures allFeatures = - (QGLFunctions::Multitexture | - QGLFunctions::Shaders | - QGLFunctions::Buffers | - QGLFunctions::Framebuffers | - QGLFunctions::BlendColor | - QGLFunctions::BlendEquation | - QGLFunctions::BlendEquationSeparate | - QGLFunctions::BlendFuncSeparate | - QGLFunctions::BlendSubtract | - QGLFunctions::CompressedTextures | - QGLFunctions::Multisample | - QGLFunctions::StencilSeparate | - QGLFunctions::NPOTTextures); - QVERIFY((funcs.openGLFeatures() & allFeatures) == allFeatures); - QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Multitexture)); - QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Shaders)); - QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Buffers)); - QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Framebuffers)); - QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::BlendColor)); - QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::BlendEquation)); - QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::BlendEquationSeparate)); - QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::BlendFuncSeparate)); - QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::BlendSubtract)); - QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::CompressedTextures)); - QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Multisample)); - QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::StencilSeparate)); - QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::NPOTTextures)); -#elif defined(QT_OPENGL_ES) - QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Multitexture)); - QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Buffers)); - QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::CompressedTextures)); - QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Multisample)); - - QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::Shaders)); - QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::BlendColor)); - QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::StencilSeparate)); - - QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::Framebuffers), - hasExtension("GL_OES_framebuffer_object")); - QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendEquationSeparate), - hasExtension("GL_OES_blend_equation_separate")); - QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendFuncSeparate), - hasExtension("GL_OES_blend_func_separate")); - QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendSubtract), - hasExtension("GL_OES_blend_subtract")); - QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::NPOTTextures), - hasExtension("GL_OES_texture_npot")); -#else - // We check for both the extension name and the minimum OpenGL version - // for the feature. This will help us catch situations where a platform - // doesn't list an extension by name but does have the feature by virtue - // of its version number. - QGLFormat::OpenGLVersionFlags versions = QGLFormat::openGLVersionFlags(); - QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::Multitexture), - hasExtension("GL_ARB_multitexture") || - (versions & QGLFormat::OpenGL_Version_1_3) != 0); - QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::Shaders), - hasExtension("GL_ARB_shader_objects") || - (versions & QGLFormat::OpenGL_Version_2_0) != 0); - QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::Buffers), - (versions & QGLFormat::OpenGL_Version_1_5) != 0); - QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::Framebuffers), - hasExtension("GL_EXT_framebuffer_object") || - hasExtension("GL_ARB_framebuffer_object")); - QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendColor), - hasExtension("GL_EXT_blend_color") || - (versions & QGLFormat::OpenGL_Version_1_2) != 0); - QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendEquation), - (versions & QGLFormat::OpenGL_Version_1_2) != 0); - QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendEquationSeparate), - hasExtension("GL_EXT_blend_equation_separate") || - (versions & QGLFormat::OpenGL_Version_2_0) != 0); - QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendFuncSeparate), - hasExtension("GL_EXT_blend_func_separate") || - (versions & QGLFormat::OpenGL_Version_1_4) != 0); - QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendSubtract), - hasExtension("GL_EXT_blend_subtract")); - QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::CompressedTextures), - hasExtension("GL_ARB_texture_compression") || - (versions & QGLFormat::OpenGL_Version_1_3) != 0); - QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::Multisample), - hasExtension("GL_ARB_multisample") || - (versions & QGLFormat::OpenGL_Version_1_3) != 0); - QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::StencilSeparate), - (versions & QGLFormat::OpenGL_Version_2_0) != 0); - QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::NPOTTextures), - hasExtension("GL_ARB_texture_non_power_of_two") || - (versions & QGLFormat::OpenGL_Version_2_0) != 0); + if (QOpenGLFunctions::isES()) { +#if !defined(QT_OPENGL_ES) || defined(QT_OPENGL_ES_2) + QGLFunctions::OpenGLFeatures allFeatures = + (QGLFunctions::Multitexture | + QGLFunctions::Shaders | + QGLFunctions::Buffers | + QGLFunctions::Framebuffers | + QGLFunctions::BlendColor | + QGLFunctions::BlendEquation | + QGLFunctions::BlendEquationSeparate | + QGLFunctions::BlendFuncSeparate | + QGLFunctions::BlendSubtract | + QGLFunctions::CompressedTextures | + QGLFunctions::Multisample | + QGLFunctions::StencilSeparate | + QGLFunctions::NPOTTextures); + QVERIFY((funcs.openGLFeatures() & allFeatures) == allFeatures); + QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Multitexture)); + QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Shaders)); + QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Buffers)); + QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Framebuffers)); + QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::BlendColor)); + QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::BlendEquation)); + QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::BlendEquationSeparate)); + QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::BlendFuncSeparate)); + QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::BlendSubtract)); + QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::CompressedTextures)); + QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Multisample)); + QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::StencilSeparate)); + QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::NPOTTextures)); +#elif defined(QT_OPENGL_ES) && !defined(QT_OPENGL_ES_2) + QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Multitexture)); + QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Buffers)); + QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::CompressedTextures)); + QVERIFY(funcs.hasOpenGLFeature(QGLFunctions::Multisample)); + + QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::Shaders)); + QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::BlendColor)); + QVERIFY(!funcs.hasOpenGLFeature(QGLFunctions::StencilSeparate)); + + QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::Framebuffers), + hasExtension("GL_OES_framebuffer_object")); + QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendEquationSeparate), + hasExtension("GL_OES_blend_equation_separate")); + QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendFuncSeparate), + hasExtension("GL_OES_blend_func_separate")); + QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendSubtract), + hasExtension("GL_OES_blend_subtract")); + QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::NPOTTextures), + hasExtension("GL_OES_texture_npot")); #endif + } else { + // We check for both the extension name and the minimum OpenGL version + // for the feature. This will help us catch situations where a platform + // doesn't list an extension by name but does have the feature by virtue + // of its version number. + QGLFormat::OpenGLVersionFlags versions = QGLFormat::openGLVersionFlags(); + QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::Multitexture), + hasExtension("GL_ARB_multitexture") || + (versions & QGLFormat::OpenGL_Version_1_3) != 0); + QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::Shaders), + hasExtension("GL_ARB_shader_objects") || + (versions & QGLFormat::OpenGL_Version_2_0) != 0); + QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::Buffers), + (versions & QGLFormat::OpenGL_Version_1_5) != 0); + QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::Framebuffers), + hasExtension("GL_EXT_framebuffer_object") || + hasExtension("GL_ARB_framebuffer_object")); + QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendColor), + hasExtension("GL_EXT_blend_color") || + (versions & QGLFormat::OpenGL_Version_1_2) != 0); + QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendEquation), + (versions & QGLFormat::OpenGL_Version_1_2) != 0); + QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendEquationSeparate), + hasExtension("GL_EXT_blend_equation_separate") || + (versions & QGLFormat::OpenGL_Version_2_0) != 0); + QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendFuncSeparate), + hasExtension("GL_EXT_blend_func_separate") || + (versions & QGLFormat::OpenGL_Version_1_4) != 0); + QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::BlendSubtract), + hasExtension("GL_EXT_blend_subtract")); + QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::CompressedTextures), + hasExtension("GL_ARB_texture_compression") || + (versions & QGLFormat::OpenGL_Version_1_3) != 0); + QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::Multisample), + hasExtension("GL_ARB_multisample") || + (versions & QGLFormat::OpenGL_Version_1_3) != 0); + QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::StencilSeparate), + (versions & QGLFormat::OpenGL_Version_2_0) != 0); + QCOMPARE(funcs.hasOpenGLFeature(QGLFunctions::NPOTTextures), + hasExtension("GL_ARB_texture_non_power_of_two") || + (versions & QGLFormat::OpenGL_Version_2_0) != 0); + } } // Verify that the multitexture functions appear to resolve and work. diff --git a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp index f5923764b8..765dc221dc 100644 --- a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp +++ b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp @@ -333,52 +333,55 @@ static inline float qrandom() { return (rand() % 100) / 100.f; } void renderAScene(int w, int h) { -#ifdef QT_OPENGL_ES_2 - Q_UNUSED(w) - Q_UNUSED(h) - QGLShaderProgram program; - program.addShaderFromSourceCode(QGLShader::Vertex, "attribute highp vec2 pos; void main() { gl_Position = vec4(pos.xy, 1.0, 1.0); }"); - program.addShaderFromSourceCode(QGLShader::Fragment, "uniform lowp vec4 color; void main() { gl_FragColor = color; }"); - program.bindAttributeLocation("pos", 0); - program.bind(); - - glEnableVertexAttribArray(0); - - for (int i=0; i<1000; ++i) { - GLfloat pos[] = { - (rand() % 100) / 100.f, - (rand() % 100) / 100.f, - (rand() % 100) / 100.f, - (rand() % 100) / 100.f, - (rand() % 100) / 100.f, - (rand() % 100) / 100.f - }; - - glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, pos); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); - } -#else - glViewport(0, 0, w, h); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(0, w, h, 0, 1, 100); - glTranslated(0, 0, -1); - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - for (int i=0;i<1000; ++i) { - glBegin(GL_TRIANGLES); - glColor3f(qrandom(), qrandom(), qrandom()); - glVertex2f(qrandom() * w, qrandom() * h); - glColor3f(qrandom(), qrandom(), qrandom()); - glVertex2f(qrandom() * w, qrandom() * h); - glColor3f(qrandom(), qrandom(), qrandom()); - glVertex2f(qrandom() * w, qrandom() * h); - glEnd(); - } + if (QOpenGLFunctions::isES()) { + QGLFunctions funcs(QGLContext::currentContext()); + Q_UNUSED(w); + Q_UNUSED(h); + QGLShaderProgram program; + program.addShaderFromSourceCode(QGLShader::Vertex, "attribute highp vec2 pos; void main() { gl_Position = vec4(pos.xy, 1.0, 1.0); }"); + program.addShaderFromSourceCode(QGLShader::Fragment, "uniform lowp vec4 color; void main() { gl_FragColor = color; }"); + program.bindAttributeLocation("pos", 0); + program.bind(); + + funcs.glEnableVertexAttribArray(0); + + for (int i=0; i<1000; ++i) { + GLfloat pos[] = { + (rand() % 100) / 100.f, + (rand() % 100) / 100.f, + (rand() % 100) / 100.f, + (rand() % 100) / 100.f, + (rand() % 100) / 100.f, + (rand() % 100) / 100.f + }; + + funcs.glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, pos); + glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); + } + } else { +#ifndef QT_OPENGL_ES_2 + glViewport(0, 0, w, h); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(0, w, h, 0, 1, 100); + glTranslated(0, 0, -1); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + for (int i=0;i<1000; ++i) { + glBegin(GL_TRIANGLES); + glColor3f(qrandom(), qrandom(), qrandom()); + glVertex2f(qrandom() * w, qrandom() * h); + glColor3f(qrandom(), qrandom(), qrandom()); + glVertex2f(qrandom() * w, qrandom() * h); + glColor3f(qrandom(), qrandom(), qrandom()); + glVertex2f(qrandom() * w, qrandom() * h); + glEnd(); + } #endif + } } class ThreadSafeGLWidget : public QGLWidget diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp index f5d92be95d..5f4284e79a 100644 --- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp @@ -2596,8 +2596,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 QT_OPENGL_ES_2_ANGLE - if (platformName == QLatin1String("windows")) +#ifdef Q_OS_WIN + if (QOpenGLFunctions::isES()) QSKIP("nativeSubWindows() does not work with ANGLE on Windows, QTBUG-28545."); #endif { // Add native widgets after show. |