Skip to content

PythonQt.QtOpenGL.QGLPixelBuffer · declarations 001

Back to PythonQt.QtOpenGL.QGLPixelBuffer

bindTexture

bindTexture(image: Any, target: Any) -> int

X.bindTexture(image, target) -> int

Supplemental documentation: Qt 5 reference:

GLuint QGLPixelBuffer::bindTexture(const QImage \&image, GLenum target \= GL_TEXTURE_2D)

Generates and binds a 2D GL texture to the current context, based on image. The generated texture id is returned and can be used in later glBindTexture() calls.

The target parameter specifies the texture target.

Equivalent to calling QGLContext::bindTexture().

See also deleteTexture().

GLuint QGLPixelBuffer::bindTexture(const QPixmap \&pixmap, GLenum target \= GL_TEXTURE_2D)

This is an overloaded function.

Generates and binds a 2D GL texture based on pixmap.

Equivalent to calling QGLContext::bindTexture().

See also deleteTexture().

GLuint QGLPixelBuffer::bindTexture(const QString \&fileName)

This is an overloaded function.

Reads the DirectDrawSurface (DDS) compressed file fileName and generates a 2D GL texture from it.

Equivalent to calling QGLContext::bindTexture().

See also deleteTexture().

Upstream PySide2 reference signatures (binding differences may apply):

bindTexture(self, fileName: str) -> int
bindTexture(self, image: PySide2.QtGui.QImage, target: int=...) -> int
bindTexture(self, pixmap: PySide2.QtGui.QPixmap, target: int=...) -> int

Source: https://doc.qt.io/archives/qt-5.15/qglpixelbuffer.html#bindTexture

bindToDynamicTexture

bindToDynamicTexture(texture: int) -> bool

X.bindToDynamicTexture(texture) -> bool

Supplemental documentation: Qt 5 reference:

bool QGLPixelBuffer::bindToDynamicTexture(GLuint texture_id)

Binds the texture specified by texture_id to this pbuffer. Returns true on success; otherwise returns false.

The texture must be of the same size and format as the pbuffer.

To unbind the texture, call releaseFromDynamicTexture(). While the texture is bound, it is updated automatically when the pbuffer contents change, eliminating the need for additional copy operations.

Example:

QGLPixelBuffer pbuffer(...);
...
pbuffer.makeCurrent();
GLuint dynamicTexture = pbuffer.generateDynamicTexture();
pbuffer.bindToDynamicTexture(dynamicTexture);
...
pbuffer.releaseFromDynamicTexture();

Warning: This function uses the render_texture extension, which is currently not supported under X11. An alternative that works on all systems (including X11) is to manually copy the pbuffer contents to a texture using updateDynamicTexture().

Warning: For the bindToDynamicTexture() call to succeed on the macOS, the pbuffer needs a shared context, i.e. the QGLPixelBuffer must be created with a share widget.

See also generateDynamicTexture() and releaseFromDynamicTexture().

Upstream PySide2 reference signatures (binding differences may apply):

bindToDynamicTexture(self, texture: int) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qglpixelbuffer.html#bindToDynamicTexture

context

context() -> Any

X.context() -> PythonQt.QtOpenGL.QGLContext

Supplemental documentation: Qt 5 reference:

QGLContext *QGLPixelBuffer::context() const

Returns the context of this pixelbuffer.

Upstream PySide2 reference signatures (binding differences may apply):

context(self) -> PySide2.QtOpenGL.QGLContext

Source: https://doc.qt.io/archives/qt-5.15/qglpixelbuffer.html#context

deleteTexture

deleteTexture(texture_id: int) -> None

X.deleteTexture(texture_id)

Supplemental documentation: Qt 5 reference:

void QGLPixelBuffer::deleteTexture(GLuint texture_id)

Removes the texture identified by texture_id from the texture cache.

Equivalent to calling QGLContext::deleteTexture().

Upstream PySide2 reference signatures (binding differences may apply):

deleteTexture(self, texture_id: int) -> None

