How do I plot individual pixels using the XNA APIs?
- by izb
If I wanted to fill my game screen with individually coloured pixels, how would I do this?
For example, if I wanted to write a 'game of life'-type game where each pixel was a cell, how would I achieve this using XNA?
I've tried just calling SetData() on a Texture2D object using a screen-sized array of Color values, but it complains with:
You may not call SetData on a resource while
it is actively set on the GraphicsDevice.
Unset it from the device before calling SetData.
How do I do as it asks? Or better still... is there an alternative, better, efficient way to fill a screen with arbitrary pixels?