[Interest] EGL & QML
Jeff Lancaster
jlancaster at vivint.com
Wed Jan 29 02:19:38 CET 2014
My video app uses the EGL interface of which I created a new qdeclarativevideooutput object to implement it.
But when I run it in the example app, qmlvideo, where the video is displayed in a 250x250 rectangle my video does not play within the designated area (center screen), it is offset in the lower-right corner of the screen with just the upper-left quarter of the video showing.
I need to understand what I need to do to my declarative interface to have my video feature work properly with any UI view that calls it.
Where can I find information regarding this problem.
I am using the following shader programs:
virtual const char *vertexShader() const {
const char *shader =
"attribute highp vec4 vertexCoordArray;\n"
"attribute highp vec2 textureCoordArray;\n"
"uniform highp mat4 positionMatrix;\n"
"varying highp vec2 textureCoord;\n"
"void main(void)\n"
"{\n"
" gl_Position = positionMatrix * vertexCoordArray;\n"
" textureCoord = textureCoordArray;\n"
"}\n";
return shader;
}
virtual const char *fragmentShader() const {
static const char *shader =
"#extension GL_OES_EGL_image_external : require\n"
"precision mediump float;\n"
"uniform samplerExternalOES tex;\n"
"varying vec2 textureCoord;\n"
"void main()\n"
"{\n"
" gl_FragColor = texture2D(tex, textureCoord.st);\n"
"}\n";
return shader;
}
And enabling the following features:
program()->enableAttributeArray("vertexCoordArray");
program()->enableAttributeArray("textureCoordArray");
program()->setAttributeArray("vertexCoordArray", vertexCoordArray, 2);
program()->setAttributeArray("textureCoordArray", textureCoordArray, 2);
program()->setUniformValue("positionMatrix", positionMatrix);
(I set up the data in vertexCoordArray, textureCoordArray, and positionMatrix before running the above lines of code)
It all runs fine with a simple app:
import QtQuick 2.0
import QtMultimedia 5.0
Rectangle {
width: 800
height: 600
color: "black"
MediaPlayer {
id: player
source: "clip.mp4"
autoPlay: true
}
VideoOutput {
id: videoOutput
source: player
anchors.fill: parent
}
}
Best regards,
Jeff Lancaster • Sr Software Engineer •
jlancaster at vivint.com • P: 801.229.6010 • C: 801.xxx.xxxx
simply smarter • vivint.com
2500 West Executive Pkwy. Lehi, UT 84043
More information about the Interest
mailing list