Jump to content
  • Advertisement
Sign in to follow this  
Ahl

Quick AssImp question...

This topic is 2539 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
Nevermind. I found the problem. the tag "aiProcess_JoinIdenticalVertices" was the problem. Removed it and everything cleared up.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!