I want to produce the same effect GL_REPEAT does, but with a texture atlas. This means the texture is not one big texture in opengl, but only a part of a big texture sheet.
I want to accomplish this with GLSL, since I already use it and think it's the only way.
I've tried this
but this only scales the texture, and I'm not sure what "offset" is...
I would have following inputs in my fragment shader:
the uniform texture,
the varying texture coord as a vec2,
and an attribute vec2 "repeat", which is for example 4, if the user wants to tile the texture 4 times over the surface.
Why that way, why not
Answer: I'd need to put lots of floor textures into seperate textures, and I'd need to call glBindTexture a lot, which would kill the performance...
This kills performance too, since a repeating texture would have exactly the same effect and would need much less vertex power.
Anyways: If there is another way than GLSL and usual texture sheets, please educate me... I've thought about texture arrays, is that possible?