public GLContextEventArgs(GLContext context)
        {
            if (context == null)
                throw new ArgumentNullException("context");

            this.Context = context;
        }
Beispiel #2
0
        protected override HandleRef BuildWindowCore(HandleRef hWndParent)
        {
            this.hWnd = CreateHostWindow(hWndParent.Handle);

            if (!DesignerProperties.GetIsInDesignMode(this))
            {
                if (glContextParams == null)
                    throw new GLException("GLContextParams must be set before the GLControl is created.");

                firstControlCreated = true;
                this.context = new GLContext(new WGLContext(, this.hWnd));
                this.OnContextCreated(new GLContextEventArgs(this.context));
            }

            return new HandleRef(this, this.hWnd);
        }
Beispiel #3
0
        protected override void OnCreateControl()
        {
            base.OnCreateControl();

            if (!this.IsDesignerHosted)
            {
                if (contextParams == null)
                    throw new InvalidOperationException("GLControl.ContextParams must be set before the first GLControl is created.");

                this.context = new GLContext(
                    new WGLContext(
                        this.Handle, 
                        contextParams.Value.VersionMajor, 
                        contextParams.Value.VersionMinor, 
                        contextParams.Value.ForwardCompatible));

                firstControlCreated = true;

                this.OnContextCreated(new GLContextEventArgs(this.context));
            }
        }
Beispiel #4
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            if (this.context != null)
            {
                this.context.Dispose();
                this.context = null;
            }
        }