(The vec4 can hold "rgba" values if that's what you put in it - the example there just calls it "xyzw" because the data type generically handles any 4 floats.)
Basically, start from an example that draws an image with a simple glsl shader as a texture. Then hack on the shader until it flips around the colors like you want when it draws the texture. Then use your code that gets the image over the network to upload the image as the OpenGL texture every frame.
@GrecKo thanks for your comment. I've managed to create the window in which people would touch the video, but I'm not sure how to make the player. I've seen there is a library, Qt media, but I don't really know how to bind it with the other screen.
I think I found a solution. I roughly quadrupled the QCameraViewfinder size and repositioned it to the middle.
Its all done with "cameraVf->setGeometry(x,y,x,y);". And I parented the viewfinder to a new QFrame
to have a frame and to have the viewfinder not overlaying the start button.
QFrame *frameVideo = new QFrame(frame4); // extra frame where the video is in
camera = new QCamera("/dev/video0");
cameraVf = new QCameraViewfinder(frameVideo);
if(cameraVf->width() != 1600)
cameraVf->setGeometry(-590,-490,1600,1440); // zoom in
cameraVf->setGeometry(0,0,375,380); // zoom out
@raven-worx Got keys from plugin meta data ("audiocapture")
QFactoryLoader::QFactoryLoader() checking directory path "/home/MYPATH/build-desktop-system-dev-Desktop_Qt_5_5_1_GCC_32bit-Release/MY_PROJECT/mediaservice" ...
defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
Actually, I have now seen the .mov files played by QML's MediaPlayer on Windows. I'm making things slightly difficult for myself by not having a Windows machine in the house, so this has all been on an AWS EC2 instance; that gives you a Server2012R2 session... but that seems to have no media player support at all until you enable "Windows Desktop Experience". I also installed a "K-Lite Codec Pack", but since I'd installed that before I enabled the "desktop experience" stuff, I'm not sure if it was needed or not (will try and remove the codec pack at some point, if it's uninstallable; strongly suspect it is needed though). Anyway, that's the existence proof the .mov files can work I was looking for.
Thanks for the other suggestions...
I'm not too keen on turning to other tools like VLC or ffmpeg if I can possibly avoid it. Stock Qt has so far served me remarkably well as a one-stop shop for multiplatform applications and I'm very reluctant to have to bring in something else too. Transcoding my video content to something that worked everywhere would have been a more attractive solution if needed.
Just an update: I ended up just using a "container widget" that holds the video widget. This way I can just add the container widget to the layout and detach the video widget from the container when going full screen. Then I just add it back to the container instead of trying to add it to the layout exactly as it was. In my case, I'm actually using a QStackedWidget as the "container" since I need to switch the video out with other views anyways. It works out perfectly. This project is really coming along nicely. I'm loving Qt right now. :)
Just to be clear, it's not app crash, I did not describe it good.
Sometimes fullscreen mode look messy(look at image), let say it's happening every 10th time.
But, I can exit from that messy fullscreen and video plays in normal mode.