How to add color to vtkUnstructuredGrid vtkTetra data not add color to its point

I want to add colour to the vtkTetra itself, not its points. Could anyone give me a example?
This example is add color to the points vtk-examples/ at aa1716a165150f338f6182ce1ac174334f3b9003 · Kitware/vtk-examples · GitHub.

Just add the scalars to the cells instead of the points, see line 84:


should become


where scalars2 has the appropriate size (the number of cells in cube) which is 6 for this example.

Thanks for your reply. I have another question is how to change the colour in real-time? I want to change the scalar and then make the cube color change in real-time? Are there any similar cases? Thanks !