Hi all,
I’m encountering a strange issue and I’m not sure where to look in order to debug it. I’m using the ciWMFVideoPlayer block on MSW 10 with VS2013 to blend two videos together, see code below:
Shader:
#version 150
in vec2 TexCoords0;
in vec2 TexCoords1;
out vec4 oColour;
uniform sampler2DRect uBaseTexture;
uniform sampler2DRect uGhostTexture;
uniform vec2 uBaseRes;
uniform vec2 uGhostRes;
vec4 combineSources(float percentageGhost) {
vec4 base = texture(uBaseTexture, TexCoords0 * uBaseRes);
vec4 ghost = texture(uGhostTexture, TexCoords0 * uGhostRes);
return vec4(base.xyz, 1.0-percentageGhost) + vec4(ghost.xyz, percentageGhost);
}
void main(void)
{
//vec4 base = texture(uGhostTexture, TexCoords0 * uGhostRes);
//oColour = base;
oColour = combineSources(0.5);
}
Drawing:
ci::gl::ScopedViewport(getWindowSize());
ci::gl::ScopedMatrices scopedMatrices;
ci::gl::ScopedColor scp(ci::Color::white());
// bind the shader
ci::gl::ScopedGlslProg glscp(mPlayBackGlsl);
// set the uniforms
mPlayBackGlsl->uniform("uBaseTexture", 0);
mPlayBackGlsl->uniform("uGhostTexture", 1);
mPlayBackGlsl->uniform("uBaseRes", ci::vec2(mLeftRecordVideo.getWidth(), mLeftRecordVideo.getHeight()));
mPlayBackGlsl->uniform("uGhostRes", ci::vec2(mUserVideoLeft.getWidth(), mUserVideoLeft.getHeight()));
// bind the textures
ciWMFVideoPlayer::ScopedVideoTextureBind scpBindBase(mLeftRecordVideo, (uint8_t)0);
ciWMFVideoPlayer::ScopedVideoTextureBind scpBindGhost(mUserVideoLeft, (uint8_t)1);//draw
ci::gl::drawSolidRect(ci::app::getWindowBounds());
I’m getting the desired output and it’s achieving the right effect. When I run the app at full resolution (1920 x 1080) I have no issues. However, when I enable setFullScreen(true) the performance appears to suffer drastically. What’s stranger still, is that my frameRate remains at 60fps ( not the most reliable measure of performance, I know) even when in fullScreen. By “performance deteriorating” I mean that both video sources appear to be playing at somewhere around 0.5 speed, even though this functionality exists nowhere in the app. If I alt+tab to bring the IDE window on top of the app window, I can see the video playback performance return to normal even though it’s in the background running in fullScreen.
I’ve browsed through the Cinder sourcecode for the setFullScreen() method but nothing stands out at me. Not sure if it has anything to do with the WMF sharing the texture with the GL context from DirectX, but I don’t know where to beginning looking.
Any insights would be appreciated.