Esempio n. 1
0
		public bool Initialize()
		{
			bool result;
			if (result = !this.DesignMode && !this.loaded)
			{
				OpenTK.Platform.IWindowInfo window;
				try
				{
					this.loaded = true;
					if (!this.IsHandleCreated)
						this.CreateHandle();
					window = this.WindowInfo;
				}
				catch
				{
					window = null;
					this.loaded = false;
				}
				if (result = this.loaded)
				{
					Backend.Context.Current = this.Context = this.Context ?? Backend.Context.Current ?? this.CreateContext();
					this.threadPool = this.CreateThreadPool("OpenGL", 8);
					this.SetupViewport();
					this.Initialized.Call();
				}
			}
			return result;
		}
Esempio n. 2
0
		protected Window() :
			base(1024, 768, "", OpenTK.GameWindowFlags.Default, OpenTK.Graphics.GraphicsMode.Default, OpenTK.DisplayDevice.Default)
		{
			this.threadPool = this.CreateThreadPool("OpenGL", 8);
			Backend.Context.Current = this.Context = this.Context ?? Backend.Context.Current ?? this.CreateContext();
			this.redrawSignal = new System.Threading.EventWaitHandle(true, System.Threading.EventResetMode.AutoReset);
		}
Esempio n. 3
0
		protected override void Dispose(bool disposing)
		{
			if (this.threadPool.NotNull())
			{
				this.threadPool.Delete();
				this.threadPool = null;
			}
			if (this.Context.NotNull()) // TODO: only dispose context if this is the last OpenGL control in the current context.
			{
				this.Context.Dispose();
				Backend.Context.Current = this.Context = null;
			}
			base.Dispose(disposing);
		}
Esempio n. 4
0
		protected virtual void Dispose (bool disposing)
		{
			if (this.threadPool.NotNull())
			{
				this.threadPool.Delete();
				this.threadPool = null;
			}
			if (this.Context.NotNull())
			{
				this.Context.Dispose();
				Backend.Context.Current = this.Context = null;
			}
		}