diff options
author | Gunnar Sletta <gunnar.sletta@digia.com> | 2013-10-07 11:03:05 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-22 10:00:04 +0200 |
commit | ca8b72040349f60df45c6070ed617d4462c25779 (patch) | |
tree | 4b8780d5389b44163d1889dae106f1260a08095b /examples/quick/scenegraph | |
parent | b182f63278a8c9d90f321327863dceeeb8e7ec4e (diff) |
Make example work on Windows
Change-Id: I75a035939a390de8cdae03c11599efa0b7ed68df
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'examples/quick/scenegraph')
-rw-r--r-- | examples/quick/scenegraph/textureinthread/threadrenderer.cpp | 30 | ||||
-rw-r--r-- | examples/quick/scenegraph/textureinthread/threadrenderer.h | 3 |
2 files changed, 10 insertions, 23 deletions
diff --git a/examples/quick/scenegraph/textureinthread/threadrenderer.cpp b/examples/quick/scenegraph/textureinthread/threadrenderer.cpp index 7de1d294ba..072b4b9f0b 100644 --- a/examples/quick/scenegraph/textureinthread/threadrenderer.cpp +++ b/examples/quick/scenegraph/textureinthread/threadrenderer.cpp @@ -79,6 +79,7 @@ public: m_context = new QOpenGLContext(); m_context->setShareContext(context); m_context->setFormat(context->format()); + m_context->create(); m_context->moveToThread(this); // We need a non-visible surface to make current in the other thread @@ -93,9 +94,6 @@ public: public slots: void renderNext() { - if (!m_context->isValid()) - m_context->create(); - m_context->makeCurrent(m_fakeSurface); if (!m_renderFbo) { @@ -234,30 +232,22 @@ ThreadRenderer::ThreadRenderer() : m_renderThread(0) { setFlag(ItemHasContents, true); - polish(); -} - -void ThreadRenderer::updatePolish() -{ - if (!window() || !window()->openglContext()) - return; - - m_renderThread = new RenderThread(QSize(512, 512), window()->openglContext()); - m_renderThread->moveToThread(m_renderThread); - m_renderThread->start(); - connect(window(), SIGNAL(sceneGraphInvalidated()), m_renderThread, SLOT(shutDown()), Qt::QueuedConnection); } QSGNode *ThreadRenderer::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) { + TextureNode *node = static_cast<TextureNode *>(oldNode); + if (!m_renderThread) { - polish(); - update(); - return 0; + QOpenGLContext *current = window()->openglContext(); + current->doneCurrent(); + m_renderThread = new RenderThread(QSize(512, 512), current); + current->makeCurrent(window()); + m_renderThread->moveToThread(m_renderThread); + m_renderThread->start(); + connect(window(), SIGNAL(sceneGraphInvalidated()), m_renderThread, SLOT(shutDown()), Qt::QueuedConnection); } - TextureNode *node = static_cast<TextureNode *>(oldNode); - if (!node) { node = new TextureNode(window()); diff --git a/examples/quick/scenegraph/textureinthread/threadrenderer.h b/examples/quick/scenegraph/textureinthread/threadrenderer.h index 8c68e27d92..7f720cb45a 100644 --- a/examples/quick/scenegraph/textureinthread/threadrenderer.h +++ b/examples/quick/scenegraph/textureinthread/threadrenderer.h @@ -54,9 +54,6 @@ public: static QList<QThread *> threads; -public slots: - void updatePolish(); - protected: QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); |