public Framebuffer(Renderer R, int W, int H) { this.R = R; this.W = W; this.H = H; Color = new GLTexture(TextureTarget.Texture2D); Color.Bind(false); Color.Image2D(0, PixelInternalFormat.Rgba8, W, H, PixelFormat.Rgba, PixelType.UnsignedByte); Color.TexParameter(TextureParameterName.TextureMinFilter, TextureMinFilter.Nearest); Color.TexParameter(TextureParameterName.TextureMagFilter, TextureMagFilter.Nearest); DepthStencil = new GLTexture(TextureTarget.Texture2D); DepthStencil.Bind(false); DepthStencil.Image2D(0, PixelInternalFormat.DepthComponent32, W, H, PixelFormat.DepthComponent, PixelType.UnsignedInt); DepthStencil.TexParameter(TextureParameterName.TextureMinFilter, TextureMinFilter.Nearest); DepthStencil.TexParameter(TextureParameterName.TextureMagFilter, TextureMagFilter.Nearest); ID = GLf.GenFramebuffer(); GLf.BindFramebuffer(FramebufferTarget.Framebuffer, ID); GLf.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, Color.Target, Color.GetID, 0); GLf.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.DepthAttachment, DepthStencil.Target, DepthStencil.GetID, 0); Check(); Unbind(); }