Edge rendering results in error msg on mesh created using PolygonBuilder

my task is to display some polygons with border on the screen. My approach is to use PolygonBuilder to tesselate my incoming polygons to triangles and then enable edge rendering on the resulting polygon.

However, instead of borders, I get a repeating error message in the console:

GL_INVALID_OPERATION: Must have element array buffer bound.

Playground: Babylon.js Playground

Googeling this error message indicates that there might be a problem with the index buffer, but my minimal debugging showed that PolygonBuilder creates indices, so I am currently out of ideas.

Thank you for your help.
Best regards,

cc @Evgeni_Popov

You should apply the vertex buffers to the mesh before enabling edge rendering:

1 Like

Thank you, this worked!

I did not consider that the order would make a difference due to non imperative name of enableEdgesRendering.