public static void ChangeResolution() { switch (resolution) { case Resolution.P128X72: width = 128; height = 72; break; case Resolution.P256X144: width = 256; height = 144; break; case Resolution.P512X288: width = 512; height = 288; break; case Resolution.P1024X576: width = 1024; height = 576; break; case Resolution.P1280X720: width = 1280; height = 720; break; } CudaUtil.InitializeResources(width, height); ResetMap(); AddMapToCuda(); isResolutionChanged = false; }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); CudaUtil.InitializeResources(CommonInfo.width, CommonInfo.height); CommonInfo.MallocMap(); CommonInfo.AddMapToCuda(); mainForm mainForm = new mainForm( ); Loop loop = new Loop(mainForm); ThreadStart renderStart = new ThreadStart(loop.loop); Thread renderLoop = new Thread(renderStart); //开启调度线程(切换图片的函数) ThreadStart showStart = new ThreadStart(loop.ShowImage); Thread showLoop = new Thread(showStart); renderLoop.Start(); showLoop.Start(); Application.Run(mainForm); CudaUtil.FreeResources(); }