Source: https://doc.qt.io/archives/qt-5.15/qglpixelbuffer.html#deleteTexture

devType

devType() -> int

X.devType() -> int

Upstream PySide2 reference signatures (binding differences may apply):

devType(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qglpixelbuffer.html#devType

doneCurrent

doneCurrent() -> bool

X.doneCurrent() -> bool

Supplemental documentation: Qt 5 reference:

bool QGLPixelBuffer::doneCurrent()

Makes no context the current OpenGL context. Returns true on success; otherwise returns false.

Upstream PySide2 reference signatures (binding differences may apply):

doneCurrent(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qglpixelbuffer.html#doneCurrent

drawTexture

drawTexture(point: Any, textureId: int, textureTarget: int) -> None

X.drawTexture(point, textureId, textureTarget)

Supplemental documentation: Qt 5 reference:

void QGLPixelBuffer::drawTexture(const QRectF \&target, GLuint textureId, GLenum textureTarget \= GL_TEXTURE_2D)

Draws the given texture, textureId, to the given target rectangle, target, in OpenGL model space. The textureTarget should be a 2D texture target.

Equivalent to the corresponding QGLContext::drawTexture().

This function was introduced in Qt 4.4.

void QGLPixelBuffer::drawTexture(const QPointF \&point, GLuint textureId, GLenum textureTarget \= GL_TEXTURE_2D)

Draws the given texture, textureId, at the given point in OpenGL model space. The textureTarget parameter should be a 2D texture target.

Equivalent to the corresponding QGLContext::drawTexture().

This function was introduced in Qt 4.4.

Upstream PySide2 reference signatures (binding differences may apply):

drawTexture(self, point: PySide2.QtCore.QPointF, textureId: int, textureTarget: int=...) -> None
drawTexture(self, target: PySide2.QtCore.QRectF, textureId: int, textureTarget: int=...) -> None

Source: https://doc.qt.io/archives/qt-5.15/qglpixelbuffer.html#drawTexture

format

format() -> Any

X.format() -> PythonQt.QtOpenGL.QGLFormat

Supplemental documentation: Qt 5 reference:

QGLFormat QGLPixelBuffer::format() const

Returns the format of the pbuffer. The format may be different from the one that was requested.

Upstream PySide2 reference signatures (binding differences may apply):

format(self) -> PySide2.QtOpenGL.QGLFormat

Source: https://doc.qt.io/archives/qt-5.15/qglpixelbuffer.html#format

generateDynamicTexture

generateDynamicTexture() -> int

X.generateDynamicTexture() -> int

Supplemental documentation: Qt 5 reference:

GLuint QGLPixelBuffer::generateDynamicTexture() const

Generates and binds a 2D GL texture that is the same size as the pbuffer, and returns the texture's ID. This can be used in conjunction with bindToDynamicTexture() and updateDynamicTexture().

See also size().

Upstream PySide2 reference signatures (binding differences may apply):

generateDynamicTexture(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qglpixelbuffer.html#generateDynamicTexture

handle

handle() -> int

X.handle()

Supplemental documentation: Qt 5 reference:

Qt::HANDLE QGLPixelBuffer::handle() const

Returns the native pbuffer handle.

Upstream PySide2 reference signatures (binding differences may apply):

handle(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qglpixelbuffer.html#handle

hasOpenGLPbuffers

hasOpenGLPbuffers() -> bool

X.hasOpenGLPbuffers() -> bool

Supplemental documentation: Qt 5 reference:

[static] bool QGLPixelBuffer::hasOpenGLPbuffers()

Returns true if the OpenGL pbuffer extension is present on this system; otherwise returns false.

Upstream PySide2 reference signatures (binding differences may apply):

hasOpenGLPbuffers() -> bool

Source: https://doc.qt.io/archives/qt-5.15/qglpixelbuffer.html#hasOpenGLPbuffers

isValid

isValid() -> bool

X.isValid() -> bool

Supplemental documentation: Qt 5 reference:

bool QGLPixelBuffer::isValid() const

Returns true if this pbuffer is valid; otherwise returns false.

Upstream PySide2 reference signatures (binding differences may apply):

isValid(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qglpixelbuffer.html#isValid

makeCurrent

makeCurrent() -> bool

X.makeCurrent() -> bool

Supplemental documentation: Qt 5 reference:

bool QGLPixelBuffer::makeCurrent()

Makes this pbuffer the current OpenGL rendering context. Returns true on success; otherwise returns false.

See also QGLContext::makeCurrent() and doneCurrent().

Upstream PySide2 reference signatures (binding differences may apply):

makeCurrent(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qglpixelbuffer.html#makeCurrent

metric

metric(metric: Any) -> int

X.metric(metric) -> int

Supplemental documentation: Qt 5 reference:

[override virtual protected] int QGLPixelBuffer::metric(QPaintDevice::PaintDeviceMetric metric) const

Reimplements: QPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const.

Upstream PySide2 reference signatures (binding differences may apply):

metric(self, metric: PySide2.QtGui.QPaintDevice.PaintDeviceMetric) -> int

Source: https://doc.qt.io/archives/qt-5.15/qglpixelbuffer.html#metric

paintEngine

paintEngine() -> Any

X.paintEngine() -> PythonQt.QtGui.QPaintEngine

Supplemental documentation: Qt 5 reference:

[override virtual] QPaintEngine *QGLPixelBuffer::paintEngine() const

Reimplements: QPaintDevice::paintEngine() const.

Upstream PySide2 reference signatures (binding differences may apply):

paintEngine(self) -> PySide2.QtGui.QPaintEngine

Source: https://doc.qt.io/archives/qt-5.15/qglpixelbuffer.html#paintEngine

releaseFromDynamicTexture

releaseFromDynamicTexture() -> None

X.releaseFromDynamicTexture()

Supplemental documentation: Qt 5 reference:

void QGLPixelBuffer::releaseFromDynamicTexture()

Releases the pbuffer from any previously bound texture.

See also bindToDynamicTexture().

Upstream PySide2 reference signatures (binding differences may apply):

releaseFromDynamicTexture(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qglpixelbuffer.html#releaseFromDynamicTexture

size

size() -> Any

X.size() -> PythonQt.QtCore.QSize

Supplemental documentation: Qt 5 reference:

QSize QGLPixelBuffer::size() const

Returns the size of the pbuffer.

Upstream PySide2 reference signatures (binding differences may apply):

size(self) -> PySide2.QtCore.QSize

Source: https://doc.qt.io/archives/qt-5.15/qglpixelbuffer.html#size

toImage

toImage() -> Any

X.toImage() -> PythonQt.QtGui.QImage

Supplemental documentation: Qt 5 reference:

QImage QGLPixelBuffer::toImage() const

Returns the contents of the pbuffer as a QImage.

Upstream PySide2 reference signatures (binding differences may apply):

toImage(self) -> PySide2.QtGui.QImage

Source: https://doc.qt.io/archives/qt-5.15/qglpixelbuffer.html#toImage

updateDynamicTexture

updateDynamicTexture(texture_id: int) -> None

X.updateDynamicTexture(texture_id)

Supplemental documentation: Qt 5 reference:

void QGLPixelBuffer::updateDynamicTexture(GLuint texture_id) const

Copies the pbuffer contents into the texture specified with texture_id.

The texture must be of the same size and format as the pbuffer.

Example:

QGLPixelBuffer pbuffer(...);
...
pbuffer.makeCurrent();
GLuint dynamicTexture = pbuffer.generateDynamicTexture();
...
pbuffer.updateDynamicTexture(dynamicTexture);

An alternative on Windows and macOS systems that support the render_texture extension is to use bindToDynamicTexture() to get dynamic updates of the texture.

See also generateDynamicTexture() and bindToDynamicTexture().

Upstream PySide2 reference signatures (binding differences may apply):

updateDynamicTexture(self, texture_id: int) -> None

Source: https://doc.qt.io/archives/qt-5.15/qglpixelbuffer.html#updateDynamicTexture