- Qt 6.11
- Qt Quick
- C++ Classes
- RenderState
- Qt 6.11.2 Reference Documentation

# QSGRenderNode::RenderState Struct

struct QSGRenderNode::RenderState

Provides information about the projection matrix and clipping. More...

- List of all members, including inherited members

## Public Functions

virtual const QRegion * | clipRegion() const = 0
virtual void * | get(const char *state) const
virtual const QMatrix4x4 * | projectionMatrix() const = 0
virtual bool | scissorEnabled() const = 0
virtual QRect | scissorRect() const = 0
virtual bool | stencilEnabled() const = 0
virtual int | stencilValue() const = 0

## Detailed Description

The render state contains information for the renderer when invoking commands to the scenegraph backends.

See also QSGRenderNode::render().

## Member Function Documentation

### `[pure virtual]` const QRegion *RenderState::clipRegion() const

Returns the current clip region or null for backends where clipping is implemented via stencil or scissoring.

The `software` backend uses no projection, scissor or stencil, meaning most of the render state is not in use. However, the clip region that can be set on the QPainter still has to be communicated since reconstructing this manually in render() is not reasonable. It can therefore be queried via this function. The region is in world coordinates and can be passed to QPainter::setClipRegion() with Qt::ReplaceClip. This must be done before calling QPainter::setTransform() since the clip region is already mapped to the transform provided in QSGRenderNode::matrix().

### `[virtual]` void *RenderState::get(const char *state) const

Returns pointer to a state value.

Reserved for future use.

### `[pure virtual]` const QMatrix4x4 *RenderState::projectionMatrix() const

Returns pointer to the current projection matrix.

The model-view matrix can be retrieved with QSGRenderNode::matrix(). Typically `projection * modelview` is the matrix that is then used in the vertex shader to transform the vertices.

### `[pure virtual]` bool RenderState::scissorEnabled() const

Returns the current state of scissoring.

Note: Only relevant for graphics APIs that have a dedicated on/off state of scissoring.

### `[pure virtual]` QRect RenderState::scissorRect() const

Returns the current scissor rectangle when clipping is active. x and y are the bottom left coordinates.

### `[pure virtual]` bool RenderState::stencilEnabled() const

Returns the current state of stencil testing.

Note: With graphics APIs where stencil testing is enabled in pipeline state objects, instead of individual state-setting commands, it is up to the implementation of render() to enable stencil testing with operations `KEEP`, comparison function `EQUAL`, and a read and write mask of `0xFF`.

### `[pure virtual]` int RenderState::stencilValue() const

Returns the current stencil reference value when clipping is active.