提供对 OpenGL 纹理对象的访问和启用采纳。 更多...
头: | #include < QSGTexture > |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS Quick)
target_link_libraries(mytarget PRIVATE Qt6::Quick) |
qmake: | QT += quick |
Since: | Qt 6.0 |
virtual GLuint | nativeTexture () const = 0 |
(从 6.0 起)
QSGTexture *
|
fromNative (GLuint textureId , QQuickWindow * window , const QSize & size , QQuickWindow::CreateTextureOptions options = {}) |
(since 6.1)
QSGTexture *
|
fromNativeExternalOES (GLuint textureId , QQuickWindow * window , const QSize & size , QQuickWindow::CreateTextureOptions options = {}) |
[static, since 6.0]
QSGTexture
*QSGOpenGLTexture::
fromNative
(
GLuint
textureId
,
QQuickWindow
*
window
, const
QSize
&
size
,
QQuickWindow::CreateTextureOptions
options
= {})
创建新的 QSGTexture wrapping an existing OpenGL texture object for window .
The native object specified in textureId is wrapped, but not owned, by the resulting QSGTexture 。函数调用者负责删除返回的 QSGTexture ,但不会销毁底层本机对象。
此函数目前仅适于 2D RGBA 纹理。
警告: This function will return null if the scenegraph has not yet been initialized.
使用 options 以自定义纹理属性。这里只考虑 TextureHasAlphaChannel 和 TextureHasMipmaps。
size 指定大小 (以像素为单位)。
注意: This function must be called on the scenegraph rendering thread.
该函数在 Qt 6.0 引入。
另请参阅 QQuickWindow::sceneGraphInitialized (), QSGTexture , 场景图形 - Metal 纹理导入 ,和 场景图形 - Vulkan 纹理导入 .
[static, since 6.1]
QSGTexture
*QSGOpenGLTexture::
fromNativeExternalOES
(
GLuint
textureId
,
QQuickWindow
*
window
, const
QSize
&
size
,
QQuickWindow::CreateTextureOptions
options
= {})
创建新的 QSGTexture wrapping an existing OpenGL ES texture object for window .
The native object specified in textureId is wrapped, but not owned, by the resulting QSGTexture 。函数调用者负责删除返回的 QSGTexture ,但不会销毁底层本机对象。
This function is suitable only for textures that are meant to be used with the
GL_TEXTURE_EXTERNAL_OES
target: usually textures to which another device (such as a camera) writes data.
警告: This function will return null if the scenegraph has not yet been initialized.
使用 options 以自定义纹理属性。这里只考虑 TextureHasAlphaChannel 和 TextureHasMipmaps。
size 指定大小 (以像素为单位)。
注意: This function must be called on the scenegraph rendering thread.
该函数在 Qt 6.1 引入。
另请参阅 fromNative ().
[pure virtual]
GLuint
QSGOpenGLTexture::
nativeTexture
() const
Returns the OpenGL texture ID.