public Texture2 AddColorTexture(FramebufferAttachment attachment, PixelInternalFormat pixelInternalFormat = PixelInternalFormat.Rgba8, PixelFormat pixelFormat = PixelFormat.Rgba) { Texture2 colorTexture; if (_samples == 1) { colorTexture = new Texture2(); colorTexture.SetImage(Size, pixelInternalFormat, pixelFormat); } else { colorTexture = new Texture2(true); colorTexture.SetMultisampleImage(Samples, pixelInternalFormat, Size); } AttachTexture(attachment, colorTexture); return(colorTexture); }
public Texture2 AddDepthTexture() { Texture2 depthTexture; if (_samples == 1) { depthTexture = new Texture2(); depthTexture.SetImage(Size, PixelInternalFormat.DepthComponent32, PixelFormat.DepthComponent); } else { depthTexture = new Texture2(); depthTexture.SetMultisampleImage(Samples, PixelInternalFormat.DepthComponent32, Size); } AttachTexture(FramebufferAttachment.DepthAttachment, depthTexture); return(depthTexture); }
public void AttachTexture(FramebufferAttachment attachment, Texture2 texture) { Assert.True(texture.Size == Size); texture.Anisotropy = 1; texture.MagFilter = TextureFilter.Nearest; texture.MinFilter = TextureFilter.Nearest; texture.Bind(); Bind(); if (Samples == 1) { Context.FramebufferTexture2D(FramebufferTarget.Framebuffer, attachment, TextureTarget.Texture2D, texture.Handle); } else { Context.FramebufferTexture2D(FramebufferTarget.Framebuffer, attachment, TextureTarget.Texture2DMultisample, texture.Handle); } SaveAttachment(attachment, texture); }