daily update on 20240203 by nitloadd youmu. New glhandle setup.

This commit is contained in:
Nitload
2024-02-03 23:20:50 +08:00
parent 8148c10acd
commit 5d778e0f2f
258 changed files with 10025 additions and 1220 deletions
+4 -20
View File
@@ -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);
}
}
}