Blending textures with a shader

Well basically I want to write a mesh combiner, that generates a map determining from what orginal mesh a vertex came, now the fragment shader gets the texture for each mesh + the map mentiond, and blends the right texture on the mesh depending on what is stored in the map.

The question here is, is there some kinda of hard limit or a minimum opengl2 gurantee of how many textures I can use and blend in one shader?

There is no practical limit in OpenGL anymore afaik, but the hardware might only support so many textures thus slowing down when you hit that barrier due to software combining. I think eight texture units are normal nowadays.

You might be able to combine this technique with texture atlas.

Since you only need 1 texture per pixel, you can use a texture array instead, that way you can have an infinite amount of textures.

This isn’t as efficient as it sounds though, since you’re asking the GPU to process the entire map every frame, most of it probably won’t even be visible.