summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorKeränen Pasi <pasi.keranen@digia.com>2013-12-16 16:17:07 +0200
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2013-12-17 12:52:03 +0200
commitfba185e6c2fa5158aa60ba4468c1f1a70177f77a (patch)
tree4532ce4cc96fc52a32410f552e8557ea68d98267 /examples
parent018379d522deca3a6f7b184fbc12f122a87aaadc (diff)
Antialiasing and direct rendering with QML.
Task-id: QTRD-2565 Change-Id: I4099c869f157361ee6a900dfc1c29301b373ac30 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/qmlbars/main.cpp13
-rw-r--r--examples/qmlcustominput/main.cpp13
-rw-r--r--examples/qmlscatter/main.cpp13
-rw-r--r--examples/qmlsurface/main.cpp12
4 files changed, 51 insertions, 0 deletions
diff --git a/examples/qmlbars/main.cpp b/examples/qmlbars/main.cpp
index 58cd5e32..49bacdc8 100644
--- a/examples/qmlbars/main.cpp
+++ b/examples/qmlbars/main.cpp
@@ -29,6 +29,19 @@ int main(int argc, char *argv[])
QGuiApplication app(argc, argv);
QtQuick2ApplicationViewer viewer;
+
+ // Enable antialiasing
+ QSurfaceFormat surfaceFormat;
+ surfaceFormat.setDepthBufferSize(24);
+#if !defined(QT_OPENGL_ES_2)
+ surfaceFormat.setSamples(8);
+ surfaceFormat.setRenderableType(QSurfaceFormat::OpenGL);
+#else
+ surfaceFormat.setRenderableType(QSurfaceFormat::OpenGLES);
+#endif
+ surfaceFormat.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
+ viewer.setFormat(surfaceFormat);
+
#ifdef Q_OS_ANDROID
viewer.addImportPath(QString::fromLatin1("assets:/qml"));
viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(),
diff --git a/examples/qmlcustominput/main.cpp b/examples/qmlcustominput/main.cpp
index 232d7587..91ba6588 100644
--- a/examples/qmlcustominput/main.cpp
+++ b/examples/qmlcustominput/main.cpp
@@ -29,6 +29,19 @@ int main(int argc, char *argv[])
QGuiApplication app(argc, argv);
QtQuick2ApplicationViewer viewer;
+
+ // Enable antialiasing
+ QSurfaceFormat surfaceFormat;
+ surfaceFormat.setDepthBufferSize(24);
+#if !defined(QT_OPENGL_ES_2)
+ surfaceFormat.setSamples(8);
+ surfaceFormat.setRenderableType(QSurfaceFormat::OpenGL);
+#else
+ surfaceFormat.setRenderableType(QSurfaceFormat::OpenGLES);
+#endif
+ surfaceFormat.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
+ viewer.setFormat(surfaceFormat);
+
#ifdef Q_OS_ANDROID
viewer.addImportPath(QString::fromLatin1("assets:/qml"));
viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(),
diff --git a/examples/qmlscatter/main.cpp b/examples/qmlscatter/main.cpp
index cc3fa4c3..43c0a9fb 100644
--- a/examples/qmlscatter/main.cpp
+++ b/examples/qmlscatter/main.cpp
@@ -29,6 +29,19 @@ int main(int argc, char *argv[])
QGuiApplication app(argc, argv);
QtQuick2ApplicationViewer viewer;
+
+ // Enable antialiasing
+ QSurfaceFormat surfaceFormat;
+ surfaceFormat.setDepthBufferSize(24);
+#if !defined(QT_OPENGL_ES_2)
+ surfaceFormat.setSamples(8);
+ surfaceFormat.setRenderableType(QSurfaceFormat::OpenGL);
+#else
+ surfaceFormat.setRenderableType(QSurfaceFormat::OpenGLES);
+#endif
+ surfaceFormat.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
+ viewer.setFormat(surfaceFormat);
+
#ifdef Q_OS_ANDROID
viewer.addImportPath(QString::fromLatin1("assets:/qml"));
viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(),
diff --git a/examples/qmlsurface/main.cpp b/examples/qmlsurface/main.cpp
index ac9dda35..428e4026 100644
--- a/examples/qmlsurface/main.cpp
+++ b/examples/qmlsurface/main.cpp
@@ -30,6 +30,18 @@ int main(int argc, char *argv[])
QtQuick2ApplicationViewer viewer;
+ // Enable antialiasing
+ QSurfaceFormat surfaceFormat;
+ surfaceFormat.setDepthBufferSize(24);
+#if !defined(QT_OPENGL_ES_2)
+ surfaceFormat.setSamples(8);
+ surfaceFormat.setRenderableType(QSurfaceFormat::OpenGL);
+#else
+ surfaceFormat.setRenderableType(QSurfaceFormat::OpenGLES);
+#endif
+ surfaceFormat.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
+ viewer.setFormat(surfaceFormat);
+
#ifdef Q_OS_ANDROID
viewer.addImportPath(QString::fromLatin1("assets:/qml"));
viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(),