Attempting to load wavefront obj files with multiple -o groupings into 1 set of VAO using OpenGL #4740
Unanswered
JordanLiao
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The obj files I am trying to load have multiple -o flags, so there are multiple meshes. I am trying to load them with only 1 VAO, and I will draw them by recording each mesh's offset and size. However, it seems only the first mesh is drawn correctly, and the rest of the meshes are all distorted some how.
This is my loading logic:
`Object* ResourceManager::loadObject(const char* fPath) {
std::string pathName = std::string(fPath);
std::string objName = std::string(getFileNameFromPath(pathName));
and this is my drawing logic:
for (int i = 0; i < instObj->meshList.size(); i++) { Mesh* mesh = instObj->meshList[i]; glcheck(glDrawElements(GL_TRIANGLES, mesh->size, GL_UNSIGNED_INT, (GLvoid*)(sizeof(GLuint) * mesh->vertexOffset))); }
Any help would be welcomed, Thanks guys.
Beta Was this translation helpful? Give feedback.
All reactions