private bool UpdateTextures() { bool result = true; if (_manager.TextureConversionMethod == AVProLiveCameraManager.ConversionMethod.Unity4 || _manager.TextureConversionMethod == AVProLiveCameraManager.ConversionMethod.Unity35_OpenGL) { int lastFrameUpdated = AVProLiveCameraPlugin.GetLastFrameUploaded(_deviceIndex); if (_lastFrameUpdated == lastFrameUpdated) { result = false; } else { _lastFrameUpdated = lastFrameUpdated; result = true; } return(result); } else { for (int i = 0; i < _buffers.Count; i++) { if (!_buffers[i].Update()) { result = false; break; } } } return(result); }
private bool UpdateTextures() { bool result = false; int lastFrameUpdated = AVProLiveCameraPlugin.GetLastFrameUploaded(_deviceIndex); if (_lastFrameUpdated != lastFrameUpdated) { _lastFrameUpdated = lastFrameUpdated; result = true; } return(result); }
public bool Update() { bool result = false; AVProLiveCameraManager.ConversionMethod method = AVProLiveCameraManager.Instance.TextureConversionMethod; #if AVPRO_UNITY_4_X || UNITY_3_5 if (method == AVProLiveCameraManager.ConversionMethod.Unity4 || method == AVProLiveCameraManager.ConversionMethod.Unity35_OpenGL) { // We update all the textures from AVProLiveCameraManager.Update() // so just check if the update was done int lastFrameUploaded = AVProLiveCameraPlugin.GetLastFrameUploaded(_deviceIndex); if (_lastFrameUploaded != lastFrameUploaded) { _lastFrameUploaded = lastFrameUploaded; result = true; } return(result); } #endif #if UNITY_3_4 // Update the OpenGL texture directly if (method == AVProLiveCameraManager.ConversionMethod.Unity34_OpenGL) { result = AVProLiveCameraPlugin.UpdateTextureGL(_deviceIndex, _texture.GetNativeTextureID()); GL.InvalidateState(); } #endif #if !AVPRO_UNITY_4_X // Update the texture using Unity scripting, this is the slowest method if (method == AVProLiveCameraManager.ConversionMethod.UnityScript) { result = AVProLiveCameraPlugin.GetFramePixels(_deviceIndex, _framePointer, _bufferIndex, _texture.width, _texture.height); if (result) { _texture.SetPixels32(_frameData); _texture.Apply(false, false); } } #endif return(result); }