I believe you need to use a ColoringAttributes object.  My code (which works
fine) is below.

        LineStripArray lineArray = new LineStripArray(n,
LineArray.COORDINATES, stripCount);
        lineArray.setCoordinates(0, coordinateData);

        // create a new appearance object for the grid
        Appearance ColorAppearance = new Appearance();
        ColoringAttributes Coloring = new ColoringAttributes();

        Coloring.setColor(new Color3f(colorIndex));

        ColorAppearance.setColoringAttributes(Coloring);

        // make a lineattributes object to control how the grid will look.
        LineAttributes lineAttrib = new LineAttributes();
        lineAttrib.setLineWidth((float)width);

        ColorAppearance.setLineAttributes(lineAttrib);

        Shape3D lines = new Shape3D(lineArray, ColorAppearance);

Daniel


> -----Original Message-----
> From: S�nchez Sanz, Javier [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, May 08, 2000 5:25 AM
> To:   [EMAIL PROTECTED]
> Subject:      [JAVA3D] Color with LineStripArray
>
> Hi, I'm trying (for a long time) to make a LineStripArray with color, but
> it
> appear black. I'm using a lit scene, so coloring attributes are ignored.
> I make a geometry colors and material color, but none of them seems to
> work.
> I have an ambient and a directional light. I put spheres and they are
> correctly rendered (with colors).
>
> thanks,
>
> //the code is...
>
>    Point3d puntosRef[] =  {
>             new Point3d(2.0d,-1.0d,0.0d),
>             new Point3d(0.0d,0.0d,0.0d),
>             new Point3d(-1.0d,0.0d,0.0d),
>             };
>
>     Point3d coords[]=new Point3d[puntosRef.length];
>
>     int i;
>     for (i=0;i<puntosRef.length;i++){
>       coords[i]=puntosRef[i];
>     }
>
>     Appearance polyAppear = new Appearance();
>     Color3f color = new Color3f(0.0f,0.0f,1.0f);
>     Material mat = new Material(new
> Color3f(0.2f,0.2f,0.2f),_cblack,color,_cwhite,0.5f);
>     polyAppear.setMaterial(mat);
>
>     Color3f colores[] = {color,color,color};
>
>
>     int stripCounts[]={3};
>     LineStripArray polylineBase = new LineStripArray (puntosRef.length,
>
> LineStripArray.COORDINATES|LineStripArray.NORMALS|LineStripArray.COLOR_3
>               ,stripCounts);
>     polylineBase.setCoordinates(0,coords);
>     polylineBase.setColors(0,colores);
>
> ==========================================================================
> =
> 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".

===========================================================================
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