- Home /
This question was
closed Aug 16, 2019 at 08:27 PM by
twoski for the following reason:
The question is answered, right answer was accepted
Fastest way to update Texture2D
So let's say i am reading a texture 2d into my own 2d array of pixels then making changes to those pixels.
I want to reassign those colors to the texture2d so i do something like:
foreach (Pixel p in MyPixelCollection)
{
m_texture2d.SetPixel(p.X, p.Y, p.Color);
}
m_texture2d.Apply(false);
The issue here is that Updating a Texture2D is apparently really expensive and slow. I want to run this code somewhat quickly, but it takes roughly one second for it to update the Texture2D.
This is too slow for me. I've done comparable work in openframeworks with c++ and it was blisteringly fast.
Am i doing something wrong? Is there a faster way to update a texture2d?
Comment
Have your tried SetPixels ins$$anonymous$$d of SetPixel? 1 call vs 1000s.