daily update on 20240104 by nitload youmu, double threading not work
This commit is contained in:
@@ -1,20 +1,37 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
public unsafe class ElementBuffer : IDisposable, IBufferObject
|
||||
public partial class Form
|
||||
{
|
||||
uint[] _bufferID;
|
||||
private IglFunc GL;
|
||||
/// <summary>
|
||||
/// Create a set of <see cref="ElementBuffer"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">Amount of EBO to be created.</param>
|
||||
/// <returns></returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected ElementBuffer CreateElementBuffer(uint count)
|
||||
{
|
||||
return new ElementBuffer(count, this.gl);
|
||||
}
|
||||
}
|
||||
|
||||
internal ElementBuffer(int n, IglFunc glFunc)
|
||||
/// <summary>
|
||||
/// A collecion of handle to Element Buffer Object in OpenGL.
|
||||
/// Each <see cref="uint"/> value indexed from instance of this class this
|
||||
/// is the only handle to one Element Buffer Object.
|
||||
/// </summary>
|
||||
public unsafe class ElementBuffer : IBufferObject
|
||||
{
|
||||
internal ElementBuffer(uint n, IglFunc gl)
|
||||
{
|
||||
_bufferID = new uint[n];
|
||||
GL = glFunc;
|
||||
GL = gl;
|
||||
fixed (uint* id = _bufferID)
|
||||
{
|
||||
GL.GenBuffers(n, id);
|
||||
@@ -26,7 +43,7 @@ namespace StgSharp.Graphics
|
||||
get { return _bufferID[n]; }
|
||||
}
|
||||
|
||||
public void Bind(int index)
|
||||
public override void Bind(int index)
|
||||
{
|
||||
GL.BindBuffer(BufferType.ELEMENT_ARRAY_BUFFER, _bufferID[index]);
|
||||
}
|
||||
@@ -38,14 +55,12 @@ namespace StgSharp.Graphics
|
||||
GL.SetBufferData(BufferType.ELEMENT_ARRAY_BUFFER, bufferArray, usage);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
protected sealed override void Dispose(bool disposing)
|
||||
{
|
||||
fixed (uint* id = _bufferID)
|
||||
if (disposing)
|
||||
{
|
||||
GL.DeleteBuffers(_bufferID.Length, id);
|
||||
GL.DeleteBuffers((uint)_bufferID.Length, _bufferID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user