Example #1
0
    void Update()
    {
        if (_camera != null)
        {
            _device = _camera.Device;
        }

        if (_device != null && _device.IsActive && !_device.IsPaused)
        {
            if (_device.CurrentWidth > _frameWidth ||
                _device.CurrentHeight > _frameHeight)
            {
                CreateBuffer(_device.CurrentWidth, _device.CurrentHeight);
            }
            uint lastFrame = AVProLiveCameraPlugin.GetLastFrame(_device.DeviceIndex);
            if (lastFrame != _lastFrame)
            {
                _lastFrame = lastFrame;
                bool result = AVProLiveCameraPlugin.GetFrameAsColor32(_device.DeviceIndex, _framePointer, _frameWidth, _frameHeight);
                if (result)
                {
#if TEXTURETEST
                    _testTexture.SetPixels32(_frameData);
                    _testTexture.Apply(false, false);
#endif
                }
            }
        }
    }