I have this code that renders netcdf data
vtkSmartPointer<vtkNetCDFCFReader> reader = vtkSmartPointer<vtkNetCDFCFReader>::New();
reader->SetFileName("C:/Users/admin/Desktop/BOLTgui/BOLT/SEAFLUX-OSB-CDR_V02R00_SST_D20210101_C20210530.nc");
reader->Update();
vtkSmartPointer<vtkLookupTable> lookupTable = vtkSmartPointer<vtkLookupTable>::New();
lookupTable->SetNumberOfTableValues(256);
lookupTable->Build();
// Get the scalar range of the data in the netcdf file
vtkDataObject* dataObject = reader->GetOutput();
vtkDataSet* dataSet = vtkDataSet::SafeDownCast(dataObject);
double* scalarRange = dataSet->GetScalarRange();
// Set the scalar range for the lookup table
lookupTable->SetTableRange(scalarRange);
vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New();
mapper->SetInputConnection(reader->GetOutputPort());
mapper->SetLookupTable(lookupTable);
mapper->UseLookupTableScalarRangeOn();
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);
vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();
renderer->AddActor(actor);
vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->AddRenderer(renderer);
vtkSmartPointer<vtkRenderWindowInteractor> interactor = vtkSmartPointer<vtkRenderWindowInteractor>::New();
interactor->SetRenderWindow(renderWindow);
// Map the VTK renderer to the SFML window
sf::WindowHandle handle = window.getSystemHandle();
renderWindow->SetWindowInfo(reinterpret_cast<char*>(handle));
interactor->Start();
but instead od displaying rgb colors like this
the code displays the data like this
what do i need to add to the code to display the rgb colors instead of the tan color
here is the code to show the points from the netcdf data
// Draw points
glBegin(GL_POINTS);
glPointSize(4.666f);
// Calculate scaling factor
float scalingFactor = 1.0f / 2.111f;
// Set point color and opacity
glColor4f(1.0f, 1.0f, 1.0f, 0.6f);
vtkSmartPointer<vtkDataSet> data = vtkDataSet::SafeDownCast(reader->GetOutput());
for (vtkIdType i = 0; i < data->GetNumberOfPoints(); i++) {
double point[3];
data->GetPoint(i, point);
// Scale the point coordinates to adjust the size
glVertex3f(point[0] * scalingFactor, point[1] * scalingFactor, point[2] * scalingFactor);
}
glEnd();