本文整理汇总了C#中SharpDX.Windows.RenderForm.Activate方法的典型用法代码示例。如果您正苦于以下问题:C# RenderForm.Activate方法的具体用法?C# RenderForm.Activate怎么用?C# RenderForm.Activate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharpDX.Windows.RenderForm
的用法示例。
在下文中一共展示了RenderForm.Activate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
//.........这里部分代码省略.........
var ellipse = new EllipseGeometry(factory2D, new Ellipse(center, form.ClientSize.Width / 2.0f, form.ClientSize.Height / 2.0f));
// Populate a PathGeometry from Ellipse tessellation
var tesselatedGeometry = new PathGeometry(factory2D);
_geometrySink = tesselatedGeometry.Open();
// Force RoundLineJoin otherwise the tesselated looks buggy at line joins
_geometrySink.SetSegmentFlags(PathSegment.ForceRoundLineJoin);
// Tesselate the ellipse to our TessellationSink
ellipse.Tessellate(1, this);
_geometrySink.Close();
// ---------------------------------------------------------------------------------------------------
// Acquire the mutexes. These are needed to assure the device in use has exclusive access to the surface
// ---------------------------------------------------------------------------------------------------
var device10Mutex = textureD3D10.QueryInterface<KeyedMutex>();
var device11Mutex = textureD3D11.QueryInterface<KeyedMutex>();
// ---------------------------------------------------------------------------------------------------
// Main rendering loop
// ---------------------------------------------------------------------------------------------------
bool first = true;
RenderLoop
.Run(form,
() =>
{
if(first)
{
form.Activate();
first = false;
}
// clear the render target to black
context.ClearRenderTargetView(renderTargetView, Colors.DarkSlateGray);
// Draw the triangle
context.InputAssembler.InputLayout = layoutColor;
context.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;
context.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(vertexBufferColor, VertexPositionColor.SizeInBytes, 0));
context.OutputMerger.BlendState = null;
var currentTechnique = effect.GetTechniqueByName("Color");
for (var pass = 0; pass < currentTechnique.Description.PassCount; ++pass)
{
using (var effectPass = currentTechnique.GetPassByIndex(pass))
{
System.Diagnostics.Debug.Assert(effectPass.IsValid, "Invalid EffectPass");
effectPass.Apply(context);
}
context.Draw(3, 0);
};
// Draw Ellipse on the shared Texture2D
device10Mutex.Acquire(0, 100);
renderTarget2D.BeginDraw();
renderTarget2D.Clear(Colors.Black);
renderTarget2D.DrawGeometry(tesselatedGeometry, solidColorBrush);
renderTarget2D.DrawEllipse(new Ellipse(center, 200, 200), solidColorBrush, 20, null);
renderTarget2D.EndDraw();
device10Mutex.Release(0);
// Draw the shared texture2D onto the screen, blending the 2d content in