コード例 #1
0
        public void Create(long Key, int Width, int Height)
        {
            if (Fbs.TryGetValue(Key, out FrameBuffer Fb))
            {
                if (Fb.Width != Width ||
                    Fb.Height != Height)
                {
                    SetupTexture(Fb.TexHandle, Width, Height);

                    Fb.Width  = Width;
                    Fb.Height = Height;
                }

                return;
            }

            Fb = new FrameBuffer(Width, Height, true);

            SetupTexture(Fb.TexHandle, Width, Height);

            GL.BindFramebuffer(FramebufferTarget.Framebuffer, Fb.Handle);

            GL.BindRenderbuffer(RenderbufferTarget.Renderbuffer, Fb.RbHandle);

            GL.RenderbufferStorage(
                RenderbufferTarget.Renderbuffer,
                RenderbufferStorage.Depth24Stencil8,
                Width,
                Height);

            GL.FramebufferRenderbuffer(
                FramebufferTarget.Framebuffer,
                FramebufferAttachment.DepthStencilAttachment,
                RenderbufferTarget.Renderbuffer,
                Fb.RbHandle);

            GL.FramebufferTexture(
                FramebufferTarget.Framebuffer,
                FramebufferAttachment.ColorAttachment0,
                Fb.TexHandle,
                0);

            GL.DrawBuffer(DrawBufferMode.ColorAttachment0);

            Fbs.Add(Key, Fb);
        }
コード例 #2
0
        private void CreateRawFb(int Width, int Height)
        {
            if (RawFb == null)
            {
                RawFb = new FrameBuffer(Width, Height, false);

                SetupTexture(RawFb.TexHandle, Width, Height);

                RawFb.Width  = Width;
                RawFb.Height = Height;

                GL.BindFramebuffer(FramebufferTarget.Framebuffer, RawFb.Handle);

                GL.FramebufferTexture(
                    FramebufferTarget.Framebuffer,
                    FramebufferAttachment.ColorAttachment0,
                    RawFb.TexHandle,
                    0);

                GL.Viewport(0, 0, Width, Height);
            }
        }
コード例 #3
0
 public void InitializeFrameBuffer()
 {
     FbRenderer = new FrameBuffer(1280, 720);
 }