effect and model vertex declaration compatibility
- by Vodácek
I have normal model drawing code. When I try to draw model without UV coordinates I got this exception:
System.InvalidOperationException: The current vertex declaration does not include all
the elements required by the current vertex shader. TextureCoordinate0 is missing.
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.VerifyCanDraw(
Boolean bUserPrimitives, Boolean bIndexedPrimitives)
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.DrawIndexedPrimitives(
PrimitiveType primitiveType, Int32 baseVertex, Int32 minVertexIndex,
Int32 numVertices, Int32 startIndex, Int32 primitiveCount)
at Microsoft.Xna.Framework.Graphics.ModelMeshPart.Draw()
at Microsoft.Xna.Framework.Graphics.ModelMesh.Draw()
...
I know what cause the exception, but is possible to avoid it? Is possible to check model before drawing it with current shader for vertex declaration compatibility?