In these days we have been adding 2D texture arrays to the Texture Class and we have committed this new feature today into the CVS.
I found the Overview Paragraph of the OpenGL specification for EXT_texture_arrays pretty clear, so it follows an edited “copy and paste” of it:
more details at: developer.download.nvidia.com/op … _array.txt
As stated in the specification texture arrays must be used in conjunction with a fragment shader. The gp4 Fragment Program (gp4fp) profile must be used to compile the fragment shader source code.
To create a 2D texture array:
mtex_0 = TexturePool.load_2d_texture_array("textures/south00#.jpg"); model.setShaderInput('mtex_0', mtex_0)
To access the texture array within the fragment program:
//Cg //Cg profile gp4fp void fshader(float3 l_texcoord:TEXCOORD0 uniform sampler2DArray mtex_0:TEXUNIT0) o_color = tex2DARRAY(mtex_0,l_texcoord); }
[size=150]3. Why texture arrays?[/size]
The motivation for the texture arrays technique is performance. 2D texture arrays can be used to draw a multi-textured model in one pass (reducing state changes), or can be used in conjunction with hardware instancing to render different instances of a model with a different texture.