QPaintedTextureImage

A QAbstractTextureImage that can be written through a QPainter . More

Inheritance diagram of PySide6.Qt3DRender.Qt3DRender.QPaintedTextureImage

Synopsis

Functions

Virtual functions

Detailed Description

A QPaintedTextureImage provides a way to specify a texture image (and thus an OpenGL texture) through a QPainter . The width and height of the texture image can be specified through the width and height or size properties.

A QPaintedTextureImage must be subclassed and the virtual paint() function implemented. Each time update() is called on the QPaintedTextureImage , the paint() function is invoked and the resulting image is uploaded.

The QPaintedTextureImage must be attached to some QAbstractTexture .

class PySide6.Qt3DRender.Qt3DRender.QPaintedTextureImage([parent=None])
Parameters

parentPySide6.Qt3DCore.Qt3DCore.QNode

PySide6.Qt3DRender.Qt3DRender.QPaintedTextureImage.height()
Return type

int

See also

setHeight()

PySide6.Qt3DRender.Qt3DRender.QPaintedTextureImage.heightChanged(w)
Parameters

w – int

PySide6.Qt3DRender.Qt3DRender.QPaintedTextureImage.paint(painter)
Parameters

painterPySide6.QtGui.QPainter

Paints the texture image with the specified QPainter object painter.

QPainter considers the top-left corner of an image as its origin, while OpenGL considers the bottom-left corner of a texture as its origin. An easy way to account for this difference is to set a custom viewport on the painter before doing any other painting:

painter->setViewport(0, height(), width(), -height());
...
PySide6.Qt3DRender.Qt3DRender.QPaintedTextureImage.setHeight(h)
Parameters

h – int

Sets the height (h) of the texture image. Triggers an update, if the size changes.

See also

height()

PySide6.Qt3DRender.Qt3DRender.QPaintedTextureImage.setSize(size)
Parameters

sizePySide6.QtCore.QSize

Sets the width and height of the texture image. Triggers an update, if the size changes.

See also

size()

PySide6.Qt3DRender.Qt3DRender.QPaintedTextureImage.setWidth(w)
Parameters

w – int

Sets the width (w) of the texture image. Triggers an update, if the size changes.

See also

width()

PySide6.Qt3DRender.Qt3DRender.QPaintedTextureImage.size()
Return type

PySide6.QtCore.QSize

See also

setSize()

PySide6.Qt3DRender.Qt3DRender.QPaintedTextureImage.sizeChanged(size)
Parameters

sizePySide6.QtCore.QSize

PySide6.Qt3DRender.Qt3DRender.QPaintedTextureImage.update([rect=QRect()])
Parameters

rectPySide6.QtCore.QRect

Immediately triggers the painted texture’s paint() function, which in turn uploads the new image to the GPU. If you are making multiple changes to a painted texture, consider waiting until all changes are complete before calling update, in order to minimize the number of repaints required.

Parameter rect is currently unused.

PySide6.Qt3DRender.Qt3DRender.QPaintedTextureImage.width()
Return type

int

See also

setWidth()

PySide6.Qt3DRender.Qt3DRender.QPaintedTextureImage.widthChanged(w)
Parameters

w – int