QSharedGLTexture Class

class Qt3DRender ::QSharedGLTexture

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

頭: #include <Qt3DRender/QTexture>
qmake: QT += 3drender
Since: Qt 5.13
實例化: SharedGLTexture
繼承: Qt3DRender::QAbstractTexture

該類在 Qt 5.13 引入。

特性

公共函數

int textureId () const

公共槽

void setTextureId (int id )

信號

void textureIdChanged (int textureId )

詳細描述

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.

特性文檔編製

textureId : int

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

訪問函數:

int textureId () const
void setTextureId (int id )

通知程序信號:

void textureIdChanged (int textureId )