ShaderImage QML Type
Proporciona acceso de imagen a los programas de sombreado. Más...
| Import Statement: | import Qt3D.Render 2.11 |
| In C++: | QShaderImage |
| Status: | Deprecated |
Propiedades
Descripción detallada
Para que el contenido de las texturas esté disponible para operaciones de lectura y escritura en un shader, es necesario exponerlas como ShaderImage. Las texturas pueden estar compuestas de varios niveles mip, capas y caras. Adicionalmente declarar un ShaderImage permite especificar a que nivel, capa o cara del contenido de la textura queremos acceder.
ShaderImage tiene que ser asignado como valor de un parámetro y hacer referencia a un Qt3D.Render.AbstractTexture válido para que funcione correctamente.
Si la textura referenciada es un array unidimensional, un array bidimensional, una textura tridimensional, un mapa cúbico, un array de mapa cúbico, o un array multi-muestra bidimensional, es posible enlazar o bien todo el nivel de textura o bien una sola capa o cara del nivel de textura. Esto puede controlarse con la propiedad layered.
El soporte para ShaderImage sólo es compatible con OpenGL 4 y parcialmente con OpenGL ES 3.1 y 3.2.
OpenGL 4 soporta los siguientes tipos de imagen:
| Tipo GLSL | Tipo OpenGL Enum | Tipo de textura |
|---|---|---|
| imagen1D | GL_IMAGE_1D | Texture1D |
| imagen2D | GL_IMAGE_2D | Texture2D |
| imagen3D | GL_IMAGE_3D | Texture3D |
| image2DRect | GL_IMAGE_2D_RECT | TextureRectangle |
| imageCube | GL_IMAGE_CUBE | TextureCubeMap |
| imageBuffer | GL_IMAGE_BUFFER | TextureBuffer |
| image1DArray | GL_IMAGE_1D_ARRAY | Texture1DArray |
| image2DArray | GL_IMAGE_2D_ARRAY | Texture2DArray |
| imageCubeArray | GL_IMAGE_CUBE_MAP_ARRAY | TextureCubeMapArray |
| image2DMS | GL_IMAGE_2D_MULTISAMPLE | Texture2DMultisample |
| image2DMSArray | GL_IMAGE_2D_MULTISAMPLE_ARRAY | Texture2DMultisampleArray |
| iimage1D | GL_INT_IMAGE_1D | Texture1D |
| iimage2D | GL_INT_IMAGE_2D | Texture2D |
| iimage3D | GL_INT_IMAGE_3D | Texture3D |
| iimage2DRect | GL_INT_IMAGE_2D_RECT | TextureRectangle |
| iimageCube | GL_INT_IMAGE_CUBE | TextureCubeMap |
| iimageBuffer | GL_INT_IMAGE_BUFFER | TextureBuffer |
| iimage1DArray | GL_INT_IMAGE_1D_ARRAY | Texture1DArray |
| iimage2DArray | GL_INT_IMAGE_2D_ARRAY | Texture2DArray |
| iimageCubeArray | GL_INT_IMAGE_CUBE_MAP_ARRAY | TextureCubeMapArray |
| iimage2DMS | GL_INT_IMAGE_2D_MULTISAMPLE | Texture2DMultisample |
| iimage2DMSArray | GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY | Texture2DMultisampleArray |
| uimage1D | GL_UNSIGNED_INT_IMAGE_1D | Texture1D |
| uimage2D | GL_UNSIGNED_INT_IMAGE_2D | Texture2D |
| uimage3D | GL_UNSIGNED_INT_IMAGE_3D | Texture3D |
| uimage2DRect | GL_UNSIGNED_INT_IMAGE_2D_RECT | TextureRectangle |
| uimageCube | GL_UNSIGNED_INT_IMAGE_CUBE | TextureCubeMap |
| uimageBuffer | GL_UNSIGNED_INT_IMAGE_BUFFER | TextureBuffer |
| uimage1DArray | GL_UNSIGNED_INT_IMAGE_1D_ARRAY | Texture1DArray |
| uimage2DArray | GL_UNSIGNED_INT_IMAGE_2D_ARRAY | Texture2DArray |
| uimageCubeArray | GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY | TextureCubeMapArray |
| uimage2DMS | GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE | Texture2DMultisample |
| uimage2DMSArray | GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY | Texture2DMultisampleArray |
OpenGL ES 3.1 admite los siguientes tipos de imagen:
| Tipo GLSL | Tipo OpenGL Enum | Tipo de textura |
|---|---|---|
| imagen2D | GL_IMAGE_2D | Texture2D |
| imagen3D | GL_IMAGE_3D | Texture3D |
| imageCube | GL_IMAGE_CUBE | TextureCubeMap |
| image2DArray | GL_IMAGE_2D_ARRAY | Texture2DArray |
| iimage2D | GL_INT_IMAGE_2D | Texture2D |
| iimage3D | GL_INT_IMAGE_3D | Texture3D |
| iimageCube | GL_INT_IMAGE_CUBE | TextureCubeMap |
| iimage2DArray | GL_INT_IMAGE_2D_ARRAY | Texture2DArray |
| uimage2D | GL_UNSIGNED_INT_IMAGE_2D | Texture2D |
| uimage3D | GL_UNSIGNED_INT_IMAGE_3D | Texture3D |
| uimageCube | GL_UNSIGNED_INT_IMAGE_CUBE | TextureCubeMap |
| uimage2DArray | GL_UNSIGNED_INT_IMAGE_2D_ARRAY | Texture2DArray |
OpenGL ES 3.2 admite todos los tipos de imagen de OpenGL ES 3.1, así como los siguientes:
| Tipo GLSL | Tipo OpenGL Enum | Tipo de textura |
|---|---|---|
| imageBuffer | GL_IMAGE_BUFFER | TextureBuffer |
| imageCubeArray | GL_IMAGE_CUBE_MAP_ARRAY | TextureCubeMapArray |
| iimageBuffer | BÚFER_IMAGEN_GL | TextureBuffer |
| iimageCubeArray | GL_INT_IMAGE_CUBE_MAP_ARRAY | TextureCubeMapArray |
| uimageBuffer | GL_UNSIGNED_INT_IMAGE_BUFFER | TextureBuffer |
| uimageCubeArray | GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY | TextureCubeMapArray |
El uso esperado sería el siguiente
import Qt3D.Render 2.14
Entity {
...
Texture2D {
id: tex2D
...
}
Material {
parameters: Parameter {
name: "imageUniformName"
value: ShaderImage {
texture: tex2D
}
}
...
}
...
}Documentación de propiedades
access : enumeration
Especifica el tipo de acceso que queremos permitir desde nuestras instancias de sombreado a la imagen. Si un sombreador intenta escribir o leer de una imagen que tiene un acceso incompatible, el comportamiento es indefinido.
| Constante | Descripción |
|---|---|
ShaderImage.ReadOnly | Acceso de sólo lectura. |
ShaderImage.WriteOnly | Acceso de sólo escritura. |
ShaderImage.ReadWrite | Acceso de lectura y escritura. |
El valor por defecto es ShaderImage.ReadWrite.
format : enumeration
Especifica el formato de la imagen, que es esencialmente importante cuando se almacenan valores en ShaderImage desde un shader.
El formato no tiene que ser el mismo que el de la textura referenciada. Sin embargo tiene que ser compatible (coincidir en tamaño pero no necesariamente por tipo de clase). Por ejemplo una textura de formato R32F (tamaño 32bits, clase 1x32) podría ser utilizada con una imagen de formato RGBA8I (tamaño 32bits, clase 4x8). La tabla 8.27 de las especificaciones OpenGL muestra el tamaño y la clase para todos los formatos de imagen soportados.
Por defecto Qt3D intentará establecer el formato de imagen para que coincida con el de la textura referenciada.
El valor por defecto es ShaderImage.Automatic.
layer : int
Indica qué capa de la textura referenciada debe utilizarse para ShaderImage. Esta propiedad no hace nada si layered es igual a true o si el tipo de la textura de referencia no es compatible con las capas.
Nota: Cuando la textura referenciada es de tipo cube map o cube map array y ĺayered está establecido a false, la cara y la capa se recuperan de la siguiente manera:
cubeMapLayer = layer / 6 cubeMapFace = layer - (cubeMapLayer * 6)
El valor por defecto es 0.
layered : bool
*
Si se establece a true, si la textura referenciada es una matriz unidimensional, matriz bidimensional, tridimensional, mapa cúbico, matriz de mapa cúbico, o textura de matriz multi-muestra bidimensional, todo el nivel será enlazado para todas las capas. Si se establece a false, sólo se vinculará la capa especificada por la propiedad layer.
El valor por defecto es false.
mipLevel : int
Mantiene qué mipLevel de la textura referenciada debe usarse para ShaderImage.
El valor por defecto es 0.
© 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.