/// <summary>
 /// Prepares the settings required for a vertex attribute.
 /// </summary>
 /// <param name="index">The line number of this attribute in the shader.</param>
 /// <param name="size">Specifies the number of components per generic vertex attribute.</param>
 /// <param name="type">Specifies the data type of each component in the array.</param>
 /// <param name="stride">Specifies the byte offset between consecutive generic vertex attributes. If stride is 0, the generic vertex attributes are understood to be tightly packed in the array.</param>
 /// <param name="offsetPointer">Specifies a offset of the first component of the first generic vertex attribute in the array in the data store of the buffer currently bound to the GL_ARRAY_BUFFER target.</param>
 /// <param name="normalized">Specifies whether fixed-point data values should be normalized or converted directly as fixed-point values when they are accessed.</param>
 /// <param name="divisor">Specify the number of instances that will pass between updates of the generic attribute at slot index.</param>
 public VertexAttribPointer(uint index, int size, OGLType type, int stride, IntPtr offsetPointer, bool normalized = false, uint divisor = 0)
 {
     Index = index;
     Size = size;
     Type = type;
     Stride = stride;
     OffsetPointer = offsetPointer;
     Normalized = normalized;
     DivisorValue = divisor;
     //CurrentVariant = new Action<OpenGL>(InvokeDefaultVariant);
 }
        //private Action<OpenGL> CurrentVariant
        //{
        //    get { return _currentVariant; }
        //    set { _currentVariant = value; }
        //}
        #endregion properties

        #region events
        #endregion events

        #region constructors
        /// <summary>
        /// Prepares the settings required for a vertex attribute.
        /// </summary>
        /// <param name="index">The line number of this attribute in the shader.</param>
        /// <param name="size">Specifies the number of components per generic vertex attribute.</param>
        /// <param name="type">Specifies the data type of each component in the array.</param>
        /// <param name="stride">Specifies the byte offset between consecutive generic vertex attributes. If stride is 0, the generic vertex attributes are understood to be tightly packed in the array.</param>
        /// <param name="offsetPointer">Specifies a offset of the first component of the first generic vertex attribute in the array in the data store of the buffer currently bound to the GL_ARRAY_BUFFER target.</param>
        /// <param name="normalized">Specifies whether fixed-point data values should be normalized or converted directly as fixed-point values when they are accessed.</param>
        /// <param name="divisor">Specify the number of instances that will pass between updates of the generic attribute at slot index.</param>
        public VertexAttribPointer(uint index, int size, OGLType type, int stride, IntPtr offsetPointer, bool normalized = false, uint divisor = 0)
        {
            Index         = index;
            Size          = size;
            Type          = type;
            Stride        = stride;
            OffsetPointer = offsetPointer;
            Normalized    = normalized;
            DivisorValue  = divisor;
            //CurrentVariant = new Action<OpenGL>(InvokeDefaultVariant);
        }
        /// <summary>
        /// Calls the glBufferData(...). The size will be used as value for Size property.
        /// </summary>
        /// <param name="gl">The gl.</param>
        /// <param name="target">The buffer data target.</param>
        /// <param name="size">The size of the data buffer.</param>
        /// <param name="data">The pointer to the data in memory.</param>
        /// <param name="usage">The usage.</param>
        public virtual void SetBufferData(OpenGL gl, OGLBufferDataTarget target, int size, IntPtr data, OGLModelUsage usage, int stride, OGLType bufferDataType,
                                          bool bind = false, OGLBindBufferTarget bindTarget = OGLBindBufferTarget.ArrayBuffer)
        {
            Size   = size / stride;
            Stride = stride;


            if (bind)
            {
                BindBuffer(gl, bindTarget);
            }
            gl.BufferData((uint)target, size, data, (uint)usage);
        }
        /// <summary>
        /// Calls the glBufferData(...). The size will be used as value for Size property.
        /// </summary>
        /// <param name="gl">The gl.</param>
        /// <param name="target">The buffer data target.</param>
        /// <param name="size">The size of the data buffer.</param>
        /// <param name="data">The pointer to the data in memory.</param>
        /// <param name="usage">The usage.</param>
        public virtual void SetBufferData(OpenGL gl, OGLBufferDataTarget target, int size, IntPtr data, OGLModelUsage usage, int stride, OGLType bufferDataType,
            bool bind = false, OGLBindBufferTarget bindTarget = OGLBindBufferTarget.ArrayBuffer)
        {
            Size = size / stride;
            Stride = stride;

            if(bind)
                BindBuffer(gl, bindTarget);
            gl.BufferData((uint)target, size, data, (uint)usage);
        }