本文整理汇总了C#中RenderContext.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# RenderContext.Dispose方法的具体用法?C# RenderContext.Dispose怎么用?C# RenderContext.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderContext
的用法示例。
在下文中一共展示了RenderContext.Dispose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
RenderForm form = new RenderForm("Kinect color sample");
RenderDevice device = new RenderDevice(SharpDX.Direct3D11.DeviceCreationFlags.BgraSupport);
RenderContext context = new RenderContext(device);
DX11SwapChain swapChain = DX11SwapChain.FromHandle(device, form.Handle);
KinectSensor sensor = KinectSensor.GetDefault();
sensor.Open();
bool doQuit = false;
bool doUpload = false;
ColorRGBAFrameData currentData = null;
DynamicColorRGBATexture colorTexture = new DynamicColorRGBATexture(device);
KinectSensorColorRGBAFrameProvider provider = new KinectSensorColorRGBAFrameProvider(sensor);
provider.FrameReceived += (sender, args) => { currentData = args.FrameData; doUpload = true; };
form.KeyDown += (sender, args) => { if (args.KeyCode == Keys.Escape) { doQuit = true; } };
RenderLoop.Run(form, () =>
{
if (doQuit)
{
form.Dispose();
return;
}
if (doUpload)
{
colorTexture.Copy(context, currentData);
doUpload = false;
}
context.RenderTargetStack.Push(swapChain);
device.Primitives.ApplyFullTri(context, colorTexture.ShaderView);
device.Primitives.FullScreenTriangle.Draw(context);
context.RenderTargetStack.Pop();
swapChain.Present(0, SharpDX.DXGI.PresentFlags.None);
});
swapChain.Dispose();
context.Dispose();
device.Dispose();
colorTexture.Dispose();
provider.Dispose();
sensor.Close();
}