Hello.
I am working with Qt 5.5.1, QtQuick, with ShaderEffect object. In it I can specify vertex and fragment shaders. I have managed to create a copy of the texture and render two objects at the same time but I do not know how can I move textures. I know how to resize them but they are always in the upper left corner of the ShaderEffect.
Here is a source of my shaders:
vertexShader: "
uniform highp mat4 qt_Matrix;
attribute highp vec4 qt_Vertex;
attribute highp vec2 qt_MultiTexCoord0;
varying highp vec2 coord;
varying highp vec2 coord2;
uniform lowp float asd;
void main() {
coord = qt_MultiTexCoord0;
coord2 = qt_MultiTexCoord0;
coord2.x *= 2.0;
coord2.y *= 2.0;
gl_Position = qt_Matrix * qt_Vertex;
}"
fragmentShader: "
varying highp vec2 coord;
varying highp vec2 coord2;
uniform sampler2D ses;
uniform lowp float r;
uniform lowp float g;
uniform lowp float b;
void main() {
lowp vec4 clr = texture2D(ses, coord);
lowp vec4 clr2 = texture2D(ses, coord2);
gl_FragColor = vec4((r * clr.r + r * clr2.r) / 2.0,
(g * clr.g + g * clr2.g) / 2.0,
(b * clr.b + b * clr2.b) / 2.0, clr.a);
}
"
Any help would be appreciated. Thank you.