private void CaptureForm_Load(object sender, EventArgs e) { // Get Target Procces List<Process> ps = Process.GetProcesses().ToList(); Process target = ps.Find(p => p.ProcessName == "mpc-hc64"); if (target == null) throw new Exception("ターゲットプロセスが見つかりません"); targetWindowHnadle = target.MainWindowHandle; targetWindowSize = CaptureHelper.GetWindowSize(targetWindowHnadle); frameBuf = Data.Create(targetWindowSize); // Init OpenGL glcScreen.MakeCurrent(); GL.Enable(EnableCap.DepthTest); GL.Enable(EnableCap.CullFace); GL.FrontFace(FrontFaceDirection.Cw); GL.CullFace(CullFaceMode.Back); // load textures SetupViewport(); sampleTex = MyTexture.Create(frameBuf.Bitmap.Width, frameBuf.Bitmap.Height); MyTexture.Init(glcScreen); //sampleTex = MyTexture.Load("../../texture/tex.jpg"); // backTex = MyTexture.Load("../../texture/back.png"); }
private void btnBeginRecode_Click(object sender, EventArgs e) { frameBuf = Data.Create(targetWindowSize); sampleTex = MyTexture.Create(frameBuf.Bitmap.Width, frameBuf.Bitmap.Height); }
public static Data Create(Size size) { Data tmp = new Data(); tmp.Bitmap = new Bitmap(size.Width, size.Height); tmp.Graphics = Graphics.FromImage(tmp.Bitmap); return tmp; }