43 lines
952 B
C#
43 lines
952 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace StgSharp.Graphics
|
|
{
|
|
internal unsafe struct VertexArray : IDisposable
|
|
{
|
|
internal uint _bufferID;
|
|
|
|
public VertexArray()
|
|
{
|
|
fixed (uint* id = &_bufferID)
|
|
{
|
|
Graphic.glGenVertexArrays(1, id);
|
|
}
|
|
Graphic.glBindBuffer(GLFW.GL_ARRAY_BUFFER, _bufferID);
|
|
}
|
|
|
|
public VertexArray(int n)
|
|
{
|
|
fixed (uint* id = &_bufferID)
|
|
{
|
|
Graphic.glGenVertexArrays(n, id);
|
|
}
|
|
Graphic.glBindBuffer(GLFW.GL_ARRAY_BUFFER, _bufferID);
|
|
}
|
|
|
|
public void Bind()
|
|
{
|
|
Graphic.glBindVertexArray(_bufferID);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
fixed (uint* id = &_bufferID)
|
|
{
|
|
Graphic.glDeleteVertexArrays(1, id);
|
|
}
|
|
}
|
|
}
|
|
}
|