sces99

sces99

  • NA
  • 3
  • 0

Resetting device error

Apr 1 2005 3:22 AM
Is there any procedure before and after resetting the directX device ? I want to make the toggle fullscreen function , but when I restart the device , there are errors (sometime the error is unknown , sometime it throws DeviceLost Exception) I can start the directX device at the beginning , but if i change the presentationParams and reset the device , it occur error. My code is like this : void initdevice(bool fullscreen) { PresentParameters d3dpp = new PresentParameters(); d3dpp.DeviceWindow = form1; d3dpp.BackBufferWidth = 800; d3dpp.BackBufferHeight = 600; if (fullscreen) { d3dpp.Windowed = false; } else { form1.ClientSize = new Size(800, 600); d3dpp.Windowed = true; } if (device != null) { device.Reset(d3dpp); } else { device = new Device(Manager.Adapters[0].Adapter, DeviceType.Hardware, form1, CreateFlags.HardwareVertexProcessing, d3dpp); } } Is there any procedure that I missed ? or the window form's problem ? or reset method is wrong ? I see some of the programmer simply dispose old device and create a new device instead of using reset(d3dpp) , which method is better ?