public CSharpGL.VertexBuffer GetVertexAttributeBuffer(string bufferName, string varNameInShader)
{
if (bufferName == strposition)
{
if (this.positionBuffer == null)
{
//int length = this.pointPositions.Length;
//VertexBuffer buffer = VertexBuffer.Create(typeof(vec3), length, VBOConfig.Vec3, varNameInShader, BufferUsage.StaticDraw);
//unsafe
//{
// IntPtr pointer = buffer.MapBuffer(MapBufferAccess.WriteOnly);
// var array = (vec3*)pointer;
// for (int i = 0; i < this.pointPositions.Length; i++)
// {
// array[i] = this.pointPositions[i];
// }
// buffer.UnmapBuffer();
//}
//this.positionBuffer = buffer;
// another way to do this:
this.positionBuffer = this.pointPositions.GenVertexBuffer(VBOConfig.Vec3, varNameInShader, BufferUsage.StaticDraw);
}
return this.positionBuffer;
}
else
{
throw new System.ArgumentException("bufferName");
}
}