[vtkusers] vtkVRMLImporter problem

Simon Ouellette simon at asymptotesoft.com
Wed Dec 2 20:13:22 EST 2009


Hi,

     I have a problem with importing a .VRML file into my MFC-based 
program. Everything seems to work, except that there is something wrong 
with the color mapping (in the original image, the color ranges from 
yellow to red, but in the loaded VRML, I see only yellow -- which 
corresponds to the scalar value 0.0). The shape is fine, the model is 
otherwise loaded successfully. Also, note that this VRML file was 
created by exporting an image that was initially created by my program, 
using vtkVRMLexporter, and this functionality works well because I can 
load the .VRML successfully in a third party VRML viewer, and the colors 
are fine. So the problem is related to my importing.

My code goes like this:

To load the file:

        // VRML Import
        vtkVRMLImporter *importer=vtkVRMLImporter::New();
        importer->SetFileName(ar.GetFile()->GetFileName().GetBuffer(0));
        importer->Read();

        m_renderer = importer->GetRenderer();

To render the content:

void CVRMLDoc::SetupVizPipeline()
{
    vtkPropCollection *props = m_renderer->GetViewProps();
    props->InitTraversal();

    for (int i = 0; i < props->GetNumberOfItems(); i++)
    {
        vtkProp *prop = props->GetNextProp();

        if (prop == NULL)
        {
            continue;
        }

        this->Props->AddItem(prop);
    }
}

Where this->Props is my renderer.

Anyone have an idea what the problem might be?

Thanks,
Simon



More information about the vtkusers mailing list