ShaderEffectSourceThe ShaderEffectSource element renders a QML element into a texture and displays it. More... Inherits Item This type was introduced in Qt 5.0. Properties
MethodsDetailed DescriptionThe ShaderEffectSource element renders sourceItem into a texture and displays it in the scene. sourceItem is drawn into the texture as though it was a fully opaque root element. Thus sourceItem itself can be invisible, but still appear in the texture. ShaderEffectSource can be used as:
The ShaderEffectSource element does not redirect any mouse or keyboard input to sourceItem. If you hide the sourceItem by setting visible to false or opacity to zero, it will no longer react to input. In cases where the ShaderEffectSource is meant to replace the sourceItem, you typically want to hide the sourceItem while still handling input. For this, you can use the hideSource property. Note: If sourceItem is a Rectangle with border, by default half the border width falls outside the texture. To get the whole border, you can extend the sourceRect. Note: The ShaderEffectSource relies on FBO multisampling support to antialias edges. If the underlying hardware does not support this, which is the case for most embedded graphics chips, edges rendered inside a ShaderEffectSource will not be antialiased. One way to remedy this is to double the size of the effect source and render it with smooth: true. This will be equivalent to 4x multisampling, at the cost of lower performance and higher memory use. Warning: In most cases, using a ShaderEffectSource will decrease performance, and in all cases, it will increase video memory usage. Rendering through a ShaderEffectSource might also lead to lower quality since some OpenGL implementations support multisampled backbuffer, but not multisampled framebuffer objects. Property DocumentationThis property defines the internal OpenGL format of the texture. Modifying this property makes most sense when the element is used as a source texture of a ShaderEffect. Depending on the OpenGL implementation, this property might allow you to save some texture memory.
Note: Some OpenGL implementations do not support the GL_ALPHA format. If this property is true, the sourceItem is hidden, though it will still be rendered into the texture. As opposed to hiding the sourceItem by setting visible to false, setting this property to true will not prevent mouse or keyboard input from reaching sourceItem. The property is useful when the ShaderEffectSource is anchored on top of, and meant to replace the sourceItem. If this property is true, the texture is updated whenever the sourceItem updates. Otherwise, it will be a frozen image, even if sourceItem is assigned a new element. The property is true by default. If this property is true, mipmaps are generated for the texture. Note: Some OpenGL ES 2 implementations do not support mipmapping of non-power-of-two textures. Set this property to true if the ShaderEffectSource has a dependency on itself. ShaderEffectSources form a dependency chain, where one ShaderEffectSource can be part of the sourceItem of another. If there is a loop in this chain, a ShaderEffectSource could end up trying to render into the same texture it is using as source, which is not allowed by OpenGL. When this property is set to true, an extra texture is allocated so that ShaderEffectSource can keep a copy of the texture from the previous frame. It can then render into one texture and use the texture from the previous frame as source. Setting both this property and live to true will cause the scene graph to render continuously. Since the ShaderEffectSource depends on itself, updating it means that it immediately becomes dirty again. This property holds the element to be rendered into the texture. Setting this to null while live is true, will release the texture resources. This property defines which rectangular area of the sourceItem to render into the texture. The source rectangle can be larger than sourceItem itself. If the rectangle is null, which is the default, the whole sourceItem is rendered to texture. This property holds the requested size of the texture. If it is empty, which is the default, the size of the source rectangle is used. Note: Some platforms have a limit on how small framebuffer objects can be, which means the actual texture size might be larger than the requested size. This property defines the OpenGL wrap modes associated with the texture. Modifying this property makes most sense when the element is used as a source texture of a ShaderEffect.
Note: Some OpenGL ES 2 implementations do not support the GL_REPEAT wrap mode with non-power-of-two textures. Method DocumentationSchedules a re-rendering of the texture for the next frame. Use this to update the texture when live is false. |