Ejemplo n.º 1
0
        internal static void InitGlFwForm(GlFwForm f, int initW, int initH, string title = "")
        {
            GlfwWindowPtr glWindowPtr = Glfw.CreateWindow(initW, initH,
                                                          title,
                                                          new GlfwMonitorPtr(), //default monitor
                                                          new GlfwWindowPtr()); //default top window

            Glfw.MakeContextCurrent(glWindowPtr);                               //***

            f.SetupNativePtr(glWindowPtr, f.Width, f.Height);
            //-------------------
            //setup events for glfw window
            Glfw.SetWindowCloseCallback(glWindowPtr, s_windowCloseCb);
            Glfw.SetWindowFocusCallback(glWindowPtr, s_windowFocusCb);
            Glfw.SetWindowIconifyCallback(glWindowPtr, s_windowIconifyCb);
            Glfw.SetWindowPosCallback(glWindowPtr, s_windowPosCb);
            Glfw.SetWindowRefreshCallback(glWindowPtr, s_windowRefreshCb);
            Glfw.SetWindowSizeCallback(glWindowPtr, s_windowSizeCb);
            Glfw.SetCursorPosCallback(glWindowPtr, s_windowCursorPosCb);
            Glfw.SetCursorEnterCallback(glWindowPtr, s_windowCursorEnterCb);
            Glfw.SetMouseButtonCallback(glWindowPtr, s_windowMouseButtonCb);
            Glfw.SetScrollCallback(glWindowPtr, s_scrollCb);
            Glfw.SetKeyCallback(glWindowPtr, s_windowKeyCb);
            Glfw.SetCharCallback(glWindowPtr, s_windowCharCb);

            //-------------------

            s_existingForms.Add(glWindowPtr, f);
            exitingFormList.Add(f);

            //-------------------
            GLFWPlatforms.CreateGLESContext(f);
        }