提供對 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 = {}) |
(從 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.