Canvas3D QML Type | Qt Canvas 3D 1.0

- Qt 5.5
- Qt Canvas 3D
- QML Types
- Canvas3D QML Type
- Qt 5.5.1 Reference Documentation

# Canvas3D QML Type

Canvas that provides a 3D rendering context. More...

Import Statement: | import QtCanvas3D 1.0
Since: | QtCanvas3D 1.0

- List of all members, including inherited members

## Properties

- devicePixelRatio : float
- fps : int
- pixelSize : size

## Methods

- int frameTimeMs()
- Context3D getContext(string type, Canvas3DContextAttributes options)
- Context3D getContext(string type)

## Detailed Description

The Canvas3D is a QML element that, when placed in your Qt Quick 2 scene, allows you to get a 3D rendering context and call 3D rendering API calls through that context object. Use of the rendering API requires knowledge of OpenGL like rendering APIs.

There are two functions that are called by the Canvas3D implementation:

- initializeGL is emitted before the first frame is rendered, and usually during that you get the 3D context and initialize resources to be used later on during the rendering cycle.
- paintGL is emitted for each frame to be rendered, and usually during that you submit 3D rendering calls to draw whatever 3D content you want to be displayed.

See also Context3D.

## Property Documentation

devicePixelRatio : float

Specifies the ratio between logical pixels (used by the Qt Quick) and actual physical on-screen pixels (used by the 3D rendering).

fps : int

This property specifies the current frames per seconds, the value is calculated every 500 ms.

See also frameTimeMs.

pixelSize : size

Specifies the size of the render target surface in physical on-screen pixels used by the 3D rendering.

## Method Documentation

int frameTimeMs()

* * This method returns the number of milliseconds the last rendered frame took to process. Before * any frames have been rendered this method returns 0. This time is measured from the point * the paintGL() signal was sent to the time glFinish() returns. This excludes the time it * takes to present the frame on screen. *

See also fps.

Context3D getContext(string type, Canvas3DContextAttributes options)

Returns the 3D rendering context that allows 3D rendering calls to be made. The type parameter is ignored for now, but a string is expected to be given. The options parameter is only parsed when the first call to getContext() is made and is ignored in subsequent calls if given. If the first call is made without giving the options parameter, then the context and render target is initialized with default configuration.

See also Canvas3DContextAttributes and Context3D.

Context3D getContext(string type)

Returns the 3D rendering context that allows 3D rendering calls to be made. The type parameter is ignored for now, but a string is expected to be given.