Files
stgsharp/源代码/StgSharp/Graphics/GL/Buffer/VAO.cs
T

48 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
namespace StgSharp.Graphics
{
public unsafe class VertexArray : IBufferObject
{
internal VertexArray(uint n, IglFunc gl)
{
_bufferHandle = new glHandle((int)n);
GL = gl;
GL.GenVertexArrays(n, _bufferHandle);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public sealed override void Bind(int index)
{
GL.BindVertexArray(_bufferHandle[index]);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindNull()
{
GL.BindVertexArray(0);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetVertexAttribute(uint index, int vertexLength, Type dataType, bool isNomalized, uint stride, int pointer)
{
GL.SetVertexAttribute(
index, vertexLength, dataType,
isNomalized,
stride, pointer);
}
protected sealed override void Dispose(bool disposing)
{
if (disposing)
{
GL.DeleteVertexArrays(_bufferHandle);
}
}
}
}