daily update on 20240325 by nitload youmu
This commit is contained in:
@@ -46,29 +46,29 @@ namespace StgSharp.Graphics
|
||||
public unsafe class ElementBuffer : BufferObjectBase
|
||||
{
|
||||
|
||||
internal ElementBuffer(int n, IglFunc gl)
|
||||
internal ElementBuffer(int n, Form binding)
|
||||
{
|
||||
GL = gl;
|
||||
_bufferHandle = GL.GenBuffers(n);
|
||||
this.binding = binding;
|
||||
_bufferHandle = binding.GL.GenBuffers(n);
|
||||
}
|
||||
|
||||
public override sealed void Bind(int index)
|
||||
{
|
||||
GL.BindBuffer(BufferType.ELEMENT_ARRAY_BUFFER, _bufferHandle[index]);
|
||||
binding.GL.BindBuffer(BufferType.ELEMENT_ARRAY_BUFFER, _bufferHandle[index]);
|
||||
}
|
||||
|
||||
public void SetValue<T>(int index, T[] bufferArray, BufferUsage usage)
|
||||
where T : struct, IConvertible
|
||||
{
|
||||
GL.BindBuffer(BufferType.ELEMENT_ARRAY_BUFFER, _bufferHandle[index]);
|
||||
GL.SetBufferData(BufferType.ELEMENT_ARRAY_BUFFER, bufferArray, usage);
|
||||
binding.GL.BindBuffer(BufferType.ELEMENT_ARRAY_BUFFER, _bufferHandle[index]);
|
||||
binding.GL.SetBufferData(BufferType.ELEMENT_ARRAY_BUFFER, bufferArray, usage);
|
||||
}
|
||||
|
||||
protected override sealed void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
GL.DeleteBuffers(_bufferHandle);
|
||||
binding.GL.DeleteBuffers(_bufferHandle);
|
||||
_bufferHandle.Release();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user