i have this code
float scalingFactor = 1.0f / 2.111f;
glEnable(GL_COLOR_MATERIAL);
glShadeModel(GL_SMOOTH);
double minValue = std::numeric_limits<double>::max();
double maxValue = std::numeric_limits<double>::lowest();
vtkSmartPointer<vtkColorTransferFunction> colorTransferFunction = vtkSmartPointer<vtkColorTransferFunction>::New();
colorTransferFunction->AddRGBPoint(0.0, 0.0, 0.0, 1.0); // Blue for low values
colorTransferFunction->AddRGBPoint(0.5, 1.0, 1.0, 0.0); // Yellow for medium values
colorTransferFunction->AddRGBPoint(1.0, 1.0, 0.0, 0.0); // Red for high values
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetLookupTable(colorTransferFunction);
vtkSmartPointer<vtkDataSet> data = vtkDataSet::SafeDownCast(reader->GetOutput());
for (vtkIdType i = 0; i < data->GetNumberOfCells(); i++) {
vtkCell* cell = data->GetCell(i);
vtkPoints* points = cell->GetPoints();
double scalar[3];
points->GetPoint(0, scalar);
double color1[3];
colorTransferFunction->GetColor(scalar[0], color1);
points->GetPoint(1, scalar);
double color2[3];
colorTransferFunction->GetColor(scalar[0], color2);
points->GetPoint(2, scalar);
double color3[3];
colorTransferFunction->GetColor(scalar[0], color3);
glBegin(GL_POLYGON);
glColor3dv(color1);
glVertex3f(points->GetPoint(0)[0] * scalingFactor, points->GetPoint(0)[1] * scalingFactor, points->GetPoint(0)[2] * scalingFactor);
glColor3dv(color2);
glVertex3f(points->GetPoint(1)[0] * scalingFactor, points->GetPoint(1)[1] * scalingFactor, points->GetPoint(1)[2] * scalingFactor);
glColor3dv(color3);
glVertex3f(points->GetPoint(2)[0] * scalingFactor, points->GetPoint(2)[1] * scalingFactor, points->GetPoint(2)[2] * scalingFactor);
if (cell->GetNumberOfPoints() == 4) {
points->GetPoint(3, scalar);
double color4[3];
colorTransferFunction->GetColor(scalar[0], color4);
glColor3dv(color4);
glVertex3f(points->GetPoint(3)[0] * scalingFactor, points->GetPoint(3)[1] * scalingFactor, points->GetPoint(3)[2] * scalingFactor);
}
glEnd();
}
the code currently displays colors like this
but i want the colors be more transparent so i can see the earth image