This is probably because an obj model typically consists of child shapes contained inside a root shape. Calling getVertexCount() on the root shape will give you 0 because it doesn't hold any vertices, you should access the child shapes by doing:
PShape obj = loadShape("model.obj");
for (int i = 0; i < obj.getChildCount(); i++) {
PShape child = obj.getChild(i);
println(child.getVertexCount());
}
PShape also has a getChildren() method that returns all the child shapes in an array. Also, a child shape could also be a group containing further children.
Answers
This is probably because an obj model typically consists of child shapes contained inside a root shape. Calling getVertexCount() on the root shape will give you 0 because it doesn't hold any vertices, you should access the child shapes by doing:
PShape also has a getChildren() method that returns all the child shapes in an array. Also, a child shape could also be a group containing further children.
thank you for the quick replay, I'll test it.