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
+23 -6
View File
@@ -34,7 +34,7 @@ namespace StgSharp.Graphics
internal Form sharedForm;
internal int width;
internal IntPtr windowID;
protected IglFunc gl;
private IglFunc gl;
private bool closed;
#endregion
@@ -173,17 +173,17 @@ namespace StgSharp.Graphics
}
}
private void InternalRender()
private unsafe void InternalRender()
{
#pragma warning disable CS8602
ConcurrentQueue<Action> glActions = (gl as GLonUpdate).GLactionQueue;
ConcurrentQueue<IntPtr> glActions = (gl as GLonUpdate).GLactionQueue;
#pragma warning restore CS8602
Action currentAction = new Action(() => { return; });
IntPtr currentOperation;
while (gl.GetWindowShouldClose(this))
{
if (glActions.TryDequeue(out currentAction))
if (glActions.TryDequeue(out currentOperation))
{
currentAction();
((delegate*<void>)currentOperation)();
}
}
}
@@ -198,6 +198,23 @@ namespace StgSharp.Graphics
Init((object[])args);
}
/// <summary>
/// Get OpenGL library of this form's context.
/// </summary>
/// <returns>A <see cref="IglFunc"/> package contains all opengl APIs </returns>
protected IglFunc GetGL()
{
if (Platform.API == GraphicAPI.GL)
{
return this.GL;
}
else
{
InternalIO.InternalWriteLog("Attempt to get OpenGL API package in other graphic envitronment.", LogType.Error);
throw new Exception();
}
}
/// <summary>
/// Define how current form render in one frame.
/// </summary>