Example #1
0
 public CVReturn DisplayLinkOutputCallback(CVDisplayLink displayLink, ref CVTimeStamp inNow,
                                           ref CVTimeStamp inOutputTime, CVOptionFlags flagsIn, ref CVOptionFlags flagsOut)
 {
     // There is no autorelease pool when this method is called because it will be called from a background thread
     // It's important to create one or you will leak objects
     // ReSharper disable once UnusedVariable
     using (var pool = new NSAutoreleasePool())
     {
         Device.BeginInvokeOnMainThread(() => SendSignals());
     }
     return(CVReturn.Success);
 }
		// Private Callback function for CVDisplayLink
		private CVReturn MyDisplayLinkOutputCallback (CVDisplayLink displayLink, ref CVTimeStamp inNow, ref CVTimeStamp inOutputTime, CVOptionFlags flagsIn, ref CVOptionFlags flagsOut)
		{
			//CVReturn result = GetFrameForTime (inOutputTime);
			CVReturn result = CVReturn.Error;

			// There is no autorelease pool when this method is called because it will be called from a background thread
			// It's important to create one or you will leak objects
			using (NSAutoreleasePool pool = new NSAutoreleasePool ()) {
				// Update the animation
				BeginInvokeOnMainThread (RenderScene);
				result = CVReturn.Success;
			}

			return result;
		}
Example #3
0
 public CVReturn Unlock(CVOptionFlags unlockFlags)
 {
     return CVPixelBufferUnlockBaseAddress (handle, unlockFlags);
 }
Example #4
0
		public CVReturn MyDisplayLinkOutputCallback (CVDisplayLink displayLink, ref CVTimeStamp inNow, ref CVTimeStamp inOutputTime, CVOptionFlags flagsIn, ref CVOptionFlags flagsOut)
		{
			CVReturn result = GetFrameForTime (inOutputTime);

			return result;
		}
 extern static CVReturn CVPixelBufferUnlockBaseAddress(IntPtr pixelBuffer, CVOptionFlags unlockFlags);
 public void Flush(CVOptionFlags flags)
 {
     CVMetalTextureCacheFlush(handle, flags);
 }
Example #7
0
        static CVReturn OutputCallback(IntPtr displayLink, ref CVTimeStamp inNow, ref CVTimeStamp inOutputTime, CVOptionFlags flagsIn, ref CVOptionFlags flagsOut, IntPtr displayLinkContext)
        {
            GCHandle callbackHandle        = GCHandle.FromIntPtr(displayLinkContext);
            DisplayLinkOutputCallback func = (DisplayLinkOutputCallback)callbackHandle.Target !;
            CVDisplayLink             delegateDisplayLink = new CVDisplayLink(displayLink, false);

            return(func(delegateDisplayLink, ref inNow, ref inOutputTime, flagsIn, ref flagsOut));
        }
Example #8
0
		public CVReturn Unlock (CVOptionFlags unlockFlags)
		{
			return CVPixelBufferUnlockBaseAddress (Handle, (CVPixelBufferLock) unlockFlags);
		}
        public static CVReturn RequestDraw(CVDisplayLink displayLink, ref CVTimeStamp inNow, ref CVTimeStamp inOutputTime, CVOptionFlags flagsIn, ref CVOptionFlags flagsOut)
        {
            NSApplication.SharedApplication.BeginInvokeOnMainThread(() => RequestDraw());

            return(CVReturn.Success);
        }
Example #10
0
 private static CVReturn MyDisplayLinkCallback(IntPtr displayLink, ref CVTimeStamp inNow, ref CVTimeStamp inOutputTime, CVOptionFlags flagsIn, ref CVOptionFlags flagsOut, IntPtr context)
 {
     //Console.WriteLine("MyDisplayLinkCallback " + inOutputTime.videoTime);
     MyOpenGLView view = ObjectiveCRuntime.GetInstance<MyOpenGLView> (context);
     return view.GetFrameForTime (ref inOutputTime);
 }
