diff --git a/cocos/3d/CCSprite3D.cpp b/cocos/3d/CCSprite3D.cpp index 30e62f7a4f..3220a3d10c 100644 --- a/cocos/3d/CCSprite3D.cpp +++ b/cocos/3d/CCSprite3D.cpp @@ -313,12 +313,12 @@ void Sprite3D::genGLProgramState() } setGLProgramState(programstate); - auto count = mesh->getSubMeshCount(); + auto count = _subMeshStates.size(); _meshCommands.resize(count); for (int i = 0; i < count; i++) { auto tex = _subMeshStates.at(i)->getTexture(); GLuint texID = tex ? tex->getName() : 0; - _meshCommands[i].genMaterialID(texID, programstate, mesh->getSubMesh(i)/*_meshes.at(i)*/, _blend); + _meshCommands[i].genMaterialID(texID, programstate, _subMeshStates.at(i)->getSubMesh()->getMesh(), _blend); } }