Sets texture state for many texture units, based on this node. On every texture unit where something is enabled, proper texture identifier must be bound. Also, has to set complete glTexEnv on every enabled texture unit.
TextureUnitsCount says how many texture units can be enabled/disabled.
TextureUnitsCount does *not* take into account whether multitexturing OpenGL extensions are available at all. Look at GLUseMultiTexturing for this. Think of GLUseMultiTexturing as capping TextureUnitsCount to 1 (still, remember to honour TextureUnitsCount = 0 case in your implementation, even when GLUseMultiTexturing = True ).
You have to set TexCoordsNeeded, this is the count of texture units where some texture coordinates should be generated. This means that all texture units above TexCoordsNeeded (to TextureUnitsCount - 1) should be disabled by the caller (no need to do this in EnableAll ), and there's no need to generated texture coords for them.
( Yes, there is some small optimization missed in the definition of TexCoordsNeeded: if some textures in the middle of multitexture children list failed to load, but some following children succeded, we'll generate tex coords even for the useless texture units in the middle. We could avoid generating texture coords for them, by changing TexCoordsNeeded into bool array. This optimization is not considered worthy implementing for now. )
You have to set texture state of all texture units < TexCoordsNeeded, and only on them.
|