Texture won't show up

Hi i used to apply textures to Spheres, cubes, cones, cylinders, etc. and it worked but applying the same code to a Shape3D i create customly won't work- why? thanks

and by the way, how do i use double-buffering in a Canvas 3D? (i've already asked the question but this time there are Duke Dollars ;) )

GeometryInfo gi =new GeometryInfo(GeometryInfo.TRIANGLE_ARRAY);

GeometryInfo gi2=new GeometryInfo(GeometryInfo.TRIANGLE_ARRAY);

// ... here i set the coords in a Point3f array ...

gi.setCoordinates(coords);

gi.recomputeIndices();

gi2.setCoordinates(coords2);

gi2.recomputeIndices();

NormalGenerator ng =new NormalGenerator();

Stripifier st =new Stripifier();

ng.generateNormals(gi);

st.stripify(gi);

ng.generateNormals(gi2);

st.stripify(gi2);

Shape3D[] shapes;

shape[0] =new Shape3D();

shape2[1]=new Shape3D();

shape.setGeometry(gi.getGeometryArray());

shape2.setGeometry(gi2.getGeometryArray());

TextureLoader loader =new TextureLoader(file.getPath(),"RBG",new Container());

texture = loader.getTexture();

texture.setBoundaryModeS(Texture.WRAP);

texture.setBoundaryModeT(Texture.WRAP);

texture.setBoundaryColor(new Color4f( 0.0f, 1.0f, 0.0f, 0.0f ) );

TextureAttributes texAttr =new TextureAttributes();

texAttr.setTextureMode(TextureAttributes.MODULATE);

Appearance appearance =new Appearance();

ap.setTexture(appearance);

ap.setTextureAttributes(texAttr);

ap.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_FILL, PolygonAttributes.CULL_NONE, 0));

float shininess=1;

Color3f color=new Color3f(Color.white);

Color3f shineColor=new Color3f(Color.white);

Material material=new Material();

material.setDiffuseColor(color);

material.setAmbientColor(color);

material.setSpecularColor(shineColor);

material.setShininess(shininess);

material.setLightingEnable(true);

ap.setMaterial(material);

shapes[0].setAppearance(appearance.getAppearance() );

shapes[1].setAppearance(appearance.getAppearance() );

// the shape is OK and the appearance color is respected, but no texture shows up- why? this script works with

// shperes, cubes, etc. but not with shape3D

[3037 byte] By [must41a] at [2007-9-23]
# 1
dammit i've got no more duke dollars- if you answer i'll come back add some and distribute them though
must41a at 2007-7-10 > top of java,Security,Cryptography...
# 2
Have a look at texture coordinate generation. The primitive shapes (cone, sphere, cylinder) will automatically create the texture coordinates, while shapes do not. Texture coordinates map specific areas of the texture to the vertices of the geometry.Mike
Michael.N.Jacobsa at 2007-7-10 > top of java,Security,Cryptography...
# 3
thanks, but could you just give me a hint where to find that? thxs
must41a at 2007-7-10 > top of java,Security,Cryptography...