QTextureImage Class

class Qt3DRender::QTextureImage

Encapsulates the necessary information to create an OpenGL texture image from an image source. More...

Header: #include <QTextureImage>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3drender)
target_link_libraries(mytarget PRIVATE Qt6::3drender)
qmake: QT += 3drender
Instantiated By: TextureImage
Inherits: Qt3DRender::QAbstractTextureImage

Public Types

enum Status { None, Loading, Ready, Error }

Properties

Public Functions

QTextureImage(Qt3DCore::QNode *parent = nullptr)
bool isMirrored() const
QUrl source() const
Qt3DRender::QTextureImage::Status status() const

Public Slots

void setMirrored(bool mirrored)
void setSource(const QUrl &source)

Signals

void mirroredChanged(bool mirrored)
void sourceChanged(const QUrl &source)
void statusChanged(Qt3DRender::QTextureImage::Status status)

Protected Functions

void setStatus(Qt3DRender::QTextureImage::Status status)

Detailed Description

It contains the necessary information mipmap level, layer, cube face and source URL to load at the proper place data into an OpenGL texture.

Member Type Documentation

enum QTextureImage::Status

This enumeration specifies the status values for texture image loading.

ConstantValueDescription
Qt3DRender::QTextureImage::None0The texture image loading has not been started yet.
Qt3DRender::QTextureImage::Loading1The texture image loading has started, but not finised.
Qt3DRender::QTextureImage::Ready2The texture image loading has finished.
Qt3DRender::QTextureImage::Error3The texture image loading confronted an error.

Property Documentation

mirrored : bool

This property specifies whether the image should be mirrored when loaded. This is a convenience to avoid having to manipulate images to match the origin of the texture coordinates used by the rendering API. By default this property is set to true. This has no effect when using GPU compressed texture formats.

Warning: This property results in a performance price payed at runtime when loading uncompressed or CPU compressed image formats such as PNG. To avoid this performance price it is better to set this property to false and load texture assets that have been pre-mirrored.

Note: OpenGL specifies the origin of texture coordinates from the lower left hand corner whereas DirectX uses the the upper left hand corner.

Note: When using cube map texture you'll probably want mirroring disabled as the cube map sampler takes a direction rather than regular texture coordinates.

Access functions:

bool isMirrored() const
void setMirrored(bool mirrored)

Notifier signal:

void mirroredChanged(bool mirrored)

source : QUrl

This property holds the source url from which data for the texture image will be loaded.

Access functions:

QUrl source() const
void setSource(const QUrl &source)

Notifier signal:

void sourceChanged(const QUrl &source)

[read-only] status : const Status

This property holds the status of the texture image loading.

Access functions:

Qt3DRender::QTextureImage::Status status() const

Notifier signal:

void statusChanged(Qt3DRender::QTextureImage::Status status)

Member Function Documentation

[explicit] QTextureImage::QTextureImage(Qt3DCore::QNode *parent = nullptr)

Constructs a new Qt3DRender::QTextureImage instance with parent as parent.

bool QTextureImage::isMirrored() const

Returns whether mirroring is enabled or not.

Note: Getter function for property mirrored.

[slot] void QTextureImage::setMirrored(bool mirrored)

Sets mirroring to mirrored.

Note: This internally triggers a call to update the data generator.

Note: Setter function for property mirrored.

See also isMirrored().

[slot] void QTextureImage::setSource(const QUrl &source)

Sets the source url of the texture image to source.

Note: This internally triggers a call to update the data generator.

Note: Setter function for property source.

See also source().

[protected] void QTextureImage::setStatus(Qt3DRender::QTextureImage::Status status)

Sets the status to status. status

See also status().

QUrl QTextureImage::source() const

Returns the source url from which data for the texture image will be loaded.

Note: Getter function for property source.

See also setSource().

Qt3DRender::QTextureImage::Status QTextureImage::status() const

Returns the current status.

Note: Getter function for property status.

See also setStatus().

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.