Quick AssImp question...

Started by
0 comments, last by Ahl 12 years, 3 months ago
Hey all,

Put my .obj loader on the back burner for now and am trying to get AssImp working. Here's the problem: As far as I can tell everything loads properly but when trying to use the resultant meshes with a vertex array the models are highly fragmented.

The code:

void renderScene()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(0.0, 0.0, -20.0);
glRotatef(RotX, 1.0, 0.0, 0.0);
glRotatef(RotY, 0.0, 1.0, 0.0);
glRotatef(RotZ, 0.0, 0.0, 1.0);
glColor4f(1.0, 1.0, 1.0, 1.0);
RotX += (float)0.1;
RotY += (float)0.1;
RotZ += (float)0.1;

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
for (unsigned int n = 0; n < scene->mNumMeshes; n++)
{
glVertexPointer( 3, GL_FLOAT, sizeof(aiVector3D), scene->mMeshes[n]->mVertices);
glNormalPointer( GL_FLOAT, sizeof(aiVector3D), scene->mMeshes[n]->mNormals);
glTexCoordPointer( 2, GL_FLOAT, sizeof(aiVector3D), scene->mMeshes[n]->mTextureCoords);
glDrawArrays(GL_TRIANGLES,0, scene->mMeshes[n]->mNumVertices);
}

glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glutSwapBuffers();
}


I get the feeling that the problem is the sizeof(aiVector3D), that it's not what I should be using for the correct stride. Does anyone know what I should be using? Or if my problem lies elsewhere?
Advertisement
Nevermind. I found the problem. the tag "aiProcess_JoinIdenticalVertices" was the problem. Removed it and everything cleared up.

This topic is closed to new replies.

Advertisement