using StgSharp.Graphics; using StgSharp.Math; using System; using System.Diagnostics; using System.Numerics; using System.Runtime.InteropServices; namespace StgSharp { internal static class Program { internal unsafe static void Main(string[] args) { Graphic.InitGL(3, 3); Form f = Graphic.GLcreateWindow( 800, 600, "Test STG#!", IntPtr.Zero, null ); Graphic.GLmakeContexCurrent(f); internalIO.glfwSetFramebufferSizeCallback(f.windowID, FormSizeCallback); 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); } } }