I’m programming a flood_fill() func for triangles. To do this i have to recover the pixel color at a certain position. I have a structure that has a SDL_Texture in SDL_ACESSTARGET to write on and used to the global rendering. The problem is that the texture is write-only. I found the function SDL_RenderReadPixels() but it is a slow operation and it is not suitable for this algorithm. I could maybe use a SDL_Surface instead of a SDL_Texture, but if i’m right, SDL_Surface isn’t handled by the GPU and therefore would slow down rendering.
I tried to lock() and unlock() texture but it is also a slow way to proceed.
Here’s the expected code :
Can someone tell me what would be the best way to handle this problem ?