GridViewer.CatesianGrid.GetPositionBuffer C# (CSharp) Method

GetPositionBuffer() private method

private GetPositionBuffer ( string varNameInShader ) : VertexBuffer
varNameInShader string
return CSharpGL.VertexBuffer
        private VertexBuffer GetPositionBuffer(string varNameInShader)
        {
            int dimSize = this.DataSource.DimenSize;
            int length = dimSize;
            VertexBuffer buffer = VertexBuffer.Create(typeof(HexahedronPosition), length, VBOConfig.Vec3, varNameInShader, BufferUsage.StaticDraw);
            unsafe
            {
                IntPtr pointer = buffer.MapBuffer(MapBufferAccess.WriteOnly);
                var array = (HexahedronPosition*)pointer;
                int I, J, K;
                for (int gridIndex = 0; gridIndex < dimSize; gridIndex++)
                {
                    this.DataSource.InvertIJK(gridIndex, out I, out J, out K);
                    array[gridIndex].FLT = this.DataSource.Position + this.DataSource.PointFLT(I, J, K);
                    array[gridIndex].FRT = this.DataSource.Position + this.DataSource.PointFRT(I, J, K);
                    array[gridIndex].BRT = this.DataSource.Position + this.DataSource.PointBRT(I, J, K);
                    array[gridIndex].BLT = this.DataSource.Position + this.DataSource.PointBLT(I, J, K);
                    array[gridIndex].FLB = this.DataSource.Position + this.DataSource.PointFLB(I, J, K);
                    array[gridIndex].FRB = this.DataSource.Position + this.DataSource.PointFRB(I, J, K);
                    array[gridIndex].BRB = this.DataSource.Position + this.DataSource.PointBRB(I, J, K);
                    array[gridIndex].BLB = this.DataSource.Position + this.DataSource.PointBLB(I, J, K);
                }
                buffer.UnmapBuffer();
            }

            return buffer;
        }