OpenTK.GLControlFactory.CreateGLControl C# (CSharp) Method

CreateGLControl() public static method

public static CreateGLControl ( OpenTK.Graphics.GraphicsMode mode, Control control ) : IGLControl
mode OpenTK.Graphics.GraphicsMode
control System.Windows.Forms.Control
return IGLControl
        public static IGLControl CreateGLControl(GraphicsMode mode, Control control)
        {
            if (mode == null)
                throw new ArgumentNullException("mode");
            if (control == null)
                throw new ArgumentNullException("control");
            if (Configuration.RunningOnWindows) return new WinGLControl(mode, control);
            else if (Configuration.RunningOnMacOS) return new CarbonGLControl(mode, control);
            else if (Configuration.RunningOnX11) return new X11GLControl(mode, control);
            else throw new PlatformNotSupportedException();
        }
    }

Usage Example

Esempio n. 1
0
        /// <summary>Raises the HandleCreated event.</summary>
        /// <param name="e">Not used.</param>
        protected override void OnHandleCreated(EventArgs e)
        {
            if (context != null)
            {
                context.Dispose();
            }

            if (implementation != null)
            {
                implementation.WindowInfo.Dispose();
            }

            if (DesignMode)
            {
                implementation = new DummyGLControl();
            }
            else
            {
                implementation = GLControlFactory.CreateGLControl(format, this);
            }

            context = implementation.CreateContext(major, minor, flags);
            MakeCurrent();

            if (!DesignMode)
            {
                ((IGraphicsContextInternal)Context).LoadAll();
            }

            // Deferred setting of vsync mode. See VSync property for more information.
            if (initial_vsync_value.HasValue)
            {
                Context.VSync       = initial_vsync_value.Value;
                initial_vsync_value = null;
            }

            base.OnHandleCreated(e);

            if (resize_event_suppressed)
            {
                OnResize(EventArgs.Empty);
                resize_event_suppressed = false;
            }
        }
GLControlFactory