I need to texture mapping some text such as "C A R" to a metaball(similar to a 
sphere). First I create a text2D object then I use TextCoordGeneration. The problem is 
the text is textured to the metaball, but there is also a reflection of the  text is 
also textured. I use OBJECT_LINEAR. I can't figure it out. I attach part of my program 
below.

String result = "  C A R  ";
        Text2D text2d = new Text2D(result, new Color3f(0.9f, 1.0f, 1.0f), "Courier", 
12, Font.BOLD);
        text2d.setString(result);
        text2d.setCapability( Shape3D.ALLOW_GEOMETRY_READ);
        text2d.setCapability( Shape3D.ALLOW_GEOMETRY_WRITE);
        text2d.setRectangleScaleFactor(1.0f / 256.0f);
        text2d.setString(result);

        Appearance appearance = text2d.getAppearance();
        TexCoordGeneration tcg = new 
TexCoordGeneration(TexCoordGeneration.OBJECT_LINEAR,TexCoordGeneration.TEXTURE_COORDINATE_2);
        tcg.setEnable( true );
        appearance.setTexCoordGeneration(tcg);
        appearance.getTexture().setBoundaryModeS(Texture.CLAMP_TO_BOUNDARY);
        appearance.getTexture().setBoundaryModeT(Texture.CLAMP_TO_BOUNDARY);


        PolygonAttributes pa1 = new PolygonAttributes();
        pa1.setPolygonMode( PolygonAttributes.POLYGON_FILL);
        pa1.setCullFace(PolygonAttributes.CULL_BACK);
        //pa1.setBackFaceNormalFlip( true );
        appearance.setPolygonAttributes( pa1 );

        TextureAttributes texturemode = new TextureAttributes();
        texturemode.setTextureMode(TextureAttributes.DECAL);
        texturemode.setPerspectiveCorrectionMode(TextureAttributes.NICEST);
        appearance.setTextureAttributes(texturemode);

        // set material
        Material material = new Material(); // lighting attributes
        material.setShininess(50.0f);   // add by ldu
        material.setAmbientColor( new Color3f( 0.2f, 0.0f, 0.0f ) );
        material.setDiffuseColor( new Color3f( 0.0f, 0.0f, 0.7f ) );
        material.setLightingEnable( true );
        appearance.setMaterial( material);

       Shape3D metaball = new Shape3D();
        metaball.setGeometry(gi.getGeometryArray());
        metaball.setAppearance(appearance);

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to