コード例 #1
0
ファイル: BasicGameHost.cs プロジェクト: jorolf/osu-framework
        protected virtual void DrawFrame()
        {
            using (DrawMonitor.BeginCollecting(PerformanceCollectionType.GLReset))
            {
                GLWrapper.Reset(DrawSize);
                GLWrapper.ClearColour(Color4.Black);
            }

            while (true)
            {
                using (var buffer = DrawRoots.Get(UsageType.Read))
                {
                    if (buffer?.Object != null && buffer.FrameId != lastDrawFrameId)
                    {
                        buffer.Object.Draw(null);
                        lastDrawFrameId = buffer.FrameId;
                        break;
                    }
                }

                Thread.Sleep(1);
            }

            GLWrapper.FlushCurrentBatch();

            using (DrawMonitor.BeginCollecting(PerformanceCollectionType.SwapBuffer))
                Window.SwapBuffers();
        }
コード例 #2
0
        protected virtual void DrawFrame()
        {
            using (DrawMonitor.BeginCollecting(PerformanceCollectionType.GLReset))
            {
                GLWrapper.Reset(DrawSize);
                GLWrapper.ClearColour(Color4.Black);
            }

            using (var buffer = DrawRoots.Get(UsageType.Read))
                buffer?.Object?.Draw(null);

            GLWrapper.FlushCurrentBatch();

            using (DrawMonitor.BeginCollecting(PerformanceCollectionType.SwapBuffer))
                Window.SwapBuffers();
        }