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); }
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); } }
public void InitializeFrameBuffer() { FbRenderer = new FrameBuffer(1280, 720); }