Your driver should support up to 32 textures when using a fragment shader. Try running the following script:
Code:
import viz
viz.go()
IMAGES = [ 'images/tile_grass.jpg'
,'images/tile_gray.jpg'
,'images/tile_slate.jpg'
,'images/tile_stone.jpg'
,'images/tile_wood.jpg'
]
quad = viz.addTexQuad(pos=(0,1.8,2))
for x,name in enumerate(IMAGES):
tex = viz.addTexture(name)
quad.texture(tex,unit=x)
quad.apply(viz.addUniformInt('tex{}'.format(x),x))
frag = """
uniform sampler2D tex0;
uniform sampler2D tex1;
uniform sampler2D tex2;
uniform sampler2D tex3;
uniform sampler2D tex4;
void main()
{
vec2 uv = gl_TexCoord[0].st;
if(uv.x > 0.8) {
gl_FragColor = texture2D(tex4,uv);
} else if(uv.x > 0.6) {
gl_FragColor = texture2D(tex3,uv);
} else if(uv.x > 0.4) {
gl_FragColor = texture2D(tex2,uv);
} else if(uv.x > 0.2) {
gl_FragColor = texture2D(tex1,uv);
} else {
gl_FragColor = texture2D(tex0,uv);
}
}
"""
quad.apply(viz.addShader(frag=frag))
It should render the attached image below. If it does not, then please post the graphics card and driver version you are using.