本文整理汇总了C#中PresentParameters类的典型用法代码示例。如果您正苦于以下问题:C# PresentParameters类的具体用法?C# PresentParameters怎么用?C# PresentParameters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PresentParameters类属于命名空间,在下文中一共展示了PresentParameters类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateDevice
private static Device CreateDevice()
{
var presentParameters = new PresentParameters()
{
Windowed = true,
SwapEffect = SwapEffect.Discard,
BackBufferFormat = Format.Unknown,
AutoDepthStencilFormat = DepthFormat.D16,
EnableAutoDepthStencil = true
};
var deviceCaps = Manager.GetDeviceCaps(Manager.Adapters.Default.Adapter, DeviceType.Hardware).DeviceCaps;
var createFlags = ((deviceCaps.SupportsHardwareTransformAndLight)
? CreateFlags.HardwareVertexProcessing
: CreateFlags.SoftwareVertexProcessing);
if (deviceCaps.SupportsPureDevice)
createFlags |= CreateFlags.PureDevice;
var device = new Device(0, DeviceType.Hardware, RenderForm, createFlags, presentParameters);
device.RenderState.CullMode = Cull.None;
device.RenderState.Lighting = false;
device.DeviceReset += (sender, e) =>
{
System.Diagnostics.Debug.WriteLine("DeviceReset");
var d = (Device)sender;
d.RenderState.CullMode = Cull.None;
d.RenderState.Lighting = false;
};
device.DeviceLost += (sender, e) => { System.Diagnostics.Debug.WriteLine("DeviceLost"); };
device.DeviceResizing += (sender, e) => { System.Diagnostics.Debug.WriteLine("DeviceResizing"); };
return device;
}
开发者ID:wverkley,项目名称:Swg.Explorer,代码行数:34,代码来源:DDSHelper.cs
示例2: InitializeDevice
public void InitializeDevice()
{
PresentParameters presentParameters = new PresentParameters();
presentParameters.Windowed = true;
presentParameters.SwapEffect = SwapEffect.Discard;
Device = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, presentParameters);
}
开发者ID:kholdfuzion,项目名称:halo2x-sunfish,代码行数:7,代码来源:RenderDevice.cs
示例3: DxScreenCapture
public DxScreenCapture()
{
PresentParameters present_params = new PresentParameters();
present_params.Windowed = true;
present_params.SwapEffect = SwapEffect.Discard;
d = new Device(new Direct3D(), 0, DeviceType.Hardware, IntPtr.Zero, CreateFlags.SoftwareVertexProcessing, present_params);
}
开发者ID:FUR10N,项目名称:Minesweeper,代码行数:7,代码来源:DxScreenCapture.cs
示例4: DXControl
public DXControl()
{
// start timer
_sw.Start();
// initialize d3d device
_direct3d = new Direct3D();
_presentParam = new PresentParameters()
{
BackBufferWidth = ClientSize.Width,
BackBufferHeight = ClientSize.Height,
Windowed = true,
BackBufferFormat = Format.X8R8G8B8,
BackBufferCount = 1,
SwapEffect = SwapEffect.Discard,
EnableAutoDepthStencil = true,
AutoDepthStencilFormat = Format.D24S8,
};
_device = new Device(_direct3d, 0,
DeviceType.Hardware, Handle,
CreateFlags.HardwareVertexProcessing, _presentParam);
// event handlers
Resize += OnResize;
}
开发者ID:ousttrue,项目名称:csmeshio,代码行数:25,代码来源:DXControl.cs
示例5: InitializeGraphics
/// <summary>
///
/// </summary>
public void InitializeGraphics()
{
PresentParameters presentParams = new PresentParameters();
presentParams.Windowed = true;
presentParams.SwapEffect = SwapEffect.Discard;
presentParams.AutoDepthStencilFormat = DepthFormat.D16;
presentParams.EnableAutoDepthStencil = true;
// Create our device
this.dxDevice = new Device(0, DeviceType.Hardware, this.Handle, CreateFlags.SoftwareVertexProcessing, presentParams);
this.dxDevice.RenderState.ZBufferEnable = true;
this.dxDevice.RenderState.ZBufferFunction = Compare.LessEqual;
this.dxDevice.RenderState.MultiSampleAntiAlias = true;
this.vtrOrigin[0] = new Vector3(-1.0f * this.fOriginBounds, 0, 0);
this.vtrOrigin[1] = new Vector3(this.fOriginBounds, 0, 0);
this.vtrOrigin[2] = new Vector3(0, 0, 0);
this.vtrOrigin[3] = new Vector3(0, -1.0f * this.fOriginBounds, 0);
this.vtrOrigin[4] = new Vector3(0, this.fOriginBounds, 0);
this.vtrOrigin[5] = new Vector3(0, 0, 0);
this.vtrOrigin[6] = new Vector3(0, 0, -1.0f * this.fOriginBounds);
this.vtrOrigin[7] = new Vector3(0, 0, this.fOriginBounds);
this.boxMesh = Mesh.Box(this.dxDevice, 4, 0.7f, 6); //change to robot model :-)
this.boxMaterial = new Material();
this.boxMaterial.Emissive = Color.DarkOliveGreen;
this.boxMaterial.Ambient = Color.WhiteSmoke;
this.boxMaterial.Diffuse = Color.WhiteSmoke;
}
开发者ID:salih18200,项目名称:orcs,代码行数:32,代码来源:UsrCtrlAxis3D.cs
示例6: D3dManager
public D3dManager(Form i_main_window, NyARParam i_nyparam, int i_profile_id)
{
PresentParameters pp = new PresentParameters();
// ウインドウモードなら true、フルスクリーンモードなら false を指定
pp.Windowed = true;
// スワップとりあえずDiscardを指定。
pp.SwapEffect = SwapEffect.Discard;
pp.EnableAutoDepthStencil = true;
pp.AutoDepthStencilFormat = DepthFormat.D16;
pp.BackBufferCount = 0;
pp.BackBufferFormat = Format.R5G6B5;
this._d3d_device = new Device(0, DeviceType.Default, i_main_window.Handle, CreateFlags.None, pp);
//ビューポートを指定
float scale = setupView(i_nyparam,i_main_window.ClientSize);
this._scale = scale;
// ライトを無効
this._d3d_device.RenderState.Lighting = false;
//カメラ画像の転写矩形を作成
Viewport vp=this._d3d_device.Viewport;
this._view_rect = new Rectangle(vp.X, vp.Y, vp.Width, vp.Height);
NyARIntSize cap_size = i_nyparam.getScreenSize();
this._background_size = new Size(cap_size.w, cap_size.h);
return;
}
开发者ID:whztt07,项目名称:NyARToolkitCS,代码行数:27,代码来源:D3dManager.cs
示例7: load_image
public void load_image(string DDS)
{
if (this.gs != null)
{
this.gs.Dispose();
}
try
{
PresentParameters presentParameters = new PresentParameters();
presentParameters.SwapEffect = SwapEffect.Discard;
Format format = Manager.Adapters[0].CurrentDisplayMode.Format;
presentParameters.Windowed = true;
Device device = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, new PresentParameters[]
{
presentParameters
});
Texture texture = TextureLoader.FromFile(device, DDS);
this.gs = TextureLoader.SaveToStream(ImageFileFormat.Png, texture);
texture.Dispose();
this.pictureBox.Image = Image.FromStream(this.gs);
device.Dispose();
this.gs.Close();
}
catch (Exception var_4_B4)
{
}
}
开发者ID:Jiwan,项目名称:ROSE-Dev-Workshop,代码行数:27,代码来源:ZSCForm.cs
示例8: PrepareD3dDevice
/* Direct3Dデバイスを準備する関数
*/
private Device PrepareD3dDevice(Control i_window)
{
PresentParameters pp = new PresentParameters();
pp.Windowed = true;
pp.SwapEffect = SwapEffect.Flip;
pp.BackBufferFormat = Format.X8R8G8B8;
pp.BackBufferCount = 1;
pp.EnableAutoDepthStencil = true;
pp.AutoDepthStencilFormat = DepthFormat.D16;
CreateFlags fl_base = CreateFlags.FpuPreserve;
try{
return new Device(0, DeviceType.Hardware, i_window.Handle, fl_base|CreateFlags.HardwareVertexProcessing, pp);
}catch (Exception ex1){
Debug.WriteLine(ex1.ToString());
try{
return new Device(0, DeviceType.Hardware, i_window.Handle, fl_base | CreateFlags.SoftwareVertexProcessing, pp);
}catch (Exception ex2){
// 作成に失敗
Debug.WriteLine(ex2.ToString());
try{
return new Device(0, DeviceType.Reference, i_window.Handle, fl_base | CreateFlags.SoftwareVertexProcessing, pp);
}catch (Exception ex3){
throw ex3;
}
}
}
}
开发者ID:whztt07,项目名称:NyARToolkitCS,代码行数:30,代码来源:SimpleLite_ImageSource.cs
示例9: 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;
}
}
开发者ID:CreeperLava,项目名称:ME3Explorer,代码行数:34,代码来源:DXHelper.cs
示例10: DeviceContext9
internal DeviceContext9(Form form, DeviceSettings9 settings)
{
if (form.Handle == IntPtr.Zero)
throw new ArgumentException("Value must be a valid window handle.", "handle");
if (settings == null)
throw new ArgumentNullException("settings");
this.settings = settings;
PresentParameters = new PresentParameters();
PresentParameters.BackBufferFormat = Format.X8R8G8B8;
PresentParameters.BackBufferCount = 1;
PresentParameters.BackBufferWidth = form.ClientSize.Width;
PresentParameters.BackBufferHeight = form.ClientSize.Height;
PresentParameters.Multisample = settings.MultisampleType;
PresentParameters.SwapEffect = SwapEffect.Discard;
PresentParameters.EnableAutoDepthStencil = true;
PresentParameters.AutoDepthStencilFormat = Format.D24S8;
PresentParameters.PresentFlags = PresentFlags.DiscardDepthStencil;
PresentParameters.PresentationInterval = PresentInterval.Immediate;
PresentParameters.Windowed = settings.Windowed;
PresentParameters.DeviceWindowHandle = form.Handle;
direct3D = new Direct3D();
Device = new Device(direct3D, settings.AdapterOrdinal, DeviceType.Hardware, form.Handle, settings.CreationFlags, PresentParameters);
}
开发者ID:WebFreak001,项目名称:BulletSharp,代码行数:26,代码来源:DeviceContext9.cs
示例11: ScreenCapture
public ScreenCapture()
{
PresentParameters _presentParameters =new PresentParameters();
_presentParameters.Windowed = true;
_presentParameters.SwapEffect=SwapEffect.Discard;
_device = new Device(new Direct3D(), 0, DeviceType.Hardware, IntPtr.Zero, CreateFlags.MixedVertexProcessing, _presentParameters);
}
开发者ID:Bosu123l,项目名称:myAmbiligth,代码行数:7,代码来源:ScreenCapture.cs
示例12: D3DDeviceService
private D3DDeviceService(IntPtr windowIntPtr)
{
isDeviceLost = false;
m_pp = new PresentParameters
{
Windowed = true,
SwapEffect = SwapEffect.Discard,
PresentationInterval = PresentInterval.One,
BackBufferFormat = Manager.Adapters.Default.CurrentDisplayMode.Format,
BackBufferWidth = Manager.Adapters.Default.CurrentDisplayMode.Width,
BackBufferHeight = Manager.Adapters.Default.CurrentDisplayMode.Height,
};
CreateFlags flags = new CreateFlags();
Caps caps = Manager.GetDeviceCaps(0, DeviceType.Hardware);
if(caps.DeviceCaps.SupportsHardwareTransformAndLight)
flags |= CreateFlags.HardwareVertexProcessing;
else
flags |= CreateFlags.SoftwareVertexProcessing;
if(caps.DeviceCaps.SupportsPureDevice)
flags |= CreateFlags.PureDevice;
D3DDevice = new Device(0, caps.DeviceType, windowIntPtr, flags, m_pp);
}
开发者ID:sgrzeda,项目名称:rose,代码行数:26,代码来源:D3DDeviceService.cs
示例13: D3DDevice
public D3DDevice(IntPtr windowPtr, bool bWindowed, long Width, long Height)
{
m_bWindowed = bWindowed;
m_Format = Find16BitMode();
PresentParameters presentParameters = new PresentParameters();
presentParameters.Windowed = m_bWindowed;
presentParameters.SwapEffect = SwapEffect.Discard;
presentParameters.BackBufferCount = 1;
presentParameters.PresentationInterval = PresentInterval.Immediate;
presentParameters.AutoDepthStencilFormat = DepthFormat.D16;
presentParameters.EnableAutoDepthStencil = true;
if(!bWindowed)
{
presentParameters.BackBufferFormat = m_Format;
presentParameters.BackBufferWidth = (int)Width;
presentParameters.BackBufferHeight = (int)Height;
}
else
{
presentParameters.BackBufferFormat = Format.Unknown;
presentParameters.BackBufferWidth = (int)Width;
presentParameters.BackBufferHeight = (int)Height;
}
m_D3DDevice = new Microsoft.DirectX.Direct3D.Device(0,
DeviceType.Hardware, windowPtr,
CreateFlags.SoftwareVertexProcessing, presentParameters);
}
开发者ID:andrewgbliss,项目名称:CS_DXMAN,代码行数:30,代码来源:D3DDevice.cs
示例14: DeviceContext9
/// <summary>
/// Initializes a new instance of the <see cref="DeviceContext9"/> class.
/// </summary>
/// <param name="handle">The window handle to associate with the device.</param>
/// <param name="settings">The settings used to configure the device.</param>
internal DeviceContext9(IntPtr handle, DeviceSettings9 settings)
{
if (handle == IntPtr.Zero)
throw new ArgumentException("Value must be a valid window handle.", "handle");
if (settings == null)
throw new ArgumentNullException("settings");
this.settings = settings;
PresentParameters = new PresentParameters();
PresentParameters.BackBufferFormat = Format.X8R8G8B8;
PresentParameters.BackBufferCount = 1;
PresentParameters.BackBufferWidth = settings.Width;
PresentParameters.BackBufferHeight = settings.Height;
PresentParameters.Multisample = MultisampleType.None;
PresentParameters.SwapEffect = SwapEffect.Discard;
PresentParameters.EnableAutoDepthStencil = true;
PresentParameters.AutoDepthStencilFormat = Format.D24X8;
PresentParameters.PresentFlags = PresentFlags.DiscardDepthStencil;
PresentParameters.PresentationInterval = PresentInterval.Default;
PresentParameters.Windowed = true;
PresentParameters.DeviceWindowHandle = handle;
direct3D = new Direct3D();
int msaaQuality = 0;
if (direct3D.CheckDeviceMultisampleType(settings.AdapterOrdinal, DeviceType.Hardware, Format.A8R8G8B8, true, MultisampleType.FourSamples, out msaaQuality))
{
this.MultisampleType = SlimDX.Direct3D9.MultisampleType.FourSamples;
this.MultisampleQuality = msaaQuality - 1;
PresentParameters.Multisample = MultisampleType.FourSamples;
PresentParameters.MultisampleQuality = msaaQuality - 1;
}
Device = new Device(direct3D, settings.AdapterOrdinal, DeviceType.Hardware, handle, settings.CreationFlags, PresentParameters);
}
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:40,代码来源:DeviceContext9.cs
示例15: InitializeGraphics
public void InitializeGraphics()
{
try
{
PresentParameters presentParams = new PresentParameters();
presentParams.Windowed = true;
presentParams.SwapEffect = SwapEffect.Discard;
DirectXGraphicsCard = new Device(0,
DeviceType.Hardware,
this,
CreateFlags.HardwareVertexProcessing,
presentParams);
// Create a new Event Handler which is triggered if somebody resizes the window or something
DirectXGraphicsCard.DeviceReset += new System.EventHandler(this.OnResetDevice);
// Currently nobody is resizing any windows so the trigger is set to off
OnResetDevice(DirectXGraphicsCard, null);
}
catch (DirectXException e)
{
MessageBox.Show(null,
"Error intializing graphics: "
+ e.Message, "Error");
Close();
}
}
开发者ID:JeremiahZhang,项目名称:AKA,代码行数:25,代码来源:Form1.cs
示例16: CreateRenderWindow
static RenderWindow CreateRenderWindow()
{
//GraphicsAPIManager.Instance.RegisterGraphicsAPI(new Apoc3D.RenderSystem.Xna.XnaGraphicsAPIFactory());
devContent = GraphicsAPIManager.Instance.CreateDeviceContent();
PresentParameters pm = new PresentParameters();
pm.BackBufferFormat = ImagePixelFormat.A8R8G8B8;
pm.BackBufferWidth = ScreenWidth;
pm.BackBufferHeight = ScreenHeight;
pm.IsWindowed = true;
pm.DepthFormat = DepthFormat.Depth32;
RenderControl ctrl = devContent.Create(pm);
RenderWindow window = (RenderWindow)ctrl;
window.EventHandler = new Code2015(devContent.RenderSystem, (X.Game)window.Tag);
#region hacks
//X.Game game = (X.Game)window.Tag;
//XGS.GamerServicesComponent liveComp = new XGS.GamerServicesComponent(game);
//game.Components.Add(liveComp);
#endregion
return window;
}
开发者ID:yuri410,项目名称:lrvbsvnicg,代码行数:27,代码来源:Program.cs
示例17: InitializeGraphics
// Init the Managed Direct3D Device
public void InitializeGraphics()
{
presentParams = new PresentParameters();
// This sample is only windowed
presentParams.Windowed = true;
// Enable Z-Buffer
// This is not really needed in this sample but real applications generaly use it
presentParams.EnableAutoDepthStencil = true;
presentParams.AutoDepthStencilFormat = DepthFormat.D16;
// Hint to the Device Driver : This is a video playing application
presentParams.PresentFlag = PresentFlag.Video;
// How to swap backbuffer in front and how many frames per screen refresh
presentParams.SwapEffect = SwapEffect.Discard;
presentParams.PresentationInterval = PresentInterval.One;
// Disable Managed Direct3D events
Device.IsUsingEventHandlers = false;
// Create the device
device = new Device(
Manager.Adapters.Default.Adapter,
DeviceType.Hardware,
this,
CreateFlags.SoftwareVertexProcessing | CreateFlags.MultiThreaded,
presentParams
);
AllocateResources();
InitializeDevice();
}
开发者ID:coolsula,项目名称:vidplaycorder,代码行数:35,代码来源:MainForm.cs
示例18: Controller
public Controller(Control target, Renderer renderer,
Size size, EventHandler progressReport)
{
_target = target;
_renderer = renderer;
_size = size;
_deviceLost = false;
_presentParameters = new PresentParameters();
_timer = new PerformanceTimer();
InitializeGraphics(progressReport);
OnDeviceReset(_device, null);
if (progressReport != null)
{
progressReport(this, EventArgs.Empty);
}
CreateGraphicObjects(progressReport);
_timer.Start();
_elapsedTime = _timer.GetTime();
_previousElapsedTime = _elapsedTime;
if (progressReport != null)
{
progressReport(this, EventArgs.Empty);
}
}
开发者ID:sakseichek,项目名称:homm,代码行数:29,代码来源:Controller.cs
示例19: Initialize
public static void Initialize(System.Windows.Forms.Form OurForm)
{
PresentParameters presentParams = new PresentParameters();
presentParams.SwapEffect = SwapEffect.Discard;
Format current = Manager.Adapters[0].CurrentDisplayMode.Format;
if (Screen.ScreenType == ScreenMode.fullscreen)
{
presentParams.Windowed = false;
presentParams.BackBufferFormat = current;
presentParams.BackBufferCount = 1;
presentParams.BackBufferWidth = Screen.ResolutionW;
presentParams.BackBufferHeight = Screen.ResolutionH;
}
else
{
presentParams.Windowed = true;
OurForm.Size = new Size(Screen.ResolutionW, Screen.ResolutionH);
}
//presentParams.EnableAutoDepthStencil = true;
//presentParams.AutoDepthStencilFormat = DepthFormat.D16;
OurDevice = new Microsoft.DirectX.Direct3D.Device(0, DeviceType.Hardware, OurForm, CreateFlags.SoftwareVertexProcessing, presentParams);
OurDevice.RenderState.AlphaBlendEnable = true;
OurDevice.RenderState.SourceBlend = Blend.SourceAlpha;
OurDevice.RenderState.DestinationBlend = Blend.InvSourceAlpha;
OurSprite = new Sprite(OurDevice);
MeshRenderer.Initialize(OurDevice);
TextRenderer.Initialize(OurDevice);
}
开发者ID:GazarovVlad,项目名称:TheGame,代码行数:29,代码来源:Drawing.cs
示例20: Main
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
FileSystem.Instance.AddWorkingDir(@".\");
FileSystem.Instance.AddWorkingDir(@"E:\Documents\ic10gd\Source\Code2015\bin\x86\Debug");
// zou jia's res dir
FileSystem.Instance.AddWorkingDir(@"C:\Users\penser\Documents\Visual Studio 2008\Projects\lrvbsvnicg\Source\Code2015\bin\x86\Debug");
GraphicsAPIManager.Instance.RegisterGraphicsAPI(new Apoc3D.RenderSystem.Xna.XnaGraphicsAPIFactory());
DeviceContent dc = GraphicsAPIManager.Instance.CreateDeviceContent();
PresentParameters pm2 = new PresentParameters();
pm2.IsWindowed = true;
pm2.BackBufferFormat = ImagePixelFormat.A8R8G8B8;
pm2.BackBufferHeight = 600;
pm2.BackBufferWidth = 800;
RenderWindow wnd = (RenderWindow)dc.Create(pm2);
Viewer = new RenderViewer(dc.RenderSystem);
wnd.EventHandler = Viewer;
Window = wnd;
wnd.Run();
}
开发者ID:yuri410,项目名称:lrvbsvnicg,代码行数:26,代码来源:Program.cs
注:本文中的PresentParameters类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论