diff options
author | Miikka Heikkinen <miikka.heikkinen@theqtcompany.com> | 2014-10-28 12:48:17 +0200 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@theqtcompany.com> | 2014-10-29 09:35:29 +0200 |
commit | bf716cfdf0afecccdb1f2eabb2e6a172c620fbff (patch) | |
tree | dd5a8e5d1360defd47599282639e10b3cf3cc90c /tests | |
parent | 56d9ec81afc59b1cf6aaae7675ff460a6bc664a8 (diff) |
Support for dynamic opengl builds.
Task-number: QTRD-3392
Change-Id: I786bbf5ee9252b92d43d02d6b88ed9b986b4a5eb
Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/barstest/main.cpp | 17 | ||||
-rw-r--r-- | tests/scattertest/main.cpp | 3 |
2 files changed, 16 insertions, 4 deletions
diff --git a/tests/barstest/main.cpp b/tests/barstest/main.cpp index 9a791c5b..af033990 100644 --- a/tests/barstest/main.cpp +++ b/tests/barstest/main.cpp @@ -34,6 +34,18 @@ #include <QColorDialog> #include <QLineEdit> #include <QSpinBox> +#include <QtGui/QOpenGLContext> + +static bool isOpenGLES() +{ +#if defined(QT_OPENGL_ES_2) + return true; +#elif (QT_VERSION < QT_VERSION_CHECK(5, 3, 0)) + return false; +#else + return QOpenGLContext::currentContext()->isOpenGLES(); +#endif +} int main(int argc, char **argv) { @@ -48,9 +60,8 @@ int main(int argc, char **argv) // For testing custom surface format QSurfaceFormat surfaceFormat; surfaceFormat.setDepthBufferSize(24); -#if !defined(QT_OPENGL_ES_2) - surfaceFormat.setSamples(8); -#endif + if (!isOpenGLES()) + surfaceFormat.setSamples(8); Q3DBars *widgetchart = new Q3DBars(&surfaceFormat); QSize screenSize = widgetchart->screen()->size(); diff --git a/tests/scattertest/main.cpp b/tests/scattertest/main.cpp index 811c7f3b..9b6f51ac 100644 --- a/tests/scattertest/main.cpp +++ b/tests/scattertest/main.cpp @@ -36,6 +36,7 @@ int main(int argc, char **argv) { QApplication app(argc, argv); + //QCoreApplication::setAttribute(Qt::AA_UseOpenGLES); QWidget *widget = new QWidget; QHBoxLayout *hLayout = new QHBoxLayout(widget); @@ -484,7 +485,7 @@ int main(int argc, char **argv) chart->setGeometry(QRect(0, 0, 800, 800)); modifier->start(); - modifier->renderToImage(); // Initial hidden render + //modifier->renderToImage(); // Initial hidden render widget->show(); |