Beispiel #1
0
        private void RenderControl_ContextCreated(object sender, GlControlEventArgs e)
        {
            GlControl glControl = (GlControl)sender;

            // Here you can allocate resources or initialize state
            Gl.MatrixMode(MatrixMode.Projection);
            Gl.LoadIdentity();
            Gl.Ortho(OrthoLeft, OrthoRight, OrthoBottom, OrthoTop, -0.1, 10.0);
            Gl.Enable(EnableCap.Texture2d);
            Gl.Enable(EnableCap.Blend);
            Gl.Enable(EnableCap.DepthTest);                     //Set up Z Depth tests for drawing pixels
            Gl.DepthFunc(DepthFunction.Lequal);                 //Only draw something new if its z value is closer to the 'camera'
            Gl.DepthMask(true);
            Gl.ClearDepth(10f);
            Gl.ClearColor(36 / 255f, 71 / 255f, 143 / 255f, 1f);
            Gl.Enable(EnableCap.AlphaTest);                     //Set up Alpha tests for drawing pixels
            Gl.AlphaFunc(AlphaFunction.Greater, .05f);          //Don't draw transparent pixels on polygons
            Gl.Enable(EnableCap.ScissorTest);
            Gl.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);
            Gl.EnableClientState(EnableCap.VertexArray);
            Gl.EnableClientState(EnableCap.TextureCoordArray);
            contextCreated = true;
            Console.Console.ConsoleSetup();
            WorldData.WorldStartup();
            Screen.ScreenStartup();

            MaximizeBox = false;

            if (Save.SaveData.GameSettings.fullScreen)
            {
                FormBorderStyle = FormBorderStyle.None;
                WindowState     = FormWindowState.Maximized;
            }
            if (Save.SaveData.GameSettings.VSync)
            {
                Wgl.SwapIntervalEXT(-1);                 //Swap Interval (V-Sync Enabled at 1 or -1)
            }
            else
            {
                Wgl.SwapIntervalEXT(0);
            }
            ResizeWindow(Save.SaveData.GameSettings.windowx, Save.SaveData.GameSettings.windowy);
            ResizeE(sender, e);

            LogicUtils.Logic.LogicStart();
        }