/// <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");
        }
        /// <summary>
        /// Prepares the texture for usage.
        /// </summary>
        public void Bind()
        {
            // If this texture isn't already bound, bind it
            if (_sCurrentLoadedTexture != this) {
                GL.BindTexture(TextureTarget, TextureID);
                _sCurrentLoadedTexture = this;
            }

            // Tools.ErrorCheck("bindtexture");

            // If the texture has changed since the last time it was bound,
            // upload the new data to video memory
            if (!_loaded) {
                Load();
                _loaded = true;
            }
        }
            public void SetCurrentTexture(Texture texture)
            {
                CurrentTexture = texture;

                GL.ActiveTexture(TextureUnit);
                CurrentTexture.Bind();
            }
 public void SetTextures(Texture heightmap, Texture velocitymap, Texture spraymap)
 {
     HeightMap = heightmap;
     VelocityMap = velocitymap;
     SprayMap = spraymap;
 }
        public void SetTexture(String identifier, Texture texture)
        {
            if (_started && _immediate) {
                GL.End();
                // Tools.ErrorCheck("end");
            }

            _textures[identifier].SetCurrentTexture(texture);

            // Tools.ErrorCheck("settexture");

            if (_started && _immediate)
                GL.Begin(BeginMode);
        }