QGLFrameBufferObject QPaint in separate thread with two contexts?
I'm drawing text using QPainter with a QGLFrameBufferObject as the paint device. The QGLFrameBufferObject texture is drawn in a QGLWidget. When panning (translating) I limit drawing to 12mS between draws. Once I get aprox half way panned, I redraw all the text now and then. There is a lot of calls to drawText so this can take +100mS which causes a noticable distrubance in the panning.
Ideally I would like to have two QGLFrameBufferObjects, draw from one, QPaint to the other in a separate thread so the panning can keep using the old QGLFrameBufferObject / texture until all the text is redrawn. The issue is as I understand it, only one thread can acess the gl context at a time....the QPainter can't bind at the same time as the QGLWidget's draw/paint event needs to bind. so my question is, can I get a second gl context to put a second QGLFrameBufferObject in? and can the texture in the second context be shared with the first (QGLWidget's) context?
I experimented changing the paint device to a QPixmap and no longer using the QGLFrameBufferObject. I can now draw the text in a seperate thread and QPixmap becomes a texture in the QGLWidget's draw/paint event with a call to bindTexture(); The problem is that the draw event is now bogged down with bindTexture() for large pixelmaps. Results below...
Time it takes for bindTexture() to return for different QPixmap sizes
Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller
1000x600 5mS 120,000 pix/mS
2372x1076 20mS 127,614 pix/mS
3132x1566 35mS 140,135 pix/mS
3436x1778 44mS 138,846 pix/mS
Intel Corporation 82945G/GZ Integrated Graphics Controller (rev 2)
1000x600 12mS 50,000 pix/mS
1500x892 29mS 46,138 pix/mS
1698x1036 41mS 42,906 pix/mS
Android Nexus 4
1472x1910 109mS 25,794 pix/mS
2328x1078 106mS 23,675 pix/mS