public DeferredRenderer(SurfaceManager surfaces) { this.surfaces = surfaces; gTarget.Attach(FramebufferAttachment.ColorAttachment0, diffuseBuffer); gTarget.Attach(FramebufferAttachment.ColorAttachment1, normalBuffer); gTarget.Attach(FramebufferAttachment.ColorAttachment2, depthBuffer); gTarget.Attach(FramebufferAttachment.DepthAttachment, depthMaskBuffer); renderTo(gTarget, new ScreenCoords(0, 0)); GL.DrawBuffers(3, new [] { DrawBuffersEnum.ColorAttachment0, DrawBuffersEnum.ColorAttachment1, DrawBuffersEnum.ColorAttachment2, }); renderTo(null, new ScreenCoords(0, 0)); accumTarget.Attach(FramebufferAttachment.ColorAttachment0, accumBuffer); compositeSurface = new PostProcessSurface() .WithShader(surfaces.Shaders["Deferred/compose"]) .AndSettings( new TextureUniform("albedoTexture", diffuseBuffer, TextureUnit.Texture0), new TextureUniform("lightTexture", accumBuffer, TextureUnit.Texture1) ); debugSurfaces = new[] { diffuseBuffer, normalBuffer, depthBuffer, accumBuffer } .Select(createDebugSurface).ToArray(); surfaces.InjectDeferredBuffer(normalBuffer, depthBuffer); }