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

Modify texture color when creating polygons

Jan 14, 2010 at 2:40 PM

Let's say i have a texture with some shapes that i create polygons from...

geomsList = new List<Geom>();
texture = Content.Load<Texture2D>("texture");
uint[] data = new uint[texture.Width * texture.Height];
vertsList = new List<Vertices>();
vertsList = (Vertices.CreatePolygon(data, texture.Width, texture.Height, 4f, 1, true, true));
foreach (Vertices verts in vertsList)
    textureOrigin = verts.GetCentroid();
    textureBody = BodyFactory.Instance.CreatePolygonBody(simulator, verts, 1);
    textureBody.Position = textureOrigin;
    textureBody.IsStatic = true;
    Geom geom = GeomFactory.Instance.CreatePolygonGeom(simulator, textureBody, verts, 20);

I want to change the pixel color in the texture data for each polygon that's created. Is that possible?