One solution would be to use repeating texture wrapping, and then use a texture transformation matrix. So let's say you normally set the texture coordinates of your GL_TEXTURE_2D
to be 0-1 in u
and v
. Instead, ensure that your GL_TEXTURE_WRAP_S
and GL_TEXTURE_WRAP_T
are set to GL_REPEAT
or GL_MIRRORED_REPEAT
and set the texture coordinates to be the tile number to tile number + 1. So the first one would still be 0 to 1. The second one would be 1 to 2, the third would be 2 to 3, etc.
Next, your vertex shader would have a mat4
uniform called textureMatrix
or something like that. The texture matrix you pass in could have scaling in it (and probably other transformations, too). You just multiply the texture coordinates for the polygons by the texture matrix in the vertex shader, and it should apply appropriately.