Hi:

        In my program, lighting works when I use the Sphere but doesn't work
when I use GeometryInfo.  Please see attached images for examples.  I am using
1.3.

        I use the same appearance and lighting setup code for both types.  Here
are some code:


    [...]
        // Setup lighting
        DirectionalLight lightD = new DirectionalLight();
        lightD.setDirection ( new Vector3f ( 0.0f,-0.7f,-0.7f ) );
        lightD.setInfluencingBounds ( boundingsphere );
        scene.addChild ( lightD );

        AmbientLight lightA = new AmbientLight();
        lightA.setInfluencingBounds ( boundingsphere );
        scene.addChild ( lightA );
    [...]


    private Appearance createAppearance ( Color3f color ) {

        Appearance appearance = new Appearance();
        ColoringAttributes coloring = new ColoringAttributes();
        Material material = new Material();
        PolygonAttributes attributes = new PolygonAttributes();

        attributes.setCullFace ( PolygonAttributes.CULL_NONE );

        coloring.setShadeModel ( ColoringAttributes.SHADE_GOURAUD );
        coloring.setCapability ( ColoringAttributes.ALLOW_COLOR_WRITE );
        if ( color != null )
            coloring.setColor ( color );

        material.setDiffuseColor ( color );
        System.out.println ( "lighting enabled? " +
                             material.getLightingEnable() );

        appearance.setMaterial ( material );
        appearance.setPolygonAttributes ( attributes );
        appearance.setColoringAttributes ( coloring );
        appearance.setCapability ( Appearance.ALLOW_COLORING_ATTRIBUTES_READ );
        appearance.setCapability ( Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE );

        return ( appearance );

    } // private Appearance createAppearance ( Color3f color )



        What am I doing wrong?

        All help is appreciated.

Sincerely,
Mona

==================================================================
Mona Wong-Barnum
National Center for Microscopy and Imaging Research
University of California, San Diego
http://ncmir.ucsd.edu/

"While you are busy dancing for others, just remember that
others are also busy dancing for you"
                                        (A Landmark Instructor)
==================================================================

<<working_Sphere.jpg>>

<<notworking_GeometryInfo.jpg>>

Reply via email to