Пример #1
0
        internal void AddVetexBuffer(VertexBuffer vertexBuffer)
        {
            Bind();
            vertexBuffer.Bind();
            vertexBufferIndex = 0;
            int stride = VertexBuffer.CalculateStride(vertexBuffer.Layout);
            int offset = 0;

            foreach (var element in vertexBuffer.Layout)
            {
                GL.EnableVertexArrayAttrib(_id, vertexBufferIndex);
                GL.VertexAttribPointer(vertexBufferIndex,
                                       element.Value,
                                       VertexAttribPointerType.Float,
                                       false,
                                       stride,
                                       offset * sizeof(float)
                                       );
                offset += element.Value;
                vertexBufferIndex++;
            }
        }