示例#1
0
        void OnStart()
        {
            ubo = new UniformBlock();
            //new PhysicsUsage.PhysicsManager();

            stopwatchSinceStart.Restart();

            renderManagerFront = new RenderManager(gameWindow.Width, gameWindow.Height);
            renderManagerBack  = new RenderManager(gameWindow.Width, gameWindow.Height);


            /*Debug.CommonCVars.VSync().ToogledByKey(OpenTK.Input.Key.V).OnChanged += (cvar) =>
             * {
             *      if (cvar.Bool) VSync = VSyncMode.On;
             *      else VSync = VSyncMode.Off;
             * };
             * Debug.CommonCVars.VSync().InitializeWith(false);*/

            Debug.GetCVar("rendering / fullscreen").OnChangedAndNow((cvar) =>
            {
                if (cvar.Bool && WindowState != WindowState.Fullscreen)
                {
                    WindowState = WindowState.Fullscreen;
                }
                else
                {
                    WindowState = WindowState.Normal;
                }
            });


            WindowTitle = defaultWindowTitle;



            foreach (StringName r in System.Enum.GetValues(typeof(StringName)))
            {
                if (r == StringName.Extensions)
                {
                    break;
                }
                var str = GL.GetString(r); MyGL.Check();
                Log.Info(r.ToString() + ": " + str);
            }

            // Other state
            //GL.Enable(EnableCap.Texture2D); My.Check();
            //GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest); My.Check();
            //GL.Enable(EnableCap.Multisample); My.Check();

            gameWindow.Resize += (sender, e) => OnResize();
            OnResize();

            gameWindow.Visible = true;

            StartOtherThreads();

            while (ShouldContinueRunning)
            {
                MainLoop();
            }

            gameWindow.Exit();
        }