public virtual GraphicsDevice CreateDevice(GraphicsDeviceInformation deviceInformation) { var device = GraphicsDevice.New(deviceInformation.Adapter, deviceInformation.DeviceCreationFlags, deviceInformation.GraphicsProfile); var parameters = deviceInformation.PresentationParameters; // Give a chance to gameWindow to create desired graphics presenter, otherwise - create our own. var presenter = gameWindow.CreateGraphicsPresenter(device, parameters) ?? new SwapChainGraphicsPresenter(device, parameters); device.Presenter = presenter; // Force to resize the gameWindow gameWindow.Resize(parameters.BackBufferWidth, parameters.BackBufferHeight); return(device); }
protected virtual void CreatePresenter(GraphicsDevice device, PresentationParameters parameters, object newControl = null) { if (device == null) { throw new ArgumentNullException("device"); } parameters = TryGetParameters(device, parameters); DisposeGraphicsPresenter(device); // override the device window, if available if (newControl != null) { parameters.DeviceWindowHandle = newControl; } // Give a chance to gameWindow to create desired graphics presenter, otherwise - create our own. device.Presenter = gameWindow.CreateGraphicsPresenter(device, parameters) ?? new SwapChainGraphicsPresenter(device, parameters); }