private void loadFrameBuffer() { frameBufferObject = GL.GenFramebuffer(); GL.BindFramebuffer(FramebufferTarget.Framebuffer, frameBufferObject); GL.DrawBuffers(1, new DrawBuffersEnum[] { DrawBuffersEnum.ColorAttachment0 }); ScreenGrab = new Texture(Width, Height); ppBufferA = new Texture(Width, Height); ppBufferB = new Texture(Width, Height); quadVertexObject = GL.GenBuffer(); GL.BindBuffer(BufferTarget.ArrayBuffer, quadVertexObject); GL.BufferData(BufferTarget.ArrayBuffer, quad.Length * sizeof(float), quad, BufferUsageHint.StaticDraw); quadArrayObject = GL.GenVertexArray(); GL.BindVertexArray(quadArrayObject); GL.VertexAttribPointer(0, 2, VertexAttribPointerType.Float, false, 2 * sizeof(float), 0); GL.EnableVertexAttribArray(0); // set up post-proc material list ppList = new List <Material>(); threshMat = new ThresholdMaterial(); ppList.Add(threshMat); blurMat = new BlurMaterial(); ppList.Add(blurMat); combineMat = new CombineMaterial(); ppList.Add(combineMat); blitMat = new Material(); }
/// <summary> /// Initializes a new instance of the <see cref="HighDynamicRangeEffect"/> class. /// </summary> public HighDynamicRangeEffect(GraphicsDevice graphics) { Material = toneMapping = new ToneMappingMaterial(graphics); Passes.Add(new PostEffectChain(TextureUsage.Bloom, new PostEffect() { Material = threshold = new ThresholdMaterial(graphics), RenderTargetScale = 0.5f, SurfaceFormat = SurfaceFormat.Color }, blur = new BlurEffect(graphics), new PostEffect() { Material = new ScaleMaterial(graphics), RenderTargetScale = 2.0f } )); Passes.Add(luminanceChain = new LuminanceChain(graphics)); }
/// <summary> /// Initializes a new instance of the <see cref="BloomEffect"/> class. /// </summary> public BloomEffect(GraphicsDevice graphics) { Material = bloom = new BloomMaterial(graphics); Passes.Add(new PostEffectChain()); Passes.Add(new PostEffectChain(TextureUsage.Bloom, new PostEffect() { Material = threshold = new ThresholdMaterial(graphics), RenderTargetScale = 0.5f, SurfaceFormat = SurfaceFormat.Color }, blur = new BlurEffect(graphics), new PostEffect() { Material = new ScaleMaterial(graphics), RenderTargetScale = 2.0f } )); }