private void Form1_Load(object sender, EventArgs e)
        {
            _uiThreadPumpTimer = new Timer();
            _uiThreadPumpTimer.Interval = 1;

            _uiThreadPumpTimer.Tick +=new EventHandler((a,b)=>{
                EventPumps.UIThreadEventPump.Instance.DoWork();
                glControl1.Invalidate();

            });

            _uiThreadPumpTimer.Start();

            _map = Commanders.MapCommander.CreateMap();
            _cursor = Commanders.MapCursorCommander.CreateMapCursorForMap(_map, 0, 0, 0);

            EventPumps.IronPythonScriptQueue.Instance.Start();
            EventPumps.IronPythonScriptQueue.Instance.SetMap(_map);

            glControl1.MakeCurrent();

            GL.MatrixMode(MatrixMode.Projection);
            GL.LoadIdentity();

            var vm = Matrix4.CreatePerspectiveFieldOfView((float)(Math.PI / 4.0), 1, 1, 200);
            GL.LoadMatrix(ref vm);

            GL.MatrixMode(MatrixMode.Modelview);

            _isLoaded = true;
        }
        protected override void OnLoad(EventArgs e)
        {
            _map = Commanders.MapCommander.CreateMap();
            _mapCursor = Commanders.MapCursorCommander.CreateMapCursorForMap(_map, 0, 0, 0);

            GL.Enable(EnableCap.CullFace);
            GL.Enable(EnableCap.DepthTest);

            texture = GL.GenTexture();

            GL.BindTexture(TextureTarget.Texture2D, texture);

            Bitmap bx = new Bitmap("block.png");

            BitmapData data = bx.LockBits(new Rectangle(0, 0, bx.Width, bx.Height),
               ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

            GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, data.Width, data.Height, 0,
                OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, data.Scan0);

            bx.UnlockBits(data);

            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);

            bx.Dispose();

            System.Threading.Tasks.Task.Factory.StartNew(new Action( ()=>{
            for (int R = 0; R < 100; R += 20)
            {
                var r = Math.Sqrt(R / 5);

                for (double x = -100; x < 100; x++)
                {
                    for (double y = -100; y < 100; y++)
                    {
                        for (double z = -100; z < 100; z++)
                        {
                            var f1 = ((R - Math.Sqrt(x * x + y * y)) * (R - Math.Sqrt(x * x + y * y))) +
                                (z * z) - (r * r);

                            var f2 = ((R - Math.Sqrt(x * x + z * z)) * (R - Math.Sqrt(x * x + z * z))) +
                                (y * y) - (r * r);

                            var f3 = ((R - Math.Sqrt(z * z + y * y)) * (R - Math.Sqrt(z * z + y * y))) +
                                (x * x) - (r * r);

                            if (f1 < 2)
                            {
                                Commanders.MapCommander.SetBlock(_map, (long)x, (long)y, (long)z, 1);
                            }

                            if (f2 < 1)
                            {
                                Commanders.MapCommander.SetBlock(_map, (long)x, (long)y, (long)z, 1);
                            }

                            if (f3 < 1)
                            {
                                Commanders.MapCommander.SetBlock(_map, (long)x, (long)y, (long)z, 1);
                            }

                            System.Threading.Thread.Sleep(0);
                        }
                    }
                }
            }

            }));

            base.OnLoad(e);
        }