QSharedGLTexture Class | Qt 3D 5.13.0

Qt 5.13 | Qt 3D | C++ Classes | QSharedGLTexture

Qt 5.13.0 Reference Documentation

# QSharedGLTexture Class

(Qt3DRender::QSharedGLTexture)

Allows to use a textureId from a separate OpenGL context in a Qt 3D scene. More...

Header: | #include <QSharedGLTexture>
Since: | Qt 5.13
Inherits: | Qt3DRender::QAbstractTexture

This class was introduced in Qt 5.13.

- List of all members, including inherited members
- Obsolete members

## Properties

- textureId : int

- 17 properties inherited from Qt3DRender::QAbstractTexture
- 3 properties inherited from Qt3DCore::QNode
- 1 property inherited from QObject

## Public Functions

int | textureId() const

- 23 public functions inherited from Qt3DRender::QAbstractTexture
- 13 public functions inherited from Qt3DCore::QNode
- 30 public functions inherited from QObject

## Public Slots

void | setTextureId(int id)

- 12 public slots inherited from Qt3DRender::QAbstractTexture
- 3 public slots inherited from Qt3DCore::QNode
- 1 public slot inherited from QObject

## Signals

void | textureIdChanged(int textureId)

- 15 signals inherited from Qt3DRender::QAbstractTexture
- 4 signals inherited from Qt3DCore::QNode
- 2 signals inherited from QObject

## Related Non-Members

typedef | QNodePtr
typedef | QNodeVector
typedef | QObjectList
QList<T> | qFindChildren(const QObject *obj, const QRegExp &regExp)
Qt3DCore::QNodeId | qIdForNode(Qt3DCore::QNode *node)
Qt3DCore::QNodeIdVector | qIdsForNodes(const T &nodes)
T | qobject_cast(QObject *object)
T | qobject_cast(const QObject *object)

## Macros

| QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
| Q_CLASSINFO(Name, Value)
| Q_DISABLE_COPY(Class)
| Q_DISABLE_COPY_MOVE(Class)
| Q_DISABLE_MOVE(Class)
| Q_EMIT
| Q_ENUM(...)
| Q_ENUM_NS(...)
| Q_FLAG(...)
| Q_FLAG_NS(...)
| Q_GADGET
| Q_INTERFACES(...)
| Q_INVOKABLE
| Q_NAMESPACE
| Q_OBJECT
| Q_PROPERTY(...)
| Q_REVISION
| Q_SET_OBJECT_NAME(Object)
| Q_SIGNAL
| Q_SIGNALS
| Q_SLOT
| Q_SLOTS

### Additional Inherited Members

- 9 static public members inherited from QObject
- 1 protected function inherited from Qt3DRender::QAbstractTexture
- 2 protected functions inherited from Qt3DCore::QNode
- 9 protected functions inherited from QObject

## Detailed Description

Depending on the rendering mode used by Qt 3D, the shared context will either be:

- qt_gl_global_share_context when letting Qt 3D drive the rendering. When setting the attribute Qt::AA_ShareOpenGLContexts on the QApplication class, this will automatically make QOpenGLWidget instances have their context shared with qt_gl_global_share_context.
- the shared context from the QtQuick scene. You might have to subclass QWindow or use QtQuickRenderControl to have control over what that shared context is though as of 5.13 it is qt_gl_global_share_context.

Any 3rd party engine that shares its context with the Qt 3D renderer can now provide texture ids that will be referenced by the Qt 3D texture.

You can omit specifying the texture properties, Qt 3D will try at runtime to determine what they are. If you know them, you can of course provide them, avoid additional work for Qt 3D.

Keep in mind that if you are using custom materials and shaders, you need to specify the correct sampler type to be used.

## Property Documentation

### textureId : int

The OpenGL texture id value that you want Qt3D to gain access to.

Access functions:

int | textureId() const
void | setTextureId(int id)

Notifier signal:

void | textureIdChanged(int textureId)