aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/rendercontrol/cuberenderer.h
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2014-12-16 12:49:08 +0100
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-01-07 13:21:00 +0100
commitfae16f9d2fca773276eba150d0414fb2f303d179 (patch)
tree7d657c46028f1e0e0c220414f15a4e01fab425f3 /examples/quick/rendercontrol/cuberenderer.h
parent5352f67ffa5ee257f2856deb8f5f8cd69108e278 (diff)
Prevent windows outside the gui thread in rendercontrol example
In the multithreaded case we attempted to create QWindows outside the gui thread on platforms where QOffscreenSurface is backed by the hidden QWindow in the absence of a better solution. This has to be avoided. Therefore, pass a suitable surface from the gui thread instead. This will avoid "Attempting to create QWindow-based QOffscreenSurface outside the gui thread." type of warnings when running on OS X with --threaded. Change-Id: Ie3ebeeeaa9e6bdf83e763e40213e2940fbfde667 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com> Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
Diffstat (limited to 'examples/quick/rendercontrol/cuberenderer.h')
-rw-r--r--examples/quick/rendercontrol/cuberenderer.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/quick/rendercontrol/cuberenderer.h b/examples/quick/rendercontrol/cuberenderer.h
index 8f98376fdf..1d5400ade2 100644
--- a/examples/quick/rendercontrol/cuberenderer.h
+++ b/examples/quick/rendercontrol/cuberenderer.h
@@ -48,11 +48,12 @@ QT_FORWARD_DECLARE_CLASS(QOpenGLShaderProgram)
QT_FORWARD_DECLARE_CLASS(QOpenGLBuffer)
QT_FORWARD_DECLARE_CLASS(QOpenGLVertexArrayObject)
QT_FORWARD_DECLARE_CLASS(QWindow)
+QT_FORWARD_DECLARE_CLASS(QOffscreenSurface)
class CubeRenderer
{
public:
- CubeRenderer();
+ CubeRenderer(QOffscreenSurface *offscreenSurface);
~CubeRenderer();
void resize(int w, int h);
@@ -62,6 +63,7 @@ private:
void init(QWindow *w, QOpenGLContext *share);
void setupVertexAttribs();
+ QOffscreenSurface *m_offscreenSurface;
QOpenGLContext *m_context;
QOpenGLShaderProgram *m_program;
QOpenGLBuffer *m_vbo;