Archive for February, 2013

Using FBOs instead of pBuffers in Qt 5

February 10, 2013

In Qt 4 lifetime it was possible to accelerate QPainter drawing with OpenGL by using the QGLPixelBuffer class: it offered a nice and quick way of creating a drawable surface, rendering to it (using ordinary QPainter methods) and grabbing the final result as a QImage.

In Qt 5 QGLPixelBuffer is still there, but it has been deprecated in favour of Framebuffer Objects, wrapped in Qt by the QOpenGLFramebufferObject class. However, QOpenGLFramebufferObject is not a QPaintDevice, therefore we can’t use a QPainter directly on it.