[vtkusers] Mapping vtkDoubleArray

Hans van Piggelen hansvp at hotmail.com
Fri May 2 18:51:20 EDT 2008


Hi there,

I'm having some trouble with mapping a vtkDoubleArray onto an existing geometry. The original data set consists of an Ensight model with various data sets. This is my code:

// get original array count
int arrayCount = vEnsightReader->GetOutput()->GetPointData()->GetNumberOfArrays();// add generated array to stackvGeneratedArray->SetName("Temporal gradient");vEnsightReader->GetOutput()->GetPointData()->AddArray(vGeneratedArray);if(vEnsightReader->GetOutput()->GetPointData()->SetActiveAttribute(arrayCount, 0) != arrayCount)    AfxMessageBox("Array not set!");// remove current actor from scene, so it can be updated
render->RemoveActor( vContourActor );vContourActor->Delete();vContourMapper->Delete();vContourMapper = vtkPolyDataMapper::New();vContourMapper->SetInput(vGeomFilter->GetOutput());vGeneratedArray->GetRange(range);lut->SetHueRange(0.6667,0.0);lut->SetTableRange(range);lut->Build();vContourMapper->SetColorModeToMapScalars();vContourMapper->SetScalarModeToUsePointFieldData();vContourMapper->ColorByArrayComponent(vEnsightReader->GetPointArrayName(arrayCount),0);vContourMapper->SetLookupTable(lut);vContourMapper->SetScalarRange(range);vContourMapper->InterpolateScalarsBeforeMappingOff();vContourMapper->ImmediateModeRenderingOn();vContourMapper->Update();vContourActor = vtkActor::New();vContourActor->SetMapper( vContourMapper );render->AddActor( vContourActor );vScalarBar = vtkScalarBarActor::New();vScalarBar->SetLookupTable(lut);vScalarBar->SetTitle("Temporal gradient");vScalarBar->GetLabelTextProperty()->SetFontFamilyToArial();vScalarBar->GetLabelTextProperty()->SetFontSize(6);render->AddActor(vScalarBar);    render->ResetCameraClippingRange();renWin->Render();
All objects exist and are tested. The generated array has a valid range and array values as well.

The problem is that the output does not give any color in the output, though with previously existing data sets this is not a problem. If I comment SetScalarModeToUsePointFieldData() then it seems to work, but with the wrong data set.

Obviously I'm doing something wrong, so what do I need to change to solve this? Thanks in advance!

_________________________________________________________________
With Windows Live for mobile, your contacts travel with you.
http://www.windowslive.com/mobile/overview.html?ocid=TXT_TAGLM_WL_Refresh_mobile_052008
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080502/058e5cd5/attachment.htm>


More information about the vtkusers mailing list