public void InitBuffer(TextureChain source) { texture1 = source.texture1; texture2 = source.texture2; numVerts = source.numVerts; bufferNum = GL.GenBuffer(); arrayNum = GL.GenVertexArray(); GL.BindVertexArray(arrayNum); GL.BindBuffer(BufferTarget.ArrayBuffer, bufferNum); GL.BufferData(BufferTarget.ArrayBuffer, source.pointer * sizeof(float), source.vertBuffer, BufferUsageHint.StaticDraw); GLUtilities.ErrorCheck(string.Format("Uploading chain {0} + {1}", texture1, texture2)); GL.EnableVertexAttribArray(0); GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, sizeof(float) * 6, 0); GLUtilities.ErrorCheck(string.Format("Chain {0} + {1} Attrib 0", texture1, texture2)); GL.EnableVertexAttribArray(1); GL.VertexAttribPointer(1, 3, VertexAttribPointerType.Float, false, sizeof(float) * 6, sizeof(float) * 3); GLUtilities.ErrorCheck(string.Format("Chain {0} + {1} Attrib 1", texture1, texture2)); }
public void UpdateChain(TextureChain source) { GL.BindVertexArray(arrayNum); GL.BindBuffer(BufferTarget.ArrayBuffer, bufferNum); GL.BufferData(BufferTarget.ArrayBuffer, source.pointer * sizeof(float), source.vertBuffer, BufferUsageHint.StaticDraw); }