我正在尝试将 Assimp 加载器集成到我的框架中。一切都渲染得很好,但是在我渲染的这个蜘蛛模型中,它的尖牙没有按预期绘制(见下图)。
下面是相关的代码片段:
//Storing the Indices
for (unsigned int t = 0; t < mesh->mNumFaces; ++t) {
aiFace* face = &mesh->mFaces[t];
memcpy(&faceArray[index], face->mIndices, 3*sizeof(unsigned int));
index += 3;
}
//Storing the Vertices
for (unsigned int t = 0; t < mesh->mNumVertices; ++t) {
aiVector3D vertex ;
if (mesh->HasPositions()) {
vertex = mesh->mVertices[t];
memcpy(&vertexArray[index], &vertex,3*sizeof(float));
}
index += 3;
}
//Render module
void model::helperDraw(GLuint vertexBufferID, GLuint indexBufferID, GLuint textureID)
{
GLint indexSize;
glBindBuffer(GL_ARRAY_BUFFER,vertexBufferID);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,indexBufferID);
glGetBufferParameteriv(GL_ELEMENT_ARRAY_BUFFER, GL_BUFFER_SIZE, &indexSize);
glBindTexture( GL_TEXTURE_2D, textureID);
glDrawElements(GL_TRIANGLES, indexSize/sizeof(GLuint), GL_UNSIGNED_INT, 0);
}
我的代码可能有什么问题?