How do I plot individual pixels using the XNA APIs?
Posted
by
izb
on Game Development
See other posts from Game Development
or by izb
Published on 2010-12-23T10:38:33Z
Indexed on
2011/01/05
14:59 UTC
Read the original article
Hit count: 261
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?
© Game Development or respective owner