private GLTexture2D CreateColorAttachment(int width, int height, int numSamples) { GLTexture2D texture = GLTexture2DMultiSampled.CreateUncompressedTexture(width, height, PixelInternalFormat, PixelFormat.Rgba, PixelType.Float); // Don't use mipmaps for color attachments. texture.MinFilter = TextureMinFilter.Linear; texture.MagFilter = TextureMagFilter.Linear; texture.UpdateParameters(); return(texture); }
public static GLTexture2DMultiSampled CreateUncompressedTexture(int width, int height, int numSamples, PixelInternalFormat format = PixelInternalFormat.Rgba8, PixelFormat pixelFormat = PixelFormat.Rgba, PixelType pixelType = PixelType.UnsignedByte) { GLTexture2DMultiSampled texture = new GLTexture2DMultiSampled(); texture.PixelFormat = pixelFormat; texture.PixelType = pixelType; texture.Width = width; texture.Height = height; texture.Target = TextureTarget.Texture2DMultisample; texture.Bind(); GL.TexImage2DMultisample(TextureTargetMultisample.Texture2DMultisample, numSamples, format, texture.Width, texture.Height, true); texture.UpdateParameters(); texture.Unbind(); return(texture); }