/// <summary> /// Configures the device to use the highest sample type available /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) { // Gets the values of the MultiSampleType enum and stores them in an array MultiSampleType[] types = GetEnumValues <MultiSampleType>(); // Specifies which graphics adapter to create the device on GraphicsAdapter adapter = e.GraphicsDeviceInformation.Adapter; // Loops backwards starting at the highest sampletype, and continues until it reaches the lowest for (int i = types.Length - 1; i >= 0; i--) { if (adapter.CheckDeviceMultiSampleType(DeviceType.Hardware, adapter.CurrentDisplayMode.Format, false, types[i])) { // If the sampletype is available, use it, and end the loop e.GraphicsDeviceInformation.PresentationParameters.MultiSampleQuality = 0; e.GraphicsDeviceInformation.PresentationParameters.MultiSampleType = types[i]; break; } } }
void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) { int width = 0; int height = 0; int refreshRate = 0; SurfaceFormat format = SurfaceFormat.Color; // The Xbox 360 version uses the resolution which set in the Dashboard. width = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width; height = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height; refreshRate = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.RefreshRate; format = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Format; if (height == 0) { throw new FormatException("Not support this graphics adapter"); } e.GraphicsDeviceInformation.PresentationParameters.BackBufferFormat = format; e.GraphicsDeviceInformation.PresentationParameters.BackBufferHeight = height; e.GraphicsDeviceInformation.PresentationParameters.BackBufferWidth = width; e.GraphicsDeviceInformation.PresentationParameters.FullScreenRefreshRateInHz = refreshRate; e.GraphicsDeviceInformation.PresentationParameters.IsFullScreen = true; graphicsInfo.screenWidth = width; graphicsInfo.screenHeight = height; System.Diagnostics.Debug.WriteLine("[Graphics Settings]"); System.Diagnostics.Debug.WriteLine("Buffer Format : " + format.ToString()); System.Diagnostics.Debug.WriteLine("Buffer Width : " + width.ToString()); System.Diagnostics.Debug.WriteLine("Buffer Height : " + height.ToString()); System.Diagnostics.Debug.WriteLine("Refresh Rate Hz : " + refreshRate.ToString()); }
/// <summary> /// This populates a GraphicsDeviceInformation instance and invokes PreparingDeviceSettings to /// allow users to change the settings. Then returns that GraphicsDeviceInformation. /// Throws NullReferenceException if users set GraphicsDeviceInformation.PresentationParameters to null. /// </summary> private GraphicsDeviceInformation DoPreparingDeviceSettings() { var gdi = new GraphicsDeviceInformation(); PrepareGraphicsDeviceInformation(gdi); var preparingDeviceSettingsHandler = PreparingDeviceSettings; if (preparingDeviceSettingsHandler != null) { // this allows users to overwrite settings through the argument var args = new PreparingDeviceSettingsEventArgs(gdi); preparingDeviceSettingsHandler(this, args); if (gdi.PresentationParameters == null || gdi.Adapter == null) { throw new NullReferenceException("Members should not be set to null in PreparingDeviceSettingsEventArgs"); } } return(gdi); }
/// <summary> /// Prepare the graphics device. /// </summary> /// <param name="sender">sender</param> /// <param name="e">event args</param> void GraphicsDeviceManager_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) { if (Environment.OSVersion.Platform != PlatformID.Win32NT) { PresentationParameters presentParams = e.GraphicsDeviceInformation.PresentationParameters; if (_graphicsDeviceManager.PreferredBackBufferHeight == 720) { presentParams.MultiSampleType = MultiSampleType.FourSamples; #if !DEBUG presentParams.PresentationInterval = PresentInterval.One; #endif } else { presentParams.MultiSampleType = MultiSampleType.TwoSamples; #if !DEBUG presentParams.PresentationInterval = PresentInterval.Two; #endif } } }
private void GraphicsPreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) { var pp = e.GraphicsDeviceInformation.PresentationParameters; var adapter = e.GraphicsDeviceInformation.Adapter; var dispFormat = adapter.CurrentDisplayMode.Format; var dephFormat = pp.DepthStencilFormat; SurfaceFormat selectedFormat; DepthFormat selectedDepthFormat; int selectedMultiSampleCount; if (adapter.QueryRenderTargetFormat(GraphicsProfile.HiDef, dispFormat, dephFormat, 4, out selectedFormat, out selectedDepthFormat, out selectedMultiSampleCount)) { pp.MultiSampleCount = 4; } else if (adapter.QueryRenderTargetFormat(GraphicsProfile.HiDef, dispFormat, dephFormat, 2, out selectedFormat, out selectedDepthFormat, out selectedMultiSampleCount)) { pp.MultiSampleCount = 2; } }
/// <summary> /// Called just before the graphics device for the presentation is created. This method callback is used to setup /// the device settings. The WindowSetup is used to set the presentation parameters. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void GraphicsPreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) { PresentationParameters pp = WindowSetup; if (pp != null) { e.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage = pp.RenderTargetUsage; e.GraphicsDeviceInformation.PresentationParameters.DepthStencilFormat = pp.DepthStencilFormat; e.GraphicsDeviceInformation.PresentationParameters.BackBufferFormat = pp.BackBufferFormat; if (!_DeviceWasCreated) { // Only set the buffer dimensions when the device was not created e.GraphicsDeviceInformation.PresentationParameters.BackBufferWidth = pp.BackBufferWidth; e.GraphicsDeviceInformation.PresentationParameters.BackBufferHeight = pp.BackBufferHeight; } } else { e.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PreserveContents; e.GraphicsDeviceInformation.PresentationParameters.DepthStencilFormat = DepthFormat.Depth24Stencil8; e.GraphicsDeviceInformation.PresentationParameters.BackBufferFormat = SurfaceFormat.Color; } }
void GDM_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) { // This enables NVIDIA PerfHud to be run on Open Rails. foreach (var adapter in GraphicsAdapter.Adapters) { // FIXME: MonoGame fails with the following: /*if (adapter.Description.Contains("PerfHUD")) * { * GraphicsAdapter.UseReferenceDevice = true; * break; * }*/ e.GraphicsDeviceInformation.GraphicsProfile = GraphicsProfile.HiDef; } // This stops ResolveBackBuffer() clearing the back buffer. e.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PreserveContents; e.GraphicsDeviceInformation.PresentationParameters.DepthStencilFormat = DepthFormat.Depth24Stencil8; if (Game.Settings.EnableMultisampling == false) { e.GraphicsDeviceInformation.PresentationParameters.MultiSampleCount = 4; } }
// Used to set desired antialiasing type. Doesn't check if type is available. We assume that // m_antiAliasingType contains only valid types. And they are if ther were obtained from GetAvailableAntiAliasingTypes() static void GraphicsDeviceManager_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) { MyMwcLog.WriteLine("MyVideoModeManager.GraphicsPreparingDeviceSettings - START"); MyMwcLog.IncreaseIndent(); // This is for enabling profiling in NVIDIA PerfHUD. It's compiled only for developer build. We don't want it in release build. if (MyMwcFinalBuildConstants.ENABLE_PERFHUD == true) { /* * foreach (GraphicsAdapter adapter in GraphicsAdapter.Adapters) * { * MyMwcLog.WriteLine(adapter.Description.Description); * if (adapter.Description.Description.Contains("PerfHUD")) * { * e.GraphicsDeviceInformation.Adapter = adapter; * //GraphicsAdapter.UseReferenceDevice = true; * break; * } * } */ } /* * MyMwcLog.WriteLine("GraphicsDeviceInformation.PresentationParameters.MultiSampleCount: " + e.GraphicsDeviceInformation.PresentationParameters.MultiSampleCount); * MyMwcLog.WriteLine("GraphicsDeviceInformation.PresentationParameters.PresentationInterval: " + e.GraphicsDeviceInformation.PresentationParameters.PresentationInterval); * //MyMwcLog.WriteLine("GraphicsDeviceInformation.PresentationParameters.DisplayOrientation: " + e.GraphicsDeviceInformation.PresentationParameters.DisplayOrientation); * MyMwcLog.WriteLine("GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage: " + e.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage); * MyMwcLog.WriteLine("GraphicsDeviceInformation.PresentationParameters.DepthStencilFormat: " + e.GraphicsDeviceInformation.PresentationParameters.DepthStencilFormat); * MyMwcLog.WriteLine("GraphicsDeviceInformation.PresentationParameters.IsFullScreen: " + e.GraphicsDeviceInformation.PresentationParameters.IsFullScreen); * MyMwcLog.WriteLine("GraphicsDeviceInformation.PresentationParameters.BackBufferWidth: " + e.GraphicsDeviceInformation.PresentationParameters.BackBufferWidth); * MyMwcLog.WriteLine("GraphicsDeviceInformation.PresentationParameters.BackBufferHeight: " + e.GraphicsDeviceInformation.PresentationParameters.BackBufferHeight); * MyMwcLog.WriteLine("GraphicsDeviceInformation.PresentationParameters.BackBufferFormat: " + e.GraphicsDeviceInformation.PresentationParameters.BackBufferFormat); * //MyMwcLog.WriteLine("GraphicsDeviceInformation.PresentationParameters.Bounds: " + e.GraphicsDeviceInformation.PresentationParameters.b.Bounds); * MyMwcLog.WriteLine("GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage: " + e.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage); */ MyMwcLog.DecreaseIndent(); MyMwcLog.WriteLine("MyVideoModeManager.GraphicsPreparingDeviceSettings - END"); }
//Found this method on XNA Fever, meant for anti aliasing. Many thanks. void GraphicsPreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) { PresentationParameters pp = e.GraphicsDeviceInformation.PresentationParameters; #if XBOX pp.MultiSampleQuality = 1; pp.MultiSampleType = MultiSampleType.FourSamples; return; #endif GraphicsAdapter adapter = e.GraphicsDeviceInformation.Adapter; SurfaceFormat format = adapter.CurrentDisplayMode.Format; int quality = 0; if (adapter.CheckDeviceMultiSampleType(DeviceType.Hardware, format, false, MultiSampleType.FourSamples, out quality)) { pp.MultiSampleQuality = 0; pp.MultiSampleType = MultiSampleType.FourSamples; } else if (adapter.CheckDeviceMultiSampleType(DeviceType.Hardware, format, false, MultiSampleType.TwoSamples, out quality)) { pp.MultiSampleQuality = 0; pp.MultiSampleType = MultiSampleType.TwoSamples; } }
void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) { GraphicsAdapter adapter = null; foreach (var item in GraphicsAdapter.Adapters) { if (item.IsProfileSupported(GraphicsProfile.HiDef)) { adapter = item; } else { if (adapter == null && item.IsProfileSupported(GraphicsProfile.Reach)) { adapter = item; } } } if (adapter == null) { throw new System.NotSupportedException("None of your graphics cards support XNA."); } e.GraphicsDeviceInformation.Adapter = adapter; }
void SetMultiSampling(object sender, PreparingDeviceSettingsEventArgs eventArgs) { PresentationParameters PresentParm = eventArgs.GraphicsDeviceInformation.PresentationParameters; PresentParm.MultiSampleCount = 4; }
protected override void OnPreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) { base.OnPreparingDeviceSettings(sender, e); }
void PreparingDeviceSettings( Object sender,PreparingDeviceSettingsEventArgs e ) { if( MonkeyConfig.XNA_VSYNC_ENABLED=="1" ){ PresentationParameters pp=e.GraphicsDeviceInformation.PresentationParameters; pp.PresentationInterval=PresentInterval.One; } }
private static void _graphics_event_changing(object obj, PreparingDeviceSettingsEventArgs e) { e.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PreserveContents; }
// callback for preparing device settings, see link above for more info private void Graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) { graphics.PreferMultiSampling = true; e.GraphicsDeviceInformation.PresentationParameters.MultiSampleCount = 8; }
private void PrepareDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) { e.GraphicsDeviceInformation.GraphicsProfile = GraphicsProfile.HiDef; }
protected virtual void GraphicsPreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) { e.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PreserveContents; e.GraphicsDeviceInformation.PresentationParameters.DepthStencilFormat = DepthFormat.Depth24Stencil8; e.GraphicsDeviceInformation.PresentationParameters.BackBufferFormat = SurfaceFormat.Color; }
void Inner_deviceSettings(object sender, PreparingDeviceSettingsEventArgs e) { e.GraphicsDeviceInformation.PresentationParameters.PresentationInterval = PresentInterval.One; }
private void PrepareDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) { e.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PlatformContents; }
public static void Draw(object sender, PreparingDeviceSettingsEventArgs args) => args.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PreserveContents;
/// This method ensures that we can render to the back buffer without /// losing the data we already had in our previous back buffer. This /// is necessary for the SkeletonStreamRenderer. /// <param name="sender">The sending object.</param> /// <param name="e">The event args.</param> private void GraphicsDevicePreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) { // This is necessary because we are rendering to back buffer/render targets and we need to preserve the data e.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PreserveContents; }
protected void CustomGraphicsDeviceManager_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) { e.GraphicsDeviceInformation.PresentationParameters.IsFullScreen = false; }
private void PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs args) { PresentationParameters pp = args.GraphicsDeviceInformation.PresentationParameters; ChangeSize(pp.BackBufferWidth, pp.BackBufferHeight); }
/// <param name="deviceSettings">Arguments for the graphics manager PreparingDeviceSettings event.</param> /// <summary> /// Creates an initialized instance of the DeviceEventArgs class. /// </summary> public DeviceEventArgs(PreparingDeviceSettingsEventArgs deviceSettings) { DeviceSettings = deviceSettings; }
/// <summary> /// This method ensures that we can render to the back buffer without /// losing the data we already had in our previous back buffer. This /// is necessary for the SkeletonStreamRenderer. /// </summary> /// <param name="sender">The sending object.</param> /// <param name="e">The event args.</param> private void GraphicsDevicePreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) { // This is necessary because we are rendering to back buffer/render targets and we need to preserve the data e.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PreserveContents; }
void PrepareDevice(object sender, PreparingDeviceSettingsEventArgs eventargs) { return; }
private void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) { e.GraphicsDeviceInformation.PresentationParameters. DeviceWindowHandle = _drawSurface; }
// I copied this. It makes so that switching to renderTarget doesn't clear the screen automatically private static void SetToPreserve(object sender, PreparingDeviceSettingsEventArgs eventargs) { eventargs.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PreserveContents; }
void dev_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) { e.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PreserveContents; }
private void OnPreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs args) { args.GraphicsDeviceInformation.PresentationParameters.DeviceWindowHandle = drawSurface.Handle; }
private static void GraphicsDeviceManager_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) { e.GraphicsDeviceInformation.PresentationParameters.MultisampleCount = Xenko.Graphics.MultisampleCount.None; }
private void Graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) { e.GraphicsDeviceInformation.GraphicsProfile = GraphicsProfile.Reach; e.GraphicsDeviceInformation.PresentationParameters.MultiSampleCount = 2; }