private static void BindIndicesBuffer(int[] indices) { int vboID = 0; GL.GenBuffers(1, out vboID); vbos.Add(vboID); GL.BindBuffer(BufferTarget.ElementArrayBuffer, vboID); GL.BufferData(BufferTarget.ElementArrayBuffer, sizeof(int) * indices.Length, indices, BufferUsageHint.StaticDraw); }
private static void StoreDataInAttributeList(int attributeIndex, int size, float[] data) { int vboID = 0; GL.GenBuffers(1, out vboID); vbos.Add(vboID); GL.BindBuffer(BufferTarget.ArrayBuffer, vboID); GL.BufferData(BufferTarget.ArrayBuffer, sizeof(float) * data.Length, data, BufferUsageHint.StaticDraw); GL.VertexAttribPointer(attributeIndex, size, VertexAttribPointerType.Float, false, 0, 0); GL.BindBuffer(BufferTarget.ArrayBuffer, 0); }
protected override void OnUnload(EventArgs e) { GL.BindBuffer(BufferTarget.ArrayBuffer, 0); GL.BindVertexArray(0); GL.UseProgram(0); Scene.ClearHandles(); Shader?.Dispose(); LampShader?.Dispose(); base.OnUnload(e); }