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.
[size=150]1. Overview[/size]
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:
[size=150]2. Usage[/size]
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:
[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.
No I didn’t measure the performances boost. But I believe it should have a strong impact especially when drawing multi textured models or if used in conjunction with Hardware Based Instancing.
ps: it's called array textures (call me smart-ass =D)
It comes in a .rar file and it showcases texture arrays(16 different textures) applied to the models that you see on screen. The demo is also amply commented and should be self sufficient.
DirectStart: Starting the game.
Known pipe types:
osxGraphicsPipe
(all display modules loaded.)
False
Traceback (most recent call last):
File "Tut-AdvacedShaderInputs.py", line 170, in <module>
w = World()
File "Tut-AdvacedShaderInputs.py", line 38, in __init__
assert base.win.getGsg().getSupportsCgProfile("gp4vp"),\
AttributeError: 'libpanda.GraphicsStateGuardian' object has no attribute 'getSupportsCgProfile'
And if I comment the lines which check my hardware, I got this:
DirectStart: Starting the game.
Known pipe types:
osxGraphicsPipe
(all display modules loaded.)
False
:gobj(error): /Users/tallmystcarpet/Desktop/PandaSE Flocking-Instancing Demo/shaders/groundShader.cg: unrecognized parameter name (varying in float4 vIN.o_position)
:gobj(error): /Users/tallmystcarpet/Desktop/PandaSE Flocking-Instancing Demo/shaders/groundShader.cg: unrecognized parameter name (varying in float2 vIN.o_texcoord0)
:gobj(error): /Users/tallmystcarpet/Desktop/PandaSE Flocking-Instancing Demo/shaders/advancedInputs.cg: (37) : error C5108: unknown semantics "INSTANCEID" specified for "l_id"
:gobj(error): /Users/tallmystcarpet/Desktop/PandaSE Flocking-Instancing Demo/shaders/advancedInputs.cg: (70) : error C1115: unable to find compatible overloaded function "tex2DARRAY(sampler2DARRAY, float3)"
Traceback (most recent call last):
File "Tut-AdvacedShaderInputs.py", line 170, in <module>
w = World()
File "Tut-AdvacedShaderInputs.py", line 94, in __init__
self.ralph.setInstanceCount(NUMBER_OF_RALPHS)
AttributeError: 'Actor' object has no attribute 'setInstanceCount'
And this is the setInstanceCount rdb was talking about in the blog…
Is it an extra attrib that appear with Panda1.7 ? (I still using 1.6.2)
You need the latest CVS version of Panda3D to run it, apparently. getSupportsCgProfile is only available on the CVS head, setInstanceCount only in 1.7.0 and up.