- Qt 5.3
- Qt Quick
- C++ Classes
- QSGSimpleTextureNode
- Qt 5.3.2 Reference Documentation

# QSGSimpleTextureNode Class

The QSGSimpleTextureNode class is provided for convenience to easily draw textured content using the QML scene graph. More...

Header: | `#include <QSGSimpleTextureNode>`
qmake: | `QT += quick`
Inherits: | QSGGeometryNode.

- List of all members, including inherited members

## Public Types

enum | TextureCoordinatesTransformFlag { NoTransform, MirrorHorizontally, MirrorVertically }
flags | TextureCoordinatesTransformMode

## Public Functions

| QSGSimpleTextureNode()
QSGTexture::Filtering | filtering() const
QRectF | rect() const
void | setFiltering(QSGTexture::Filtering filtering)
void | setRect(const QRectF & r)
void | setRect(qreal x, qreal y, qreal w, qreal h)
void | setTexture(QSGTexture * texture)
void | setTextureCoordinatesTransform(TextureCoordinatesTransformMode mode)
QSGTexture * | texture() const
TextureCoordinatesTransformMode | textureCoordinatesTransform() const

- 4 public functions inherited from QSGGeometryNode
- 3 public functions inherited from QSGBasicGeometryNode
- 20 public functions inherited from QSGNode

## Detailed Description

The QSGSimpleTextureNode class is provided for convenience to easily draw textured content using the QML scene graph.

Warning: The simple texture node class must have a texture before being added to the scene graph to be rendered.

## Member Type Documentation

### enum QSGSimpleTextureNode::TextureCoordinatesTransformFlag
flags QSGSimpleTextureNode::TextureCoordinatesTransformMode

The TextureCoordinatesTransformFlag enum is used to specify the mode used to generate texture coordinates for a textured quad.

Constant | Value | Description
--- | --- | ---
`QSGSimpleTextureNode::NoTransform` | `0x00` | Texture coordinates are oriented with window coordinates i.e. with origin at top-left.
`QSGSimpleTextureNode::MirrorHorizontally` | `0x01` | Texture coordinates are inverted in the horizontal axis with respect to window coordinates
`QSGSimpleTextureNode::MirrorVertically` | `0x02` | Texture coordinates are inverted in the vertical axis with respect to window coordinates

The TextureCoordinatesTransformMode type is a typedef for QFlags<TextureCoordinatesTransformFlag>. It stores an OR combination of TextureCoordinatesTransformFlag values.

## Member Function Documentation

### QSGSimpleTextureNode::QSGSimpleTextureNode()

Constructs a new simple texture node

### QSGTexture::Filtering QSGSimpleTextureNode::filtering() const

Returns the filtering currently set on this texture node

See also setFiltering().

### QRectF QSGSimpleTextureNode::rect() const

Returns the target rect of this texture node.

See also setRect().

### void QSGSimpleTextureNode::setFiltering(QSGTexture::Filtering filtering)

Sets the filtering to be used for this texture node to filtering.

For smooth scaling, use QSGTexture::Linear; for normal scaling, use QSGTexture::Nearest.

See also filtering().

### void QSGSimpleTextureNode::setRect(const QRectF & r)

Sets the target rect of this texture node to r.

See also rect().

### void QSGSimpleTextureNode::setRect(qreal x, qreal y, qreal w, qreal h)

This is an overloaded function.

Sets the rectangle of this texture node to begin at (x, y) and have width w and height h.

### void QSGSimpleTextureNode::setTexture(QSGTexture * texture)

Sets the texture of this texture node to texture.

Warning: A texture node must have a texture before being added to the scenegraph to be rendered.

See also texture().

### void QSGSimpleTextureNode::setTextureCoordinatesTransform(TextureCoordinatesTransformMode mode)

Sets the method used to generate texture coordinates to mode. This can be used to obtain correct orientation of the texture. This is commonly needed when using a third party OpenGL library to render to texture as OpenGL has an inverted y-axis relative to Qt Quick.

See also textureCoordinatesTransform().

### QSGTexture * QSGSimpleTextureNode::texture() const

Returns the texture for this texture node

See also setTexture().

### TextureCoordinatesTransformMode QSGSimpleTextureNode::textureCoordinatesTransform() const

Returns the mode used to generate texture coordinates for this node.

See also setTextureCoordinatesTransform().