I have a big texture. It’s basically a background image. It gets rendered. Appears on the screen.
Then, I render some other textures over it.
Some areas of the background image should NOT appear pasted over. In effect, they are foreground. They are generally not simple rectangles in shape.
I can do a simple re-render when the foreground section is a rectangle, as so:
SDL_RenderCopy(m_ren, background, // the big background image texture &srcrect, // rectangle defining which piece is the foreground &srcrect); // rectangle defining which piece is the foreground - it's just pasted over the top, in effect
but what’s the idiomatic way when the foreground section isn’t a simple rectangle?
Right now, I’m considering copying it to a whole next texture as a rectangle, editing pixels individually so that any pixel not in the foreground polygon has its alpha set to transparent, and then rendering that altered texture just as above. Is this the best I can do?