How to export the color of actor to OBJ model by vtkOBJWriter correctly

I can’t export the color of an actor(without texture, only single color) to OBJ model. The mesh and geometry of OBJ model is correct. But its color is always white instead of its own color. The color is white in many other 3D software, also in my app using vtkOBJReader. I can not find .mtl file or any other material file exported. How can I solve the problem. Thanks in advance.

I use VTK 8.2.0. This is the part of my source code for exporting OBJ models:

vtkSmartPointer<vtkOBJWriter> objWriter = vtkSmartPointer<vtkOBJWriter>::New();
objWriter->SetFileName(filePath.toUtf8().toStdString().c_str());
objWriter->SetInputData(actor->GetMapper()->GetInput());
objWriter->Write();

vtkOBJWriter takes vtkPolyData as input and has no idea about any display settings that you set in actors. It does not even have access to any of the actors or actor properties.

To export OBJ file with colors, you need to use vtkOBJExporter, which takes a render window as input.