daily update on 20240104 by nitload youmu, double threading not work
This commit is contained in:
@@ -3,17 +3,29 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Security;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
public unsafe struct VertexBuffer : IDisposable, IBufferObject
|
||||
public partial class Form
|
||||
{
|
||||
internal uint[] _bufferID;
|
||||
private IglFunc GL;
|
||||
/// <summary>
|
||||
/// Create aset of <see cref="VertexBuffer"/>.
|
||||
/// </summary>
|
||||
/// <param name="count">Amount of Object to be created.</param>
|
||||
/// <returns></returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected VertexBuffer CreateVertexBuffer(uint count)
|
||||
{
|
||||
return new VertexBuffer(count, gl);
|
||||
}
|
||||
}
|
||||
|
||||
internal VertexBuffer(int n, IglFunc glFunc)
|
||||
public unsafe class VertexBuffer : IBufferObject
|
||||
{
|
||||
internal VertexBuffer(uint n, IglFunc glFunc)
|
||||
{
|
||||
_bufferID = new uint[n];
|
||||
GL = glFunc;
|
||||
@@ -23,29 +35,33 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
}
|
||||
|
||||
public uint this[int n]
|
||||
{
|
||||
get { return _bufferID[n]; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Unbind()
|
||||
{
|
||||
GL.BindBuffer(BufferType.ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
public void Bind(int index)
|
||||
public sealed override void Bind(int index)
|
||||
{
|
||||
GL.BindBuffer(BufferType.ARRAY_BUFFER, _bufferID[index]);
|
||||
GL.BindBuffer(BufferType.ARRAY_BUFFER, (uint)index);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
internal void ChangeEnvironment(IglFunc gl)
|
||||
{
|
||||
fixed (uint* id = _bufferID)
|
||||
GL = gl;
|
||||
}
|
||||
|
||||
protected sealed override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
GL.DeleteBuffers(_bufferID.Length, id);
|
||||
fixed (uint* id = _bufferID)
|
||||
{
|
||||
GL.DeleteBuffers((uint)_bufferID.Length, _bufferID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user