在DelegateModelQML中使用时,显示具有OpenGL效果Dropshadow的图像失败

问题描述

要针对RaspBerry Pi 3b +交叉编译qt5.12.9,我关注了博客文章https://mechatronicsblog.com/cross-compile-and-deploy-qt-5-12-for-raspberry-pi/https://wiki.qt.io/RaspberryPi2EGLFS。在同步sysroot之前,我还运行过update-rpi。编译成功。我在pi上也支持eglfs。但是至少在某些情况下,我无法使openGl正常工作。我收到此错误和黑屏:

QOpenGLFramebufferObject: Framebuffer incomplete attachment.
QOpenGLShaderProgram: Could not create shader program
shader compilation Failed: 
""
QOpenGLShaderProgram::uniformlocation(matrix): shader program is not linked
QOpenGLShaderProgram::uniformlocation(opacity): shader program is not linked
QOpenGLShaderProgram: Could not create shader program
shader compilation Failed: 
""
QOpenGLShaderProgram::uniformlocation(matrix): shader program is not linked
QOpenGLShaderProgram::uniformlocation(textureScale): shader program is not linked
QOpenGLShaderProgram::uniformlocation(color): shader program is not linked
QOpenGLShaderProgram::uniformlocation(alphaMin): shader program is not linked
QOpenGLShaderProgram::uniformlocation(alphaMax): shader program is not linked
QOpenGLShaderProgram: Could not create shader program

仅当将项目与来自委托的opengl调用一起使用时,才会出现上述错误

DelegateModel{      
    id: mydelegatemodel      
    model: mymodel      
    delegate: RoundShadowIcon{      
        id: item      
        width: grid.cellWidth;      
        height: grid.cellHeight;      
    }      
}      
GridView{      
    clip: true      
    id: grid      
    anchors.fill: parent      
    cellWidth: 100      
    cellHeight: 100      
    model: mydelegatemodel      
}

RoundShadowIcon.qml:

import QtQuick 2.12
import QtGraphicalEffects 1.12

Item {
    Image {
        id: face
        source: "file:///usr/local/qt5pi/examples/myapp/cache/someimage.png"
        sourceSize: Qt.size(parent.width,parent.height)
        width: parent.width
        height: parent.height
        fillMode: Image.PreserveAspectCrop
        smooth: true
        visible: false
    }
    Rectangle{
        id: mask
        anchors.fill: parent
        radius: main.radius_
        visible: false
    }
    OpacityMask {
        id: round
        anchors.fill: face
        source: face
        maskSource: mask
    }
    DropShadow {
        id: shadow
        anchors.fill: parent
        horizontalOffset: 0
        verticalOffset: 0
        radius: 12.0
        samples: 17
        source: round
    }
}

独立运行。这是Qt中的错误吗? 在RaspBerry Pi 3b +上使用qt5.12.9进行了测试。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)