Ok, wanted to look at drawing primitives so copied the LineBatch class from Farseer and get the exception;
SharpDX.SharpDXException was unhandled
HResult=-2147024809
Message=HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.
Source=SharpDX
StackTrace:
at SharpDX.Result.CheckError()
at SharpDX.Direct3D11.Device.CreateSamplerState(SamplerStateDescription& samplerDescRef, SamplerState samplerStateOut)
at SharpDX.Direct3D11.SamplerState…ctor(Device device, SamplerStateDescription description)
at Microsoft.Xna.Framework.Graphics.SamplerState.GetState(GraphicsDevice device)
at Microsoft.Xna.Framework.Graphics.SamplerStateCollection.PlatformSetSamplers(GraphicsDevice device)
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.PlatformApplyState(Boolean applyShaders)
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.ApplyState(Boolean applyShaders)
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.PlatformDrawUserPrimitives[T](PrimitiveType primitiveType, T[] vertexData, Int32 vertexOffset, VertexDeclaration vertexDeclaration, Int32 vertexCount)
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.DrawUserPrimitives[T](PrimitiveType primitiveType, T[] vertexData, Int32 vertexOffset, Int32 primitiveCount, VertexDeclaration vertexDeclaration)
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.DrawUserPrimitives[T](PrimitiveType primitiveType, T[] vertexData, Int32 vertexOffset, Int32 primitiveCount)
at LineBatch.LineBatch.Flush() in c:\users\admin\documents\visual studio 2010\Projects\LineBatch\LineBatch\LineBatch.cs:line 118
at LineBatch.LineBatch.End() in c:\users\admin\documents\visual studio 2010\Projects\LineBatch\LineBatch\LineBatch.cs:line 104
at LineBatch.Game1.Draw(GameTime gameTime) in c:\users\admin\documents\visual studio 2010\Projects\LineBatch\LineBatch\Game1.cs:line 95
at Microsoft.Xna.Framework.Game.DoDraw(GameTime gameTime)
at Microsoft.Xna.Framework.Game.Tick()
at MonoGame.Framework.WinFormsGameWindow.RunLoop()
at MonoGame.Framework.WinFormsGamePlatform.RunLoop()
at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior)
at Microsoft.Xna.Framework.Game.Run()
at LineBatch.Program.Main() in c:\users\admin\documents\visual studio 2010\Projects\LineBatch\LineBatch\Program.cs:line 22
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
It gets hit in the DrawUserPrimitives call here;
` private void Flush()
{
if (!_hasBegun)
throw new InvalidOperationException(“Begin must be called before Flush can be called.”);
if (_lineVertsCount >= 2)
{
int primitiveCount = _lineVertsCount / 2;
// submit the draw call to the graphics card
_device.DrawUserPrimitives(PrimitiveType.LineList, _lineVertices, 0, primitiveCount);
_lineVertsCount -= primitiveCount * 2;
}
}
The Draw that ultimately casues the flush is simply
` protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your drawing code here
lineBatch.Begin(projection, view);
lineBatch.DrawLine(new Vector2(10, 10), new Vector2(100, 100));
lineBatch.End();
base.Draw(gameTime);
}`