GraphicsDeviceService(IntPtr windowHandle, int width, int height)
{
parameters = new PresentationParameters();
parameters.BackBufferWidth = Math.Max(width, 1);
parameters.BackBufferHeight = Math.Max(height, 1);
parameters.BackBufferFormat = SurfaceFormat.Color;
parameters.EnableAutoDepthStencil = true;
parameters.AutoDepthStencilFormat = DepthFormat.Depth24;
graphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter,
DeviceType.Hardware,
windowHandle,
parameters);
}