本文整理汇总了C#中PresentParameters.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# PresentParameters.ToString方法的具体用法?C# PresentParameters.ToString怎么用?C# PresentParameters.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PresentParameters
的用法示例。
在下文中一共展示了PresentParameters.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public static void Init(PictureBox handle)
{
try
{
presentParams = new PresentParameters();
presentParams.Windowed = true;
presentParams.EnableAutoDepthStencil = true;
presentParams.AutoDepthStencilFormat = DepthFormat.D24S8;
presentParams.SwapEffect = SwapEffect.Discard;
device = new Device(0, DeviceType.Hardware, handle, CreateFlags.SoftwareVertexProcessing, presentParams);
if (device == null)
return;
SetupEnvironment();
CreateCoordLines();
CamDistance = 4;
init = true;
cam = new Vector3(0, 0, 0);
dir = new Vector3(1, 1, 1);
camdist = 3f;
DebugLog.PrintLn(presentParams.ToString());
DebugLog.PrintLn(device.DeviceCaps.ToString());
DebugLog.PrintLn("DirectX Init succeeded...");
}
catch (DirectXException ex)
{
string s = "DirectX Init error:"
+ "\n\n" + ex.ToString()
+ "\n\n" + presentParams.ToString();
if (device != null)
s += "\n\n" + device.DeviceCaps.ToString();
DebugLog.PrintLn(s);
error = true;
}
}
示例2: CreateD3DResources
//.........这里部分代码省略.........
renderZBuffer =
device.CreateDepthStencilSurface(width, height,
presentParams.AutoDepthStencilFormat,
presentParams.MultiSample,
presentParams.MultiSampleQuality,
false);
} else {
renderZBuffer = null;
}
// Ogre releases the mpRenderSurface here (but not the mpRenderZBuffer)
// release immediately so we don't hog them
// mpRenderSurface->Release();
// We'll need the depth buffer for rendering the swap chain
// //mpRenderZBuffer->Release();
} else {
if (device == null) {
#if !USE_D3D_EVENTS
// Turn off default event handlers, since Managed DirectX seems confused.
Device.IsUsingEventHandlers = false;
#endif
// We haven't created the device yet, this must be the first time
// Do we want to preserve the FPU mode? Might be useful for scientific apps
CreateFlags extraFlags = 0;
if (multiThreaded) {
extraFlags |= CreateFlags.MultiThreaded;
}
// TODO: query and preserve the fpu mode
// Set default settings (use the one Ogre discovered as a default)
int adapterToUse = driver.AdapterNumber;
if (useNVPerfHUD) {
// Look for 'NVIDIA NVPerfHUD' adapter
// If it is present, override default settings
foreach (AdapterInformation identifier in D3D.Manager.Adapters) {
log.Info("Device found: " + identifier.Information.Description);
if (identifier.Information.Description.Contains("PerfHUD")) {
log.Info("Attempting to use PerfHUD");
adapterToUse = identifier.Adapter;
devType = DeviceType.Reference;
break;
}
}
}
try
{
device = new D3D.Device(adapterToUse, devType, windowHandle,
CreateFlags.HardwareVertexProcessing | extraFlags,
presentParams);
}
catch (Exception) {
log.Info("First device creation failed");
try
{
// Try a second time, may fail the first time due to back buffer count,
// which will be corrected down to 1 by the runtime
device = new D3D.Device(adapterToUse, devType, windowHandle,
CreateFlags.HardwareVertexProcessing | extraFlags,
presentParams);
}
catch (Exception)
{
try
{
// Looks like we can't use HardwareVertexProcessing, so try Mixed
device = new D3D.Device(adapterToUse, devType, windowHandle,
CreateFlags.MixedVertexProcessing | extraFlags,
presentParams);
}
catch (Exception)
{
// Ok, one last try. Try software. If this fails, just throw up.
device = new D3D.Device(adapterToUse, devType, windowHandle,
CreateFlags.SoftwareVertexProcessing | extraFlags,
presentParams);
}
}
}
// TODO: For a full screen app, I'm supposed to do this to prevent alt-tab
// from messing things up.
//device.DeviceResizing += new
// System.ComponentModel.CancelEventHandler(this.CancelResize);
}
log.InfoFormat("Device constructed with presentation parameters: {0}", presentParams.ToString());
// update device in driver
driver.Device = device;
// Store references to buffers for convenience
renderSurface = device.GetRenderTarget(0);
renderZBuffer = device.DepthStencilSurface;
// Ogre releases these here
// release immediately so we don't hog them
// mpRenderSurface->Release();
// mpRenderZBuffer->Release();
}
}