flatten on Geom loses color

I’m building up a cube using

vdata = new GeomVertexData("boxVertData", GeomVertexFormat::get_v3c4(), Geom::UH_static);
GeomVertexWriter posWriter, colorWriter;
posWriter = GeomVertexWriter(vdata, "vertex");
colorWriter = GeomVertexWriter(vdata, "color");
.... write out each vertex of cube

This works fine normally, but after I flatten it (light, medium or strong) it looks like its color is 1,1,1,1 (white no alpha).

Known issue/Expected behavior?

Yes, in order to tell Panda that you intend for it to respect the vertex color, you have to also apply the vertex color state:


Technically, until you do this, it is undefined whether the rendering engine respects the vertex color or not. As it happens, an unflattened color will be respected, and a flattened color will not, but that’s just a detail.


Makes sense, thanks!