CSPspEmu.Core.Gpu.Impl.Opengl.OpenglGpuImpl.InitSynchronizedOnce C# (CSharp) Method

InitSynchronizedOnce() public method

public InitSynchronizedOnce ( ) : void
return void
		public override void InitSynchronizedOnce()
		{
			//Memory.WriteBytesHook += OnMemoryWrite;
			this.ScaleViewport = PspStoredConfig.RenderScale;

			if (!AlreadyInitialized)
			{
				AlreadyInitialized = true;
				AutoResetEvent CompletedEvent = new AutoResetEvent(false);
				var CThread = new Thread(() =>
				{
					Thread.CurrentThread.CurrentCulture = new CultureInfo(GlobalConfig.ThreadCultureName);

					OpenglContext = GLContextFactory.CreateWindowless();
					OpenglContext.MakeCurrent();

					Console.Out.WriteLineColored(ConsoleColor.White, "## OpenGL Context Version: {0}", GlGetString(GL.GL_VERSION));
					Console.Out.WriteLineColored(ConsoleColor.White, "## Depth Bits: {0}", GL.glGetInteger(GL.GL_DEPTH_BITS));
					Console.Out.WriteLineColored(ConsoleColor.White, "## Stencil Bits: {0}", GL.glGetInteger(GL.GL_STENCIL_BITS));
					Console.Out.WriteLineColored(ConsoleColor.White, "## Color Bits: {0},{1},{2},{3}", GL.glGetInteger(GL.GL_RED_BITS), GL.glGetInteger(GL.GL_GREEN_BITS), GL.glGetInteger(GL.GL_BLUE_BITS), GL.glGetInteger(GL.GL_ALPHA_BITS));

					if (GL.glGetInteger(GL.GL_STENCIL_BITS) <= 0)
					{
						Console.Error.WriteLineColored(ConsoleColor.Red, "No stencil bits available!");
					}

					OpenglContext.ReleaseCurrent();

					CompletedEvent.Set();
					Console.WriteLine("OpenglGpuImpl.Init.Start()");
					try
					{
						while (Running)
						{
							Thread.Sleep(10);
						}
						StopEvent.Set();
					}
					finally
					{
						Console.WriteLine("OpenglGpuImpl.Init.End()");
					}
				});
				CThread.Name = "GpuImplEventHandling";
				CThread.IsBackground = true;
				CThread.Start();
				CompletedEvent.WaitOne();
			}
		}