Re: Java3D shapes to visad shapes? - solved

> did you also copy the colors (if they are non-null)
> and especially the stripVertexCounts?

That did it Bill, I hadn't been setting the individual strip vertex counts.

So for reference, here's how to create Spheres as VisAD shapes from Sun's built 
in ones (other shapes should be similar):

             import com.sun.j3d.utils.geometry.Sphere;
            VisADTriangleStripArray sphere_visad = new 
            Sphere sphere_j3d = new Sphere(0.1f, new Appearance());
            TriangleStripArray geom_j3d = 

            sphere_visad.vertexCount = geom_j3d.getVertexCount();

            sphere_visad.coordinates = new float[3 * geom_j3d.getVertexCount()];
            geom_j3d.getCoordinates(0, sphere_visad.coordinates);

            sphere_visad.normals = new float[3 * geom_j3d.getVertexCount()];
            geom_j3d.getNormals(0, sphere_visad.normals);

            sphere_visad.vertexFormat = geom_j3d.getVertexFormat();

            sphere_visad.stripVertexCounts = new int[geom_j3d.getNumStrips()];

    // Now use sphere_visad like any other VisAD shape, e.g. in 

Thanks for the help
Steve Harris
National Center for Toxicological Research, FDA

  • 2005 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: