public GLContextEventArgs(GLContext context) { if (context == null) throw new ArgumentNullException("context"); this.Context = context; }
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); }
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)); } }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (this.context != null) { this.context.Dispose(); this.context = null; } }