[vtkusers] VRMLImporter not giving correct colors

Karl Baum Karl.Baum at rit.edu
Thu Jul 30 12:27:51 EDT 2009


Hi,

I am using vtkVRMLImporter to load a .wrl file.  The resulting rendering
does not have the correct colors.  Here is a clip from my code.

    vtkVRMLImporter* vrmlImporter = vtkVRMLImporter::New();

    vrmlImporter->SetFileName("colorPerVertex.wrl");

    vrmlImporter->Read();

    vrmlImporter->Update();

    vtkRenderer *renderer= vrmlImporter->GetRenderer();

    window->AddRenderer(renderer);

 

My VRML file is just two triangles with different color vertices.

#VRML V2.0 utf8

Shape {

                geometry IndexedFaceSet {

                                coordIndex [0 1 2 -1 1 0 3 -1]

                                coord Coordinate {

                                                point [-1 0 0 1 0 0 0 1 -1 0
-1 -1]

                                }

                                color Color         {

                                                color [1 1 1, 1 0 0, 1 0 0,
0 0 1,]

                                }

                                normal Normal {

                                                vector [0.0  0.0  1.0 0.0
0.0  1.0 0.0  1.0  0.0 0.0 -1.0  0.0]

                                }

                }

                appearance Appearance {

                                material Material { transparency 0.0

                                }

                }

}

 

There are four colors used, changing the middle two have no effect on the
rendering even though they are assigned to two of the vertices.  This
problem only occurs in vtk and not with other VRML renderers.  Does anyone
know what the problem is?  Is there any way to fix this so that the vertices
are rendered with their correct colors.

 

Thanks,

Karl

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090730/4ae47a99/attachment.htm>


More information about the vtkusers mailing list