daily update on 20240203 by nitloadd youmu. New glhandle setup.
This commit is contained in:
@@ -5,36 +5,20 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
public partial class Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Create a set of <see cref="VertexArray"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">Amount of VAO to be crated.</param>
|
||||
/// <returns></returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected VertexArray CreateVertexArray(uint count)
|
||||
{
|
||||
return new VertexArray(count, gl);
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe class VertexArray : IBufferObject
|
||||
{
|
||||
internal VertexArray(uint n, IglFunc gl)
|
||||
{
|
||||
_bufferID = new uint[n];
|
||||
_bufferHandle = new glHandle((int)n);
|
||||
GL = gl;
|
||||
fixed (uint* id = _bufferID)
|
||||
{
|
||||
GL.GenVertexArrays(n, id);
|
||||
}
|
||||
GL.GenVertexArrays(n, _bufferHandle);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public sealed override void Bind(int index)
|
||||
{
|
||||
GL.BindVertexArray(_bufferID[index]);
|
||||
GL.BindVertexArray(_bufferHandle[index]);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@@ -56,7 +40,7 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
GL.DeleteVertexArrays((uint)_bufferID.Length, _bufferID);
|
||||
GL.DeleteVertexArrays(_bufferHandle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user