Aiv.Fast2D.Mesh.NewFloatBuffer C# (CSharp) Метод

NewFloatBuffer() защищенный Метод

protected NewFloatBuffer ( int attribArrayId, int elementSize, float data, int divisor ) : int
attribArrayId int
elementSize int
data float
divisor int
Результат int
        protected int NewFloatBuffer(int attribArrayId, int elementSize, float[] data, int divisor = 0)
        {
            this.Bind();

            int bufferId = NewVBO();
            GL.BindBuffer(BufferTarget.ArrayBuffer, bufferId);

            GL.EnableVertexAttribArray(attribArrayId);
            GL.VertexAttribPointer(attribArrayId, elementSize, VertexAttribPointerType.Float, false, 0, IntPtr.Zero);

            if (divisor > 0)
            {
                GL.VertexAttribDivisor(attribArrayId, divisor);
            }
            #if !__MOBILE__
            GL.BufferData<float>(BufferTarget.ArrayBuffer, (IntPtr)(data.Length * sizeof(float)), data, BufferUsageHint.DynamicDraw);
            #else
            GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(data.Length * sizeof(float)), data, BufferUsage.DynamicDraw);
            #endif
            this.customBuffers[attribArrayId] = new VertexAttrib(bufferId, elementSize);
            return bufferId;
        }