Log in or register to post comments

VideoPlayback Sample

March 20, 2013 - 5:33am #1

hey

I am using a chroma key shader to play a video, how can i scale the video dimension to the screen height and width rather than the target height and width?

 

VideoPlayback Sample

March 21, 2013 - 6:00am #7

Excellent.

VideoPlayback Sample

March 21, 2013 - 5:39am #6

thanks a ton

working like a charm  :)

VideoPlayback Sample

March 20, 2013 - 2:29pm #5

thank you

will try this and let you know

VideoPlayback Sample

March 20, 2013 - 2:04pm #4

Hi,

you could achieve that by setting the modelview matrix to identity (instead of computing it from the trackable pose) and the projection matrix to an orthographic projection, using this function:

 

void
setOrthoMatrix(float nLeft, float nRight, float nBottom, float nTop,
    float nNear, float nFar, float *nProjMatrix)
{
    if (!nProjMatrix)
    {
        LOG("Orthographic projection matrix pointer is NULL");
        return;
    }

    int i;
    for (i = 0; i < 16; i++)
        nProjMatrix[i] = 0.0f;

    nProjMatrix[0] = 2.0f / (nRight - nLeft);
    nProjMatrix[5] = 2.0f / (nTop - nBottom);
    nProjMatrix[10] = 2.0f / (nNear - nFar);
    nProjMatrix[12] = -(nRight + nLeft) / (nRight - nLeft);
    nProjMatrix[13] = -(nTop + nBottom) / (nTop - nBottom);
    nProjMatrix[14] = (nFar + nNear) / (nFar - nNear);
    nProjMatrix[15] = 1.0f;
}

 

 

VideoPlayback Sample

March 20, 2013 - 1:17pm #3

thank you for the reply

is there any way to trick the system and play the video with height and width of the device

my video is chroma keyed using a shader for transparency, i want to detect the marker and then the video to be played on top of the camera stream.

VideoPlayback Sample

March 20, 2013 - 6:05am #2

Hi,

the video is rendered on a textured rectangle which is aligned with the trackable surface (i.e. it is oriented in 3D space), so its scale will only make sense in the 3D world; 

making it match the screen size would only make sense if you were to render it screen-aligned (in 2D).

Am I missing something in your question ?

 

Log in or register to post comments