Beispiel #1
0
        /// <summary>
        /// Create Context using user setting.
        /// </summary>
        /// <param name="c">Control to host the rendering context</param>
        /// <param name="setting">Context setting parameters</param>
        /// <returns>Rendering context</returns>
        public static new Context CreateContext(IntPtr hWnd, ContextSettings setting)
        {
            ContextWin rc = new ContextWin(setting, hWnd);

            rc.CreateOldContext();

            // set highest context major version
            if (setting.MajorVersion == 0xff)
            {
                setting.MajorVersion = (byte)GetInteger(GL.MAJOR_VERSION);
            }

            // set highest context minor version
            if (setting.MinorVersion == 0xff)
            {
                setting.MinorVersion = (byte)GetInteger(GL.MINOR_VERSION);
            }

            // create new context using ARB_create_context
            if (setting.MajorVersion >= 3)
            {
                rc.CreateNewContext();
            }
            else
            {
                setting.Profile = ContextProfile.None;
                setting.Flags   = ContextFlags.None;
            }

            setting.MajorVersion = (byte)GetInteger(GL.MAJOR_VERSION);
            setting.MinorVersion = (byte)GetInteger(GL.MINOR_VERSION);

            return(rc);
        }
Beispiel #2
0
        /// <summary>
        /// Creates a context using custom settings.
        /// </summary>
        /// <param name="hWnd">The window handle to create the context on.</param>
        /// <param name="settings">The custom context settings.</param>
        /// <returns>Context</returns>
        public static Context CreateContext(IntPtr hWnd, ContextSettings settings)
        {
            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Win32NT:
            case PlatformID.Win32Windows:
                return(ContextWin.CreateContext(hWnd, settings));

            default:
                throw new PlatformNotSupportedException();
            }
        }
Beispiel #3
0
 private ContextWin(ContextSettings setting, IntPtr hWnd)
 {
     this.Settings = setting;
     this.hWnd     = hWnd;
     this.disposed = false;
 }