daily update on 20230911 by nitload youmu, uncertain bug of gl api loading

This commit is contained in:
Nitload
2023-09-11 23:34:34 +08:00
parent c6f4b3dd53
commit 5d701bce0c
172 changed files with 15161 additions and 9614 deletions
+52 -8
View File
@@ -1,9 +1,9 @@
using StgSharp.Math;
using StgSharp.Graphics;
using StgSharp.Math;
using System;
using System.Diagnostics;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics.X86;
namespace StgSharp
{
@@ -13,19 +13,63 @@ namespace StgSharp
internal unsafe static void Main(string[] args)
{
Matrix3x3 matrix = new Matrix3x3(
1,2,3,
4,5,6,
7,8,9
Graphic.InitGL(3, 3);
Form f = Graphic.GLcreateWindow(
800, 600, "Test STG#!", IntPtr.Zero, null
);
Graphic.GLmakeContexCurrent(f);
internalIO.glfwSetFramebufferSizeCallback(f.windowID, FormSizeCallback);
Console.WriteLine(matrix.Det());
GetApiRep();
Graphic.InitGLAD(Graphic.GetProcAddress);
while (internalIO.glfwWindowShouldClose(f.windowID) == 0)
{
ProcessInput(f.windowID);
Graphic.glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
Graphic.glClear(GLFW.GL_COLOR_BUFFER_BIT);
internalIO.glfwSwapBuffers(f.windowID);
internalIO.glfwPollEvents();
}
internalIO.glfwTerminate();
}
public static void FormSizeCallback(IntPtr window, int width, int height)
{
Graphic.glViewport(0, 0, width, height);
}
public static void ProcessInput(IntPtr windowPtr)
{
if (internalIO.glfwGetKey(windowPtr, (int)Control.Key.ESCAPE)
== KeyStatus.PRESS)
{
internalIO.glfwSetWindowShouldClose(windowPtr, 1);
}
}
[DllImport(internalIO.SSGC_libname, EntryPoint = "getApiReporter",
CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal extern static void internal_getApiReporter(IntPtr reporter);
internal static void GetApiRep()
{
showApiHandler handle = new showApiHandler(ShowApiAddress);
internal_getApiReporter(Marshal.GetFunctionPointerForDelegate(handle));
}
internal delegate void showApiHandler(ulong add);
internal static void ShowApiAddress(ulong address)
{
Console.WriteLine(address);
}
}
}