Exemple #1
0
        protected override void OnDraw()
        {
            OpenGLContext.CGLContext.Lock().ThrowIfFailed("CGLContext.Lock()");
            try
            {
                OpenGLContext.MakeCurrentContext();

                _perFrame.OnNext(_stopwatch.Elapsed.TotalSeconds);

                _log.TrySomethingBlocking(Bootstrapper.OnUpdate);

                if (_unoWindow.Size.HasZeroArea())
                {
                    return;
                }

                if (Uno.Application.Current != null && Bootstrapper.DrawNextFrame)
                {
                    _unoGraphics.ChangeBackbuffer((GLFramebufferHandle)_renderTarget.GetFramebufferHandle(_unoWindow.Size));
                    _log.TrySomethingBlocking(Bootstrapper.OnDraw);
                    _renderTarget.Flush(OpenGLContext);
                }
            }
            finally
            {
                ++_currentFrame;
                OpenGLContext.CGLContext.Unlock().ThrowIfFailed("CGLContext.Unlock()");
            }
        }