public ForwardPipeline(MasterRenderer renderer) : base(renderer) { GLError.Begin(); forwardShader = new WorldShader(); shadowShader = new ShadowShader(); shadowMap = new ShadowMap(GFXSettings.ShadowResolution, GFXSettings.ShadowResolution); shadowCamera = new ShadowCamera(); ppBuffer = new PostProcessBuffer(ScreenWidth, ScreenHeight); ppShader = new PostProcessShader(); skyRenderTarg = new TexRenderTarget(ScreenWidth, ScreenHeight); screenshotRenderTarg = new TexRenderTarget(1, 1); screenshotRenderTarg.Bind(); GL.ReadBuffer(ReadBufferMode.ColorAttachment0); screenshotRenderTarg.Unbind(); ErrorCode err = GLError.End(); if (err != ErrorCode.NoError) { throw new Exception(string.Format("Failed to initialize forward pipeline. OpenGL Error: {0}", err)); } }
public void DebugRenderTexRenderTargs(TexRenderTarget targetA, TexRenderTarget targetB) { PrepareRender(shader); shader.LoadColor4("overlayColor", Color4.White); shader.LoadBool("flipY", false); GL.ActiveTexture(TextureUnit.Texture0); // Bind the Opaque texture targetA.Texture.Bind(); // Set transformation matrix Matrix4 transMatrix = Maths.CreateTransformationMatrix(new Vector2(-0.5f, 0.5f), new Vector2(0.5f, 0.5f)); shader.LoadTransformationMatrix(transMatrix); // Draw GL.DrawArrays(BeginMode.TriangleStrip, 0, 4); // Bind the Alpha texture targetB.Texture.Bind(); // Set transformation matrix transMatrix = Maths.CreateTransformationMatrix(new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f)); shader.LoadTransformationMatrix(transMatrix); // Draw GL.DrawArrays(BeginMode.TriangleStrip, 0, 4); // Ubind the FBO texture GL.BindTexture(TextureTarget.Texture2D, 0); EndRender(shader); }