Пример #1
0
        static void OnPreRender()
        {
            _renderer.UpdateRenderTree();

            if (_renderer.NeedsOffscreen())
            {
                _renderer.RenderOffscreen();
            }
        }
Пример #2
0
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            _time += e.Time;
            Title  = //$"{_title}: (Vsync: {VSync}) FPS: {1f / e.Time:0}, "+
                     "pos:" + view.getX() + "," + view.getY() + " mousePos: " + mousePos.X + "," + mousePos.Y + "shipPos:" + player.pos.X + "," + player.pos.Y;
            Color4 backColor;

            backColor.A = 1.0f;
            backColor.R = 0.1f;
            backColor.G = 0.1f;
            backColor.B = 0.3f;
            GL.ClearColor(backColor);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
            GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
            GL.ClearStencil(0);


            GL.Enable(EnableCap.Blend);
            GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);
            //SpriteDrawer.Draw(texture, Vector2.Zero, Vector2.One, Color.Azure, new Vector2(((float)texture.Width)/2, ((float)texture.Height)/2));
            if (inventoryOpen)
            {
                inventory.Draw();
            }
            else
            {
                foreach (SpaceObject so in spaceObjects)
                {
                    so.Draw();
                }
                player.Draw();
                SpriteDrawer.DrawCursor(cursorTexture, mousePos, Vector2.One, Color.Azure, new Vector2(((float)cursorTexture.Width) / 2, ((float)cursorTexture.Height) / 2));
            }

            renderer.UpdateRenderTree();

            if (renderer.NeedsOffscreen())
            {
                renderer.RenderOffscreen();
            }

            renderer.Render();

            SwapBuffers();
        }