private void CmdLight_Click(object sender, System.EventArgs e) { LightControl winLightControl = new LightControl(); using (LightTest lightTest = new LightTest()) { winLightControl.Show(); lightTest.Show(); // Initialize Direct3D and the device object if (!winLightControl.InitD3D(lightTest.Handle)) { MessageBox.Show("Could not initialize Direct3D."); winLightControl.Dispose(); } else { // Load the textures and create the vertices if (!winLightControl.CreateTextures()) { MessageBox.Show("Could not initialize the textures and vertices."); winLightControl.DisposeD3D(); winLightControl.Dispose(); } } // Start with full white light in all vertices winLightControl.Red1.Value = 255; winLightControl.Green1.Value = 255; winLightControl.Blue1.Value = 255; winLightControl.Red2.Value = 255; winLightControl.Green2.Value = 255; winLightControl.Blue2.Value = 255; winLightControl.Red3.Value = 255; winLightControl.Green3.Value = 255; winLightControl.Blue3.Value = 255; winLightControl.Red4.Value = 255; winLightControl.Green4.Value = 255; winLightControl.Blue4.Value = 255; // Ends the test if ESC is pressed in any of the 2 windows while (!winLightControl.EndTest && !lightTest.EndTest) { winLightControl.Render(); // Frame rate calculation lightTest.Text = "Light Test. Frame Rate: " + DirectXLists.CalcFrameRate().ToString(); Application.DoEvents(); } } }
private void CmdLight_Click(object sender, System.EventArgs e) { LightControl winLightControl = new LightControl(); using (LightTest lightTest = new LightTest()) { winLightControl.Show(); lightTest.Show(); // Initialize Direct3D and the device object if(!winLightControl.InitD3D(lightTest.Handle)) { MessageBox.Show("Could not initialize Direct3D."); winLightControl.Dispose(); } else { // Load the textures and create the vertices if(!winLightControl.CreateTextures()) { MessageBox.Show("Could not initialize the textures and vertices."); winLightControl.DisposeD3D(); winLightControl.Dispose(); } } // Start with full white light in all vertices winLightControl.Red1.Value = 255; winLightControl.Green1.Value = 255; winLightControl.Blue1.Value = 255; winLightControl.Red2.Value = 255; winLightControl.Green2.Value = 255; winLightControl.Blue2.Value = 255; winLightControl.Red3.Value = 255; winLightControl.Green3.Value = 255; winLightControl.Blue3.Value = 255; winLightControl.Red4.Value = 255; winLightControl.Green4.Value = 255; winLightControl.Blue4.Value = 255; // Ends the test if ESC is pressed in any of the 2 windows while(!winLightControl.EndTest && !lightTest.EndTest) { winLightControl.Render(); // Frame rate calculation lightTest.Text = "Light Test. Frame Rate: " + DirectXLists.CalcFrameRate().ToString(); Application.DoEvents(); } } }