Редактировать: Я начинаю работу в разработке QT/QML и Android.Shader не работает в Android - приложение QT/QML
Shader не работает в Android - QT/QML Application
У меня есть разработчику приложения с использованием Qt/QML и портировал приложение в Andriod.
Я использовал шейдер в приложении.
Пока развертывание в Android-шейдере не работает.
QOpenGLShader::compile(Fragment): ERROR: 0:11: ':' : wrong operand types no operation ':' exists that takes a left-hand operand of type 'float' and a right operand of type 'const int' (or there is no acceptable conversion)
varying highp vec2 qt_TexCoord0; // The coords within the source item uniform sampler2D source; // The source item texture
Редактировать
ShaderEffect {
anchors.fill: wrapper
id:shader
// Any property you add to the ShaderEffectItem is accessible as a
// "uniform" value in the shader program. See GLSL doc for details.
// Essentially, this is a value you pass to the fragment shader,
// which is the same for every pixel, thus its name.
// Here we add a source item (the scene) as a uniform value. Within the
// shader, we can access it as a sampler2D which is the type used to
// access pixels in a texture. So the source item becomes a texture.
property variant source: ShaderEffectSource
{
sourceItem: scene // The item you want to apply the effect to
hideSource: true // Only show the modified item, not the original
}
property real dividerValue: 0.9
// This is the fragment shader code in GLSL (GL Shading Language)
fragmentShader: "
varying highp vec2 qt_TexCoord0; // The coords within the source item
uniform sampler2D source; // The source item texture
uniform float dividerValue;
void main(void)
{
// Read the source color of the pixel
vec4 sourceColor = texture2D(source, qt_TexCoord0);
// The alpha value of the mask
float alpha = (qt_TexCoord0.x>dividerValue)?1.0:((qt_TexCoord0.x>(dividerValue-.1))?((qt_TexCoord0.x-(dividerValue-0.1))/0.1):0); // = 0.0 at left, 1.0 at right border
// float alpha = (qt_TexCoord0.x>dividerValue)?1.0:qt_TexCoord0.x/dividerValue;
// Multiply the alpha mask on the color to be drawn:
sourceColor *= alpha;
// Write the pixel to the output image
gl_FragColor = sourceColor;
}
"
Чувак, вам 5 лет в СО. Можете ли вы хотя бы переформатировать этот салат кода и уточнить свой вопрос? – folibis