示例#1
0
 private void Dispose(bool manual)
 {
     if (!disposed)
     {
         if (manual)
         {
             if (glWindow != null)
             {
                 glContext.Dispose();
                 glWindow.Dispose();
                 glWindow = null;
             }
         }
         disposed = true;
     }
 }
示例#2
0
        /// <summary>
        /// Constructs a new GameWindow with the specified title, and opens a render window with the
        /// specified DisplayMode.
        /// </summary>
        /// <param name="mode">The DisplayMode of the GameWindow.</param>
        /// <param name="title">The Title of the GameWindow.</param>
        public GameWindow(DisplayMode mode, string title)
        {
            switch (Environment.OSVersion.Platform)
            {
                case PlatformID.Win32NT:
                case PlatformID.Win32S:
                case PlatformID.Win32Windows:
                case PlatformID.WinCE:
                    glWindow = new OpenTK.Platform.Windows.WinGLNative();
                    break;

                case PlatformID.Unix:
                case (PlatformID)128:
                    glWindow = new OpenTK.Platform.X11.X11GLNative();
                    break;

                default:
                    throw new PlatformNotSupportedException(
                        "Your platform is not supported currently. Please, refer to http://opentk.sourceforge.net for more information.");
            }

            glWindow.Destroy += glWindow_Destroy;

            CreateWindow(mode, title);

            //this.vsync = VSyncMode.Adaptive;
            this.VSync = VSyncMode.On;
        }