PythonQt.Qt.QGLFramebufferObject
QGLFramebufferObject
PythonQtInstanceWrapper object
Native bases: PythonQtInstanceWrapper
Supplemental documentation: Qt 5 reference:
Detailed Description
The QGLFramebufferObject class encapsulates an OpenGL framebuffer object, defined by the
GL_EXT_framebuffer_object extension. In addition it provides a rendering surface that
can be painted on with a QPainter,
rendered to using native GL calls, or both. This surface can be bound and used as a
regular texture in your own GL drawing code. By default, the QGLFramebufferObject class
generates a 2D GL texture (using the GL_TEXTURE_2D target), which is used as the
internal rendering target.
It is important to have a current GL context when creating a QGLFramebufferObject, otherwise initialization will fail.
OpenGL framebuffer objects and pbuffers (see QGLPixelBuffer) can both be used to render to offscreen surfaces, but there are a number of advantages with using framebuffer objects instead of pbuffers:
- A framebuffer object does not require a separate rendering context, so no context switching will occur when switching rendering targets. There is an overhead involved in switching targets, but in general it is cheaper than a context switch to a pbuffer.
- Rendering to dynamic textures (i.e. render-to-texture functionality) works on all platforms. No need to do explicit copy calls from a render buffer into a texture, as was necessary on systems that did not support the
render_textureextension. - It is possible to attach several rendering buffers (or texture objects) to the same framebuffer object, and render to all of them without doing a context switch.
- The OpenGL framebuffer extension is a pure GL extension with no system dependant WGL, CGL, or GLX parts. This makes using framebuffer objects more portable.
When using a QPainter to paint to a QGLFramebufferObject you should take care that the QGLFramebufferObject is created with the CombinedDepthStencil attachment for QPainter to be able to render correctly. Note that you need to create a QGLFramebufferObject with more than one sample per pixel for primitives to be antialiased when drawing using a QPainter. To create a multisample framebuffer object you should use one of the constructors that take a QGLFramebufferObjectFormat parameter, and set the QGLFramebufferObjectFormat::samples() property to a non-zero value.
When painting to a QGLFramebufferObject using QPainter, the state of the current GL context will be altered by the paint engine to reflect its needs. Applications should not rely upon the GL state being reset to its original conditions, particularly the current shader program, GL viewport, texture units, and drawing modes.
For multisample framebuffer objects a color render buffer is created, otherwise a
texture with the specified texture target is created. The color render buffer or texture
will have the specified internal format, and will be bound to the GL_COLOR_ATTACHMENT0
attachment in the framebuffer object.
If you want to use a framebuffer object with multisampling enabled as a texture, you first need to copy from it to a regular framebuffer object using QGLContext::blitFramebuffer().
Threading
As of Qt 4.8, it's possible to draw into a QGLFramebufferObject using a QPainter in a separate thread. Note that OpenGL 2.0 or OpenGL ES 2.0 is required for this to work.
Note: This class has been deprecated in favor of QOpenGLFramebufferObject.
Source: https://doc.qt.io/archives/qt-5.15/qglframebufferobject.html
Complete member index
Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.
| Member | Kind | Signature | Summary |
|---|---|---|---|
Attachment |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text) |
CombinedDepthStencil |
attribute | Any |
(shared captured text) |
Depth |
attribute | Any |
(shared captured text) |
NoAttachment |
attribute | Any |
(shared captured text) |
PaintDeviceMetric |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text) |
PdmDepth |
attribute | Any |
(shared captured text) |
PdmDevicePixelRatio |
attribute | Any |
(shared captured text) |
PdmDevicePixelRatioScaled |
attribute | Any |
(shared captured text) |
PdmDpiX |
attribute | Any |
(shared captured text) |
PdmDpiY |
attribute | Any |
(shared captured text) |
PdmHeight |
attribute | Any |
(shared captured text) |
PdmHeightMM |
attribute | Any |
(shared captured text) |
PdmNumColors |
attribute | Any |
(shared captured text) |
PdmPhysicalDpiX |
attribute | Any |
(shared captured text) |
PdmPhysicalDpiY |
attribute | Any |
(shared captured text) |
PdmWidth |
attribute | Any |
(shared captured text) |
PdmWidthMM |
attribute | Any |
(shared captured text) |
__init__ |
function | (self, *args: Any, **kwargs: Any) -> None |
Native constructor; consult class documentation for supported overloads. (shared captured text) |
attachment |
function | (self) -> Any |
Returns the status of the depth and stencil buffers attached to this framebuffer object. (shared captured text) |
bind |
function | (self) -> bool |
X.bind() -> bool (shared captured text) |
bindDefault |
function | (self) -> bool |
X.bindDefault() -> bool (shared captured text) |
blitFramebuffer |
function | (self, target: Any, targetRect: Any, source: Any, sourceRect: Any, buffers: int, filter: int) -> None |
X.blitFramebuffer(target, targetRect, source, sourceRect, buffers, filter) (shared captured text) |
className |
function | (self, *args: Any, **kwargs: Any) -> Any |
Return the classname of the object (shared captured text) |
colorCount |
function | (self) -> int |
X.colorCount() -> int (shared captured text) |
delete |
function | (self, *args: Any, **kwargs: Any) -> Any |
Deletes the C++ object (at your own risk, my friend!) (shared captured text) |
depth |
function | (self) -> int |
X.depth() -> int (shared captured text) |
devType |
function | (self) -> int |
X.devType() -> int (shared captured text) |
devicePixelRatio |
function | (self) -> int |
X.devicePixelRatio() -> int (shared captured text) |
devicePixelRatioF |
function | (self) -> float |
X.devicePixelRatioF() -> float (shared captured text) |
devicePixelRatioFScale |
function | (self) -> float |
X.devicePixelRatioFScale() -> float (shared captured text) |
drawTexture |
function | (self, point: Any, textureId: int, textureTarget: int) -> None |
X.drawTexture(point, textureId, textureTarget) (shared captured text) |
format |
function | (self) -> Any |
X.format() -> PythonQt.QtOpenGL.QGLFramebufferObjectFormat (shared captured text) |
handle |
function | (self) -> int |
X.handle() -> int (shared captured text) |
hasOpenGLFramebufferBlit |
function | (self) -> bool |
X.hasOpenGLFramebufferBlit() -> bool (shared captured text) |
hasOpenGLFramebufferObjects |
function | (self) -> bool |
X.hasOpenGLFramebufferObjects() -> bool (shared captured text) |
height |
function | (self) -> int |
X.height() -> int (shared captured text) |
heightMM |
function | (self) -> int |
X.heightMM() -> int (shared captured text) |
help |
function | (self, *args: Any, **kwargs: Any) -> Any |
Shows the help of available methods for this class (shared captured text) |
inherits |
function | (self, *args: Any, **kwargs: Any) -> Any |
Returns if the class inherits or is of given type name (shared captured text) |
initPainter |
function | (self, painter: Any) -> Any |
(shared captured text) |
isBound |
function | (self) -> bool |
X.isBound() -> bool (shared captured text) |
isValid |
function | (self) -> bool |
X.isValid() -> bool (shared captured text) |
logicalDpiX |
function | (self) -> int |
X.logicalDpiX() -> int (shared captured text) |
logicalDpiY |
function | (self) -> int |
X.logicalDpiY() -> int (shared captured text) |
metric |
function | (self, metric: Any) -> int |
X.metric(metric) -> int (shared captured text) |
paintEngine |
function | (self) -> Any |
X.paintEngine() -> PythonQt.QtGui.QPaintEngine (shared captured text) |
paintingActive |
function | (self) -> bool |
X.paintingActive() -> bool (shared captured text) |
physicalDpiX |
function | (self) -> int |
X.physicalDpiX() -> int (shared captured text) |
physicalDpiY |
function | (self) -> int |
X.physicalDpiY() -> int (shared captured text) |
redirected |
function | (self, offset: Any) -> Any |
X.redirected(offset) -> PythonQt.QtGui.QPaintDevice (shared captured text) |
release |
function | (self) -> bool |
X.release() -> bool (shared captured text) |
sharedPainter |
function | (self) -> Any |
X.sharedPainter() -> PythonQt.QtGui.QPainter (shared captured text) |
size |
function | (self) -> Any |
X.size() -> PythonQt.QtCore.QSize (shared captured text) |
texture |
function | (self) -> int |
X.texture() -> int (shared captured text) |
toImage |
function | (self) -> Any |
X.toImage() -> PythonQt.QtGui.QImage (shared captured text) |
width |
function | (self) -> int |
X.width() -> int (shared captured text) |
widthMM |
function | (self) -> int |
X.widthMM() -> int (shared captured text) |