我在VideoOutput上使用opacityMask,并在Samsung Note 9上部署了应用程序。当我将屏幕分辨率更改为1480x720时,opacityMask的功能运行良好。但是,当我将屏幕更改为更高分辨率的2220x1080或2960x1440时,出现错误GLConsumer [SurfaceTexture-0-5380-1] bindTextureImage,清除GL错误0x502,并且屏幕仅显示黑色矩形。谁能帮助我解决此问题,谢谢。这是我的代码。
导入QtQuick 2.11 导入QtMultimedia 5.8 导入QtQuick.Controls 1.4 导入QtGraphicalEffects 1.0
项目{ id:根 宽度:1644 高度:3840 属性实际scaleBoundaryBlue:1 属性实际比例边界掩码:1 房地产实际规模环:0 房地产真实比例图片:0 属性真实不透明度环:1 属性布尔图片隐藏:错误 属性实yBoundaryMove:0
function getFrontCameraId() {
if (QtMultimedia.availableCameras.length > 1) {
var front = /front/ig;
for (var i = 0; i < QtMultimedia.availableCameras.length; i++) {
if (QtMultimedia.availableCameras[i].displayName.match(front))
return QtMultimedia.availableCameras[i].deviceId
}
} else { return QtMultimedia.availableCameras[0].deviceId }
}
VideoOutput {
id: videoOutput
anchors.fill: parent
source: camera
fillMode: Qt.KeepAspectRatio
autoOrientation: true
visible: false
Component.onCompleted: {
videoOutput.source = camera
}
}
Rectangle{
id: backGround
anchors.fill: parent
color: "#1b1b1c"
}
Image {
id: ring
source: "qrc:/DriverMonitorring_Parts/ripple1.png"
scale: root.scaleRing
opacity: root.opacityRing
x: root.width/2 - ring.width/2
y: root.height/2 - ring.height/2
}
Image {
id: big
source: "qrc:/DriverMonitorring_Parts/ball-l.png"
scale : root.scaleBoundaryBlue
x: root.width/2 - big.width/2
y: root.height/2 - big.height/2 + yBoundaryMove
}
Image {
id: refsmall
source: "qrc:/DriverMonitorring_Parts/ball-l-mask.png"
visible: false
}
Rectangle {
id: small
width: refsmall.width
height: refsmall.height
radius: refsmall.height
scale: root.scaleBoundaryMask
x: root.width/2 - small.width/2
y: root.height/2 - small.height/2 + yBoundaryMove
color: "#1B1B1C"
}
// **************Camera************
Camera {
id: camera
deviceId: getFrontCameraId()
viewfinder.resolution: "2220x1080"
Component.onCompleted:
{
camera.start()
}
}
//*******************Video of Camera***********
Item {
id: containerVideo
width: 1644
height: 3840
Item {
id: mask
width: 1644
height: 3840
Rectangle {
id: opa
width: 984
height: 984
radius: 984
x: 1644/2 - 984/2
y: 3840/2 - 984/2 + yBoundaryMove
scale: root.scalePicture
}
}
}
OpacityMask{
anchors.fill: containerVideo
source: videoOutput
maskSource: mask
cached: true
}
//******Animation**************
SequentialAnimation{
running: true
ParallelAnimation{
NumberAnimation {
target: root
property: "scalePicture"
from: 180/big.width
to: 1
duration: 2000
}
NumberAnimation {
target: root
properties: "scaleBoundaryBlue"
from: 180/big.width
to : 1
duration: 2000
}
NumberAnimation {
target: root
properties: "scaleBoundaryMask"
from: 180/big.width
to : 1
duration: 2000
}
NumberAnimation {
target: root
property: "yBoundaryMove"
from : -500
to: 0
duration: 2000
}
}
ParallelAnimation {
NumberAnimation {
target: root
property: "opacityRing"
to: 0
duration: 2500
}
NumberAnimation {
target: root
property: "scaleRing"
from: big.width/ring.width
to: 1.5
duration: 2500
}
}
}
}