Hi all! I have a quick question.

I'm trying to render a bunch of stuff (mainly QPainterPaths) to an OpenGL texture in order to cache it for future usage. My naïve approach was to paint in a QImage then use QGLWidget::bindTexture to send it to OpenGL.

However, this approach has a double drawback: rendering in a QImage isn't done with OpenGL (which is way slower) and then data has to copied from the RAM to the VRAM in order to create that texture. I'm no expert, but it's my understanding that render to texture is merely a copy inside the VRAM.

So, if I could render those painter paths with OpenGL directly in a texture, I'd gain time on both actions (if I'm not mistaken).

The big question is of course how does one do that? I have an OpenGL context in a QGraphicsView, but render to texture involves some off-screen rendering that I'm not sure how to do. I've seen there is a QGLFrameBufferObject class, but I'm not sure about the way I'm supposed to use it...

Any pointers on that topic? Thanks in advance!