En esta página

Qt3DRender::QSharedGLTexture Class

class Qt3DRender::QSharedGLTexture

Permite utilizar un textureId desde un contexto OpenGL separado en una escena Qt 3D. Más...

Cabecera: #include <Qt3DRender/QTexture>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3drender)
target_link_libraries(mytarget PRIVATE Qt6::3drender)
qmake: QT += 3drender
En QML: SharedGLTexture
Hereda: Qt3DRender::QAbstractTexture
Status: Obsoleto

Propiedades

Funciones públicas

int textureId() const

Ranuras públicas

void setTextureId(int id)

Señales

void textureIdChanged(int textureId)

Descripción detallada

Dependiendo del modo de renderizado utilizado por Qt 3D, el contexto compartido será:

  • qt_gl_global_share_context cuando se deja que Qt 3D maneje el renderizado. Al establecer el atributo Qt::AA_ShareOpenGLContexts en la clase QApplication, esto hara que automaticamente las instancias QOpenGLWidget tengan su contexto compartido con qt_gl_global_share_context.
  • el contexto compartido de la escena QtQuick. Puede que tengas que subclasificar QWindow o usar QtQuickRenderControl para tener control sobre cual es ese contexto compartido aunque a partir de 5.13 es qt_gl_global_share_context.

Cualquier motor de terceros que comparta su contexto con el renderizador de Qt 3D puede ahora proporcionar ids de textura que serán referenciados por la textura de Qt 3D.

Puedes omitir especificar las propiedades de la textura, Qt 3D intentará en tiempo de ejecución determinar cuáles son. Si las conoces, por supuesto puedes proporcionarlas, evitando trabajo adicional a Qt 3D.

Ten en cuenta que si estás utilizando materiales y shaders personalizados, necesitas especificar el tipo de muestreador correcto a utilizar.

Documentación de propiedades

textureId : int

El valor de id de textura OpenGL al que quieres que Qt3D acceda.

Funciones de acceso:

int textureId() const
void setTextureId(int id)

Señal notificadora:

void textureIdChanged(int textureId)

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.