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

47 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(int n, IglFunc gl)
{
GL = gl;
_bufferHandle = GL.GenVertexArrays(n);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public sealed override void Bind(int index)
{
GL.BindVertexArray(_bufferHandle[index]);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindNull()
{
GL.BindVertexArray(glHandle.Alloc(0));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetVertexAttribute(uint index, int vertexLength, TypeCode 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);
}
}
}
}