Qt5 texture upload in separate thread
-
Hi,
I'm trying to implement async loading of textures by using a shared GL context in a separate thread and uploading textures into it. In Qt4 this could be done by using a hidden QGLWidget. As described in the QGLWidget documentation:
bq. "Doing texture uploads in a thread may be very useful for applications handling large amounts of images that needs to be displayed, like for instance a photo gallery application. This is supported in Qt through the existing bindTexture() API. A simple way of doing this is to create two sharing QGLWidgets. One is made current in the main GUI thread, while the other is made current in the texture upload thread. The widget in the uploading thread is never shown, it is only used for sharing textures with the main thread. For each texture that is bound via bindTexture(), notify the main thread so that it can start using the texture.
Now, I'm trying to do this in Qt5 with QOpenGLContext and QSurface/QWindow, but I'm not quite sure how. According to the documentation I can't start rendering into a QWindow until it has been exposed.
Any ideas on how to do this?