public void Render(bool moving) { if (moving) { FrameBlend = MaxAlpha; } else { FrameBlend *= AlphaDecay; if (FrameBlend < MinAlpha) { FrameBlend = MinAlpha; } } // Render source gbuffer into destination accumulation buffer currentFrame = 1 - currentFrame; // switch frames BindDestForWritingTo(currentFrame); sourcegbuffer.GetTextureAtSlot(0).Bind(TextureUnit.Texture0); frame[1 - currentFrame].Bind(TextureUnit.Texture1); this.gbufferCombiner.Render(projection, modelview, (sp) => { sp.SetUniform("inputTex", 0); sp.SetUniform("lastFrameTex", 1); sp.SetUniform("frameBlend", this.FrameBlend); }); UnbindDestFromWriting(); GL.Viewport(0, 0, this.BaseWidth, this.BaseHeight); // render current frame out frame[currentFrame].Bind(TextureUnit.Texture0); this.destinationprogram .UseProgram() .SetUniform("inputTex", 0) .SetUniform("resolution", new Vector2((float)this.BaseWidth, (float)this.BaseHeight)) .SetUniform("invresolution", new Vector2(1.0f / (float)this.BaseWidth, 1.0f / (float)this.BaseHeight)); this.vertexVBO.Bind(this.destinationprogram.VariableLocation("vertex")); this.indexVBO.Bind(); GL.DrawElements(BeginMode.Triangles, this.indexVBO.Length, DrawElementsType.UnsignedInt, 0); }
public Texture GetTexture(int slot) { return(OutputBuffer.GetTextureAtSlot(slot)); }