How do I cover a region with a repeating texture using AgateLIB?
Suppose I have a polygonal region, defined by a series of points making up it's border, and a square texture smaller then the region.
What's the easiest method of filling the region with the texture, so that it repeats with no border but does not expand outside of the region?
To tile a texture you just have to draw it multiple times.
There's currently no easy way to do cutouts like this. The best way to do this would be to prerender the tiled image and fix up the cutout manually. But this won't work if you need the cutout to be adjusted dynamically in the code. You could render the tiled texture to a surface larger than your cutout, and use ReadPixels to get the pixel data into a pixelbuffer and apply the cutout manually. This will be slow however. The other way would be to draw the tiled texture first, and then draw stuff on top of it to give it the appearance of the cutout you want.
In the future AgateLib will support a stencil buffer for things like this but it's not ready yet.
Thank you for your suggestions kanato (and for your work on the project).
Slow doesn't matter, if could render it off screen while loading. I was thinking that as a last resort, if there wasn't a way to do it in the library. Drawing over it would clog the render pipeline while doing the cutouts once up front per level won't hurt the fps in game.