ShaderImage QML Type
Provides Image access to shader programs. More...
Import Statement: | import Qt3D.Render 2.14 |
Since: | Qt 5.14 |
Instantiates: | QShaderImage |
Detailed Description
To make the content of textures available for read and write operations in a shader, they need to exposed as ShaderImage. Textures can be composed of several mip levels, layers and faces. Additionally declaring a ShaderImage allows specifying which level, layer or face of the texture content we want to access.
ShaderImage has to be assigned as a Parameter's value and reference a valid Qt3D.Render.AbstractTexture to work properly.
If the referenced texture is a one-dimensional array, two-dimensional array, three-dimensional, cube map, cube map array, or two-dimensional multisample array texture, it is possible to bind either the entire texture level or a single layer or face of the texture level. This can be controlled with the layered property.
Support for ShaderImage is only supported with OpenGL 4 and partially with OpenGL ES 3.1 and 3.2.
OpenGL 4 supports the following image types:
GLSL Type | OpenGL Type Enum | Texture Type |
---|---|---|
image1D | GL_IMAGE_1D | Texture1D |
image2D | GL_IMAGE_2D | Texture2D |
image3D | 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 supports the following image types:
GLSL Type | OpenGL Type Enum | Texture Type |
---|---|---|
image2D | GL_IMAGE_2D | Texture2D |
image3D | 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 supports all of the OpenGL ES 3.1 image types as well as the following:
GLSL Type | OpenGL Type Enum | Texture Type |
---|---|---|
imageBuffer | GL_IMAGE_BUFFER | TextureBuffer |
imageCubeArray | GL_IMAGE_CUBE_MAP_ARRAY | TextureCubeMapArray |
iimageBuffer | GL_IMAGE_BUFFER | 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 |
Expected use would look like:
import Qt3D.Render 2.14 Entity { ... Texture2D { id: tex2D ... } Material { parameters: Parameter { name: "imageUniformName" value: ShaderImage { texture: tex2D } } ... } ... }