Also enable depth, stencil and samples by default as our default
renderer requires both depth and stencil and our default rounded
rectangles require multisampling
The user should be able to override the default format, by getting
the QSGCanvas::format(), modify it and set it back, but this
is currently not supported in QWindow, so that will have to wait
Change-Id: I1869003705709987ab2e9a3cebbeeec4d45a2021
Reviewed-on: http://codereview.qt-project.org/5464
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
thread->moveContextToThread(context);
q->setSurfaceType(QWindow::OpenGLSurface);
+ q->setFormat(context->defaultSurfaceFormat());
}
void QSGCanvasPrivate::transformTouchPoints(QList<QTouchEvent::TouchPoint> &touchPoints, const QTransform &transform)
void QSGCanvasRenderLoop::createGLContext()
{
gl = new QOpenGLContext();
- gl->setFormat(renderer->format());
+ gl->setFormat(d->context->defaultSurfaceFormat());
gl->create();
}
+QSurfaceFormat QSGContext::defaultSurfaceFormat() const
+{
+ QSurfaceFormat format;
+ format.setDepthBufferSize(24);
+ format.setStencilBufferSize(8);
+ format.setSamples(16);
+ return format;
+}
+
+
/*!
Factory function for texture objects.
#ifndef QSGCONTEXT_H
#define QSGCONTEXT_H
-#include <QImage>
-#include <QObject>
-#include <qabstractanimation.h>
+#include <QtCore/QObject>
+#include <QtCore/qabstractanimation.h>
+
+#include <QtGui/QImage>
+#include <QtGui/QSurfaceFormat>
#include "qsgnode.h"
virtual QSGTexture *createTexture(const QImage &image = QImage()) const;
virtual QSize minimumFBOSize() const;
+ virtual QSurfaceFormat defaultSurfaceFormat() const;
+
static QSGContext *createDefaultContext();
void scheduleTextureForCleanup(QSGTexture *texture);