Example #11
0
 private CVReturn HandleDisplayLinkOutputCallback(CVDisplayLink displayLink, ref CVTimeStamp inNow, ref CVTimeStamp inOutputTime, CVOptionFlags flagsIn, ref CVOptionFlags flagsOut)
 {
     try
     {
         if (_paused)
         {
             return(CVReturn.Success);
         }
         if (GraphicsDevice != null)
         {
             if (_resized)
             {
                 _resized = false;
                 MainSwapchain.Resize(_width, _height);
                 Resized?.Invoke();
             }
             Rendering?.Invoke();
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine("Encountered an error while rendering: " + e);
         throw;
     }
     return(CVReturn.Success);
 }
Example #12
0
 public void Flush(CVOptionFlags flags)
 {
     CVMetalTextureCacheFlush (handle, flags);
 }
Example #13
0
 static extern void CVMetalTextureCacheFlush(
     /* CVMetalTextureCacheRef __nonnull */ IntPtr textureCache, CVOptionFlags flags);
Example #14
0
        // Private Callback function for CVDisplayLink
        static CVReturn DisplayLinkOutputCallback(IntPtr displayLink, ref CVTimeStamp inNow, ref CVTimeStamp inOutputTime, CVOptionFlags flagsIn, ref CVOptionFlags flagsOut, IntPtr displayLinkContext)
        {
            //CVReturn result = GetFrameForTime (inOutputTime);
            CVReturn result = CVReturn.Success;

            using (new NSAutoreleasePool())
            {
                try
                {
                    foreach (var view in _views)
                    {
                        view.Value.Draw();
                    }
                }
                catch (Exception e)
                {
                    Console.Error.WriteLine(e);
                    result = CVReturn.Error;
                }
            }

            return(result);
        }
Example #15
0
		public void Flush (CVOptionFlags flags)
		{
			CVOpenGLESTextureCacheFlush (handle, flags);
		}
 public void Flush(CVOptionFlags flags)
 {
     CVOpenGLESTextureCacheFlush(handle, flags);
 }
Example #17
0
 public CVReturn DisplayLinkOutputCallback(CVDisplayLink displayLink, ref CVTimeStamp inNow,
                                           ref CVTimeStamp inOutputTime, CVOptionFlags flagsIn, ref CVOptionFlags flagsOut)
 {
     Fire?.Invoke();
     return(CVReturn.Success);
 }
Example #18
0
        // Private Callback function for CVDisplayLink
        private CVReturn MyDisplayLinkOutputCallback(CVDisplayLink displayLink, ref CVTimeStamp inNow, ref CVTimeStamp inOutputTime, CVOptionFlags flagsIn, ref CVOptionFlags flagsOut)
        {
            //CVReturn result = GetFrameForTime (inOutputTime);
            CVReturn result = CVReturn.Error;

            // There is no autorelease pool when this method is called because it will be called from a background thread
            // It's important to create one or you will leak objects
            using (NSAutoreleasePool pool = new NSAutoreleasePool()) {
                // Update the animation
                RenderScene();
                result = CVReturn.Success;
            }

            return(result);
        }
Example #19
0
 CVReturn DisplayLinkOutputCallback(CVDisplayLink displayLink, ref CVTimeStamp inNow, ref CVTimeStamp inOutputTime, CVOptionFlags flagsIn, ref CVOptionFlags flagsOut)
 {
     Game.Instance.BeginInvokeOnMainThread(() => Game.Instance.EmitTick());
     return(CVReturn.Success);
 }
 extern static void CVMetalTextureCacheFlush(
     /* CVMetalTextureCacheRef __nonnull */ IntPtr textureCache, CVOptionFlags flags);
Example #21
0
        private CVReturn HandleDisplayLinkOutputCallback(CVDisplayLink displayLink, ref CVTimeStamp inNow, ref CVTimeStamp inOutputTime, CVOptionFlags flagsIn, ref CVOptionFlags flagsOut)
        {
            if (_newRenderSize != null)
            {
                Callback.OnResize(Widget, new ResizeEventArgs(_newRenderSize.Value));
                _newRenderSize = null;
            }

            Callback.OnDraw(Widget, EventArgs.Empty);
            return(CVReturn.Success);
        }
 public CVReturn Lock(CVOptionFlags lockFlags)
 {
     return(CVPixelBufferLockBaseAddress(handle, lockFlags));
 }
	static CVReturn OutputCallback (IntPtr displayLink, ref CVTimeStamp inNow, ref CVTimeStamp inOutputTime, CVOptionFlags flagsIn, ref CVOptionFlags flagsOut, IntPtr displayLinkContext)
	{
		GCHandle callbackHandle = GCHandle.FromIntPtr (displayLinkContext);
		DisplayLinkOutputCallback func = (DisplayLinkOutputCallback) callbackHandle.Target;
		CVDisplayLink delegateDisplayLink = new CVDisplayLink(displayLink, false);
		return func (delegateDisplayLink, ref inNow, ref inOutputTime, flagsIn, ref flagsOut);
	}
 public CVReturn Unlock(CVOptionFlags unlockFlags)
 {
     return(CVPixelBufferUnlockBaseAddress(handle, unlockFlags));
 }
Example #25
0
		CVReturn DisplayLinkOutputCallback (CVDisplayLink displayLink, ref CVTimeStamp inNow, ref CVTimeStamp inOutputTime, CVOptionFlags flagsIn, ref CVOptionFlags flagsOut)
		{
			Game.Instance.BeginInvokeOnMainThread ( () => Game.Instance.EmitTick () );
			return CVReturn.Success;
		}
Example #26
0
 public CVReturn Lock(CVOptionFlags lockFlags)
 {
     return CVPixelBufferLockBaseAddress (handle, lockFlags);
 }
        public CVReturn MyDisplayLinkOutputCallback(CVDisplayLink displayLink, ref CVTimeStamp inNow, ref CVTimeStamp inOutputTime, CVOptionFlags flagsIn, ref CVOptionFlags flagsOut)
        {
            CVTimeStamp time = inOutputTime;
            this.InvokeOnMainThread( () =>  {GetFrameForTime (time);} );

            return CVReturn.Success;
        }
Example #28
0
 static extern CVReturn CVPixelBufferUnlockBaseAddress(IntPtr pixelBuffer, CVOptionFlags unlockFlags);
		extern static CVReturn CVPixelBufferLockBaseAddress (IntPtr pixelBuffer, CVOptionFlags lockFlags);
        public CVReturn MyDisplayLinkOutputCallback(CVDisplayLink displayLink, ref CVTimeStamp inNow, ref CVTimeStamp inOutputTime, CVOptionFlags flagsIn, ref CVOptionFlags flagsOut)
        {
            CVReturn result = GetFrameForTime(inOutputTime);

            return(result);
        }
Example #31
0
		extern static void CVOpenGLESTextureCacheFlush (
			/* CVOpenGLESTextureCacheRef __nonnull */ IntPtr textureCache, CVOptionFlags flags);