public void MultisampledColorTextureMultiSampledRboDepth() { Framebuffer framebuffer = new Framebuffer(FramebufferTarget.Framebuffer); framebuffer.AddAttachment(FramebufferAttachment.ColorAttachment0, new Texture2DMultisample(8, 8, PixelInternalFormat.Rgba, 1)); framebuffer.AddAttachment(FramebufferAttachment.DepthAttachment, new SFGraphics.GLObjects.RenderBuffers.Renderbuffer(8, 8, 1, RenderbufferStorage.DepthComponent)); Assert.AreEqual(FramebufferErrorCode.FramebufferComplete, framebuffer.GetStatus()); Assert.AreEqual(2, framebuffer.Attachments.Count); }
public void DifferentSizedColorTextures() { Framebuffer framebuffer = new Framebuffer(FramebufferTarget.Framebuffer); var format = new TextureFormatUncompressed(PixelInternalFormat.Rgb, PixelFormat.Rgb, PixelType.Float); var texture1 = new Texture2D(); texture1.LoadImageData(8, 8, format); framebuffer.AddAttachment(FramebufferAttachment.ColorAttachment0, texture1); var texture2 = new Texture2D(); texture2.LoadImageData(1, 1, format); var e = Assert.ThrowsException <System.ArgumentOutOfRangeException>(() => framebuffer.AddAttachment(FramebufferAttachment.ColorAttachment1, texture2)); }
public void OneMultisampledColorTexture() { Framebuffer framebuffer = new Framebuffer(FramebufferTarget.Framebuffer); framebuffer.AddAttachment(FramebufferAttachment.ColorAttachment0, new Texture2DMultisample(8, 8, PixelInternalFormat.Rgba, 1)); Assert.AreEqual(FramebufferErrorCode.FramebufferComplete, framebuffer.GetStatus()); Assert.AreEqual(1, framebuffer.Attachments.Count); }
public void DifferentSizedColorTextures() { Framebuffer framebuffer = new Framebuffer(FramebufferTarget.Framebuffer); var format = new TextureFormatUncompressed(PixelInternalFormat.Rgb, PixelFormat.Rgb, PixelType.Float); var texture1 = new Texture2D(); texture1.LoadImageData(8, 8, format); framebuffer.AddAttachment(FramebufferAttachment.ColorAttachment0, texture1); var texture2 = new Texture2D(); texture2.LoadImageData(1, 1, format); var e = Assert.ThrowsException <ArgumentOutOfRangeException>(() => framebuffer.AddAttachment(FramebufferAttachment.ColorAttachment1, texture2)); Assert.IsTrue(e.Message.Contains("The attachment dimensions do not match the framebuffer's dimensions.")); Assert.AreEqual("attachment", e.ParamName); }
public void InitBuffers() { InitScene(); ScreenBuffer = new Framebuffer(FramebufferTarget.Framebuffer, this.Width, this.Height, 16, PixelInternalFormat.Rgba16f, 1); ScreenBuffer.Resize(Width, Height); PostEffects = new Framebuffer(FramebufferTarget.Framebuffer, Width, Height, PixelInternalFormat.Rgba16f, 1); PostEffects.Resize(Width, Height); BloomEffects = new Framebuffer(FramebufferTarget.Framebuffer, Width, Height, PixelInternalFormat.Rgba16f, 1); BloomEffects.Resize(Width, Height); if (USE_GBUFFER) { DepthTexture = new DepthTexture(Width, Height, PixelInternalFormat.DepthComponent24); //Set the GBuffer (Depth, Normals and another output) GBuffer = new Framebuffer(FramebufferTarget.Framebuffer); GBuffer.AddAttachment(FramebufferAttachment.ColorAttachment0, GLTexture2D.CreateUncompressedTexture(Width, Height, PixelInternalFormat.R11fG11fB10f, PixelFormat.Rgba, PixelType.Float)); GBuffer.AddAttachment(FramebufferAttachment.ColorAttachment3, GLTexture2D.CreateUncompressedTexture(Width, Height, PixelInternalFormat.Rgb10A2, PixelFormat.Rgba, PixelType.Float)); GBuffer.AddAttachment(FramebufferAttachment.ColorAttachment4, GLTexture2D.CreateUncompressedTexture(Width, Height, PixelInternalFormat.Rgb10A2, PixelFormat.Rgba, PixelType.Float)); GBuffer.AddAttachment(FramebufferAttachment.DepthAttachment, DepthTexture); GBuffer.SetReadBuffer(ReadBufferMode.None); GBuffer.SetDrawBuffers( DrawBuffersEnum.ColorAttachment0, DrawBuffersEnum.None, DrawBuffersEnum.None, DrawBuffersEnum.ColorAttachment3, DrawBuffersEnum.ColorAttachment4); GBuffer.Unbind(); } FinalBuffer = new Framebuffer(FramebufferTarget.Framebuffer, this.Width, this.Height, PixelInternalFormat.Rgba16f, 1); }
public void AddAttachmentChangesDimensions() { Framebuffer framebuffer = new Framebuffer(FramebufferTarget.Framebuffer); var format = new TextureFormatUncompressed(PixelInternalFormat.Rgb, PixelFormat.Rgb, PixelType.Float); var texture1 = new Texture2D(); texture1.LoadImageData(8, 4, format); framebuffer.AddAttachment(FramebufferAttachment.ColorAttachment0, texture1); Assert.AreEqual(8, framebuffer.Width); Assert.AreEqual(4, framebuffer.Height); Assert.AreEqual(FramebufferErrorCode.FramebufferComplete, framebuffer.GetStatus()); }