This project has moved and is read-only. For the latest updates, please go here.

Rotating PrimitiveBatch

Dec 3, 2013 at 4:09 PM

this might be a pretty stupid question, but is there a way to rotate an object (with a rotation matrix) created via the Primitive Batch? I am kinda new to this stuff, so any help would be appreciated.

Thanks in advance
Dec 3, 2013 at 6:38 PM
Edited Dec 4, 2013 at 1:54 AM
PrimitiveBatch is just a mechanism for dynamic submission of geometry (basically it handles managing and updating a Vertex Buffer and optionally an Index Buffer, setting the Primitive Topology, and then calling Draw/DrawIndexed). The actual way it is drawn is based on the Shaders, various State Objects, and Constant Buffers that are active, which is where you'd apply a transformation like a rotation.

See the documentation link above for a simple example that uses BasicEffect to set up shaders to use with PrimitiveBatch.

That said, remember that you should really not be using PrimitiveBatch for an object that is 'static', i.e. that doesn't change it's topology. For that, you should look at Model or in simple cases GeometricPrimitive.
Marked as answer by walbourn on 12/23/2013 at 11:08 PM