Пример #1
0
        private static void Render(double d)
        {
            float delta = (float)d;

            Vector2D <float> winSize = window.Size.As <float>();
            Vector2D <float> fbSize  = window.FramebufferSize.As <float>();

            float pxRatio = fbSize.X / winSize.X;

            gl.Viewport(0, 0, (uint)winSize.X, (uint)winSize.Y);
            gl.ClearColor(0.3f, 0.3f, 0.32f, 1.0f);
            gl.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit | ClearBufferMask.StencilBufferBit);

            nvg.BeginFrame(winSize.As <float>(), pxRatio);

            DrawFontIncreasing("The quick brown fox...", 250.0f, 250.0f, 10.0f, delta);

            nvg.EndFrame();
        }
Пример #2
0
        private static void Render(double _)
        {
            double t  = timer.Elapsed.TotalSeconds;
            double dt = t - prevTime;

            prevTime = t;

            Vector2D <float> winSize = window.Size.As <float>();
            Vector2D <float> fbSize  = window.FramebufferSize.As <float>();

            float pxRatio = fbSize.X / winSize.X;

            gl.Viewport(0, 0, (uint)winSize.X, (uint)winSize.Y);
            if (premult)
            {
                gl.ClearColor(0, 0, 0, 0);
            }
            else
            {
                gl.ClearColor(0.3f, 0.3f, 0.32f, 1.0f);
            }
            gl.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit | ClearBufferMask.StencilBufferBit);

            nvg.BeginFrame(winSize.As <float>(), pxRatio);

            demo.Render((float)mx, (float)my, winSize.X, winSize.Y, (float)t, blowup);

            frameGraph.Render(5.0f, 5.0f, nvg);
            cpuGraph.Render(5.0f + 200.0f + 5.0f, 5.0f, nvg);

            nvg.EndFrame();

            cpuTime = timer.Elapsed.TotalSeconds - t;

            frameGraph.Update((float)dt);
            cpuGraph.Update((float)cpuTime);

            if (screenshot)
            {
                screenshot = false;
                SaveScreenShot((int)fbSize.X, (int)fbSize.Y, premult, "dump.png");
            }
        }