Пример #1
0
        public static void InitRenderer()
        {
            renderer.SetTextures(SheetManager.Sheets, SheetManager.SheetsUsed);
            debugRenderer.SetTextures(new[] { 0 });

            WorldRenderer.Initialize();
            UIRenderer.Initialize();
        }
Пример #2
0
        public static void UpdateViewport()
        {
            lock (GLLock)
            {
                GL.Viewport(0, 0, WindowInfo.Width, WindowInfo.Height);
                Program.CheckGraphicsError("View_Viewport");
                GL.Scissor(0, 0, WindowInfo.Width, WindowInfo.Height);
                Program.CheckGraphicsError("View_Scissor");
            }

            Camera.Update();
            UIRenderer.Update();
        }
Пример #3
0
        public static void Render()
        {
            lock (GLLock)
            {
                RenderCalls = 0;
                BatchCalls  = 0;
                Batches     = 0;
                if (Settings.EnablePixeling)
                {
                    GL.BindFramebuffer(FramebufferTarget.Framebuffer, frameBuffer);
                    GL.Clear(ClearBufferMask.ColorBufferBit);

                    var width  = (int)(Camera.DefaultZoom * WindowInfo.Ratio * PixelSize);
                    var height = (int)(Camera.DefaultZoom * PixelSize);
                    GL.Viewport(0, 0, width, height);
                    GL.Scissor(0, 0, width, height);

                    WorldRenderer.Render();

                    GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
                    GL.Clear(ClearBufferMask.ColorBufferBit);

                    UpdateViewport();

                    renderable.Bind();

                    var iden = Matrix4.CreateScale(1f);
                    Shaders.Uniform(Shaders.TextureShader, ref iden, Color.White);

                    renderable.Render();
                    Program.CheckGraphicsError("GLRendering_World");
                }
                else
                {
                    GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
                    GL.Clear(ClearBufferMask.ColorBufferBit);

                    WorldRenderer.Render();
                    Program.CheckGraphicsError("GLRendering_World");
                }

                UIRenderer.Render();
                Program.CheckGraphicsError("GLRendering_UI");
            }
        }
Пример #4
0
 public static void ResetRenderer(Game game)
 {
     PauseSequences = false;
     WorldRenderer.Reset(game);
     UIRenderer.Reset(game);
 }