/// <summary> /// Constructor to create a new FrameBuffer instance. /// </summary> /// <param name="tex">Texture the frame buffer will write to</param> public FrameBuffer(Texture tex) { Texture = tex; // Prepare the target texture for use Texture.Bind(); // Assign the texture to the frame buffer GL.BindFramebuffer(FramebufferTarget.Framebuffer, FboID); GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, tex.TextureTarget, tex.TextureID, 0); GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0); // Tools.ErrorCheck("fbo_init"); }
public void SetCurrentTexture(Texture texture) { CurrentTexture = texture; GL.ActiveTexture(TextureUnit); CurrentTexture.Bind(); }