TextureUnitState // Appearance delima

We have been trying to develop a good loading system for a custom format (output by 3dsMAX) and X files. So far we have had success in both. We can load shapes and get them to render and animate.
Our current problem comes with trying to load a shape and programatically texture each face with different textures. (ie MultiTexture)
So we built a little file of a box that has one texture on several faces and another texture on the rest. We did it through the code so we could try playing around with Appearance and multiple Texture Unit States.

Our assumption was in the shape file we could have several sets of texcoords. We have 36 verts and 2 sets of texcoords (set1 : texcoord 0-29) & (set2 : texcoord 30 - 35). The shape keeps coming out with all one color or the other.
Its almost as if the texcoord arrays are being ignored or the value we pass in for the starting vert (int index) is being ignored.

getTextureCoordinates(int texCoordSet,int index,TexCoord2f[] texCoords)

Or maybe we are not understanding this fully. We have been breaking our shapes up into several shapes based on the material ID but we started to think this was wrong after reading a little.

The code in the link below shows what were doing. We have a veiwer that we plug this file into so the code is not entirly functional :-/ sorry…

http://www.matthewcjones.com/JQ/Multitex.txt

We have tried just about everything possible we can think of and to save my life I can’t find a descent tutorial on the subject that actually uses predifined texcoords with multi-texturing.

If someone wouldn’t mind just glancing at the code and pointing out the mistakes or point me to a tutorial or some code or even a book that is actually using real models (ie 3ds, X, lwo, ect) I would be very greatful.

Thanks
Matt

Break up the model instead of using multitexturing. Multitexturing is for haveing more than one texture on a single triangle.

So we are already doing it right? We have been breaking up the shape into multiple shape3d based on the material.Then attaching the group to the Tranform. Thats Correct? The normal thing to do?

Thanks for the reply

Matt

That is the correct way of doing it.

Thanks alot.

I really hate when I cause myself problems. ???

Matt