QGLPixelBuffer Class
The QGLPixelBuffer class encapsulates an OpenGL pbuffer. More...
| Header: | #include <QGLPixelBuffer> |
| qmake: | QT += opengl |
| Since: | Qt 4.1 |
| Inherits: | QPaintDevice |
This class is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
This class was introduced in Qt 4.1.
Detailed Description
Rendering into a pbuffer is normally done using full hardware acceleration. This can be significantly faster than rendering into a QPixmap.
There are three approaches to using this class:
- We can draw into the pbuffer and convert it to a QImage using toImage(). This is normally much faster than calling QGLWidget::renderPixmap().
- We can draw into the pbuffer and copy the contents into an OpenGL texture using updateDynamicTexture(). This allows us to create dynamic textures and works on all systems with pbuffer support.
- On systems that support it, we can bind the pbuffer to an OpenGL texture. The texture is then updated automatically when the pbuffer contents change, eliminating the need for additional copy operations. This is supported only on Windows and macOS systems that provide the
render_textureextension. Note that under Windows, a multi-sampled pbuffer can't be used in conjunction with therender_textureextension. If a multi-sampled pbuffer is requested under Windows, therender_textureextension is turned off for that pbuffer.
Note: This class has been deprecated, use QOpenGLFramebufferObject for offscreen rendering.
Threading
As of Qt 4.8, it's possible to render into a QGLPixelBuffer using a QPainter in a separate thread. Note that OpenGL 2.0 or OpenGL ES 2.0 is required for this to work.
Pbuffers are provided by the OpenGL pbuffer extension; call hasOpenGLPbuffer() to find out if the system provides pbuffers.