daily update on 20231016 by nitload youmu, vao,vbo,ebo struct added
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user