Subtexture Tiling: Possible?

I made a packed texture system that packs tons of small (usually non power of two) textures into one large texture. Up till now, this has worked fine because I haven’t needed tiling textures. Now that I do though, I can’t figure out how to make it work without subdividing my polygons, which would be more trouble than it’s worth.

So basically, what I’m looking for is something that will let me GL_REPEAT texture coordinates within a subrectangle of the whole texture. I know there’s no standard mechanism for this(or if there is, then I’m blind), but is it possible at all through some kind of clever trick?

I’ve got my fingers crossed that one of you gurus out there knows a solution :slight_smile:

Cheers,
Melekor

AFAIK you can’t do this, you need a texture to be the only texture on any axis you need to tile on.

Or a pixel shader so that you can wrap coordinates yourself ?

Good luck with the filtering on that :slight_smile:

You’d need to pad with a repeat border inside your tile and MIPmaps would make it impossible as resolution got low.

Thanks for the replies guys. I don’t need MIP mapping, so ZbuffeR’s idea sounds like it could work for me. Of course, I would prefer a non pixel shaders solution, but if there isn’t one then it will have to do. I still believe that it would be a great advantage to use the packed texture system.

ZbuffeR, can you explain a bit how your idea works? (or simply point me in the right direction) I have zero experience with pixel shaders right now. I’ll finally be getting a card with pixel shaders in about 2 weeks if everything goes according to plan.