예제 #1
0
        /// <summary>
        /// This function MUST be called when the form with the SimpelOpenGLControl is first shown.
        /// A good place to call is the FormLoadEvent.
        /// </summary>
        public void OnFormShown()
        {
            control.InitializeContexts();
            control.AutoFinish      = true;
            control.AutoSwapBuffers = true;
            control.MouseDown      += new MouseEventHandler(control_MouseDown);
            control.MouseUp        += new MouseEventHandler(control_MouseUp);
            control.MouseMove      += new MouseEventHandler(control_MouseMove);
            w.ScreenSize            = new SizeF(control.Size);
            w.Scale = 30.0f;
            GLUtility.InitGL(control.Width, control.Height, Color.White, control, false);

            xOff                  = 0;
            yOff                  = 0;
            renderTimer           = new System.Timers.Timer(1.0 / fps * 1000.0);
            renderTimer.AutoReset = true;
            renderTimer.Elapsed  += new System.Timers.ElapsedEventHandler(t_Elapsed);
            renderTimer.Enabled   = true;
        }