• Sort Posts • 6 replies

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?

Excellent.

thanks a ton

working like a charm  :)

thank you

will try this and let you know

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 = 2.0f / (nRight - nLeft);
nProjMatrix = 2.0f / (nTop - nBottom);
nProjMatrix = 2.0f / (nNear - nFar);
nProjMatrix = -(nRight + nLeft) / (nRight - nLeft);
nProjMatrix = -(nTop + nBottom) / (nTop - nBottom);
nProjMatrix = (nFar + nNear) / (nFar - nNear);
nProjMatrix = 1.0f;
}
```

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.

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 ?