0
101 Jul 14, 2009 at 09:14

The assimp documentation is very short and there is just one incomplete pseudo code method. I tried the code below which result in black screen:

void RenderNode(const aiNode * node, aiMatrix4x4 accumulatedTransform)
{
aiMatrix4x4 transform;

if (node->mNumMeshes > 0)
{
for (int m=0; m < node->mNumMeshes; m++)
{
aiMesh* mesh = scene->mMeshes[m];
for (int f =0; f< mesh->mNumFaces; f++)
{
aiFace * face =  &mesh->mFaces[f];
glBegin(GL_TRIANGLES);
for (int v=0; v<3; v++)
{
glVertex3f( mesh->mVertices[ face->mIndices[v]].x/100000,mesh->mVertices[ face->mIndices[v]].y/100000,mesh->mVertices[ face->mIndices[v]].z/100000);
}
glEnd();
}
}
}
else
{
transform = node->mTransformation * accumulatedTransform;
glMatrixMode(GL_MODELVIEW);
glMultMatrixf((const GLfloat *) &transform);
}

for (int i=0; i<node->mNumChildren; i++)
{
RenderNode(node->mChildren[i], transform);
}
}


I call the method in this way:

aiMatrix4x4 identityMatrix;
RenderNode(scene->mRootNode, identityMatrix);


What am I doing wrong? Thank you very much in advance.

#### 3 Replies

0
101 Jul 14, 2009 at 13:51

Since you are dividing the vertices with 100000, there is a good chance that the model is simply too small to see.

0
165 Jul 14, 2009 at 17:09

BTW, you can use the …[/code[b][/b]] tags to post code. [code]…[/code**] tags to post code.

0
101 Jul 14, 2009 at 19:55

Thank you for both replies. I added the division so that the object coordinates are in the field of view. I also found that if I remove the ModelView transformation from the code, some parts of the model are visible.