46 lines
1.3 KiB
C#
46 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Text;
|
|
|
|
namespace StgSharp.Graphics
|
|
{
|
|
public unsafe class VertexArray : BufferObjectBase
|
|
{
|
|
internal VertexArray(int n, IglFunc gl)
|
|
{
|
|
GL = gl;
|
|
_bufferHandle = GL.GenVertexArrays(n);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public override sealed void Bind(int index)
|
|
{
|
|
GL.BindVertexArray(_bufferHandle[index]);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void BindNull()
|
|
{
|
|
GL.BindVertexArray(glHandle.Zero);
|
|
}
|
|
|
|
[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 override sealed void Dispose(bool disposing)
|
|
{
|
|
if (disposing)
|
|
{
|
|
GL.DeleteVertexArrays(_bufferHandle);
|
|
_bufferHandle.Release();
|
|
}
|
|
}
|
|
}
|
|
} |