I think I found a glitch... making a triangular shape like this with 4 vertices:

Causes it to create a shape like this (it looks like it doesn't get decomposed at all):

You'll notice the green shape got decomposed properly.. so I think I implemented it properly.. nevertheless, here's my code:
Code:
void World::CreatePoly(vector<b2Vec2> poly, bool draw_static)
{
b2PolyDef pd;
if(draw_static) pd.density = 0;
else pd.density = 10;
pd.friction = .3f;
pd.restitution = .2f;
float *x, *y;
x = new float[(int)poly.size()];
y = new float[(int)poly.size()];
for(int i=0; i<(int)poly.size(); ++i)
{
x[i] = poly[i].x;
y[i] = poly[i].y;
}
b2Polygon pgon(x,y,(int)poly.size());
delete x;
delete y;
b2BodyDef bd;
DecomposeConvexAndAddTo(&pgon, &bd, &pd);
m_world->CreateBody(&bd);
}
Actually, starting from the bottom right and moving left it works fine, but going the other way around causes the glitch. Looks like the winding-order problem isn't quite fixed. When you place the vertices in the wrong order, it still detects collisions though. Normally when you screw up the order with Box2D it just doesn't collide with anything... actually, you'll notice the thick blue line along the bottom...I think your code is turning that bottom piece into a triangle. The bottom (blue) triangle seems more opaque... which means it's been shaded twice... I don't know if that's just OpenGL's doing (it doesn't like concave shapes either if they're drawn in the wrong order) or you actually have overlapping triangles there...
I hope that's thorough enough
🙂In short: breaks with any 4-vertex ccw concave polygon