CSharpGL.InnerPickableRenderer.FillPickedGeometrysPosition C# (CSharp) Method

FillPickedGeometrysPosition() protected method

protected FillPickedGeometrysPosition ( uint indexes ) : vec3[]
indexes uint
return vec3[]
        protected vec3[] FillPickedGeometrysPosition(uint[] indexes)
        {
            var positions = new vec3[indexes.Length];

            this.PositionBuffer.Bind();
            for (int i = 0; i < indexes.Length; i++)
            {
                int offset = (int)(indexes[i] * this.PositionBuffer.Config.GetDataSize() * this.PositionBuffer.Config.GetDataTypeByteLength());
                //IntPtr pointer = GL.MapBuffer(BufferTarget.ArrayBuffer, MapBufferAccess.ReadOnly);
                IntPtr pointer = this.PositionBuffer.MapBufferRange(
                    offset,
                    1 * this.PositionBuffer.Config.GetDataSize() * this.PositionBuffer.Config.GetDataTypeByteLength(),
                    MapBufferRangeAccess.MapReadBit, false);
                if (pointer.ToInt32() != 0)
                {
                    unsafe
                    {
                        var array = (vec3*)pointer.ToPointer();
                        positions[i] = array[0];
                    }
                }
                else
                {
                    ErrorCode error = (ErrorCode)OpenGL.GetError();
                    if (error != ErrorCode.NoError)
                    {
                        Debug.WriteLine(string.Format(
                            "Error:[{0}] glMapBufferRange failed: buffer ID: [{1}]", error, this.PositionBuffer.BufferId.ToString()));
                    }
                }
                this.PositionBuffer.UnmapBuffer(false);
            }
            this.PositionBuffer.Unbind();

            return positions;
        }

Same methods

InnerPickableRenderer::FillPickedGeometrysPosition ( uint firstIndex, int indexCount ) : vec3[]