if (!m_RegisteredFormat) {
CameraDevice.Instance.SetFrameFormat(m_PixelFormat, true);
m_RegisteredFormat = true;
}
if (m_CanCapture) {
CameraDevice cam = CameraDevice.Instance;
Image image = cam.GetCameraImage(m_PixelFormat);
if (image == null) {
// not on mobile devices
Debug.Log(m_PixelFormat + " image is not available yet");
}
else {
// get MVP matrix
Matrix4x4 P = GL.GetGPUProjectionMatrix(Camera.main.projectionMatrix, false);
Matrix4x4 V = Camera.main.worldToCameraMatrix;
// use plane to get texcoords for target
Matrix4x4 M = mPlane.GetComponent<Renderer>().localToWorldMatrix;
Matrix4x4 MVP = P * V * M;