and after that a glTexImage2D function or which one You prefer.
Are You updating the f and mesh pointers in the loop?
You can get a pointer to the next mesh like this:
mesh = mesh->next;
Or what did You use for exporting the 3DS model? Some exporters may only export the mesh without any textures or texture coordinates..
I had a rendering function like this in one of my programs:
void P_BLOCK::Render (P_BLOCKSINFO info){
Lib3dsMesh *mesh;
Lib3dsFace *face;
Lib3dsMaterial *mat;
unsigned int i, j, k;
char msg[256];
if (pNumMeshes){
mesh = f->meshes;
for (i=0; i<(unsigned)pNumMeshes; i++){
for (j=0; j<mesh->faces; j++){
face = &mesh->faceL
[j];
mat = lib3ds_file_material_by_name (f, face->material);
if(mat){
glMaterialfv (GL_FRONT, GL_AMBIENT, mat->ambient);
glMaterialfv (GL_FRONT, GL_DIFFUSE, mat->diffuse);
glMaterialfv (GL_FRONT, GL_SPECULAR, mat->specular);
}
glBindTexture (GL_TEXTURE_2D, info.Textures [FindMatNum(info,
face->material)]);
glBegin (GL_TRIANGLES); // Begin Drawing Triangles
glNormal3fv (face->normal);
for (k=0; k<3; k++){
glNormal3fv (nnormal [i].normalL[3 * j + k]);
if (mesh->texels > 0){
glTexCoord2f (mesh->texelL
[face->points[k]][0],
mesh->texelL [face->points[k]][1]);}
glColor3f (1.f, 1.f, 1.f);
glVertex3f (mesh->pointL [face->points[k]].pos[0],
mesh->pointL [face->points[k]].pos[1],
mesh->pointL [face->points[k]].pos[2]);
}
glEnd (); // Done Drawing Triangles
}
mesh = mesh->next;
}
}
}
I doubt if there was anything helpful in this reply..
Thank You,
All suggestions are welcome..
Express yourself instantly with MSN Messenger! MSN Messenger Download today it's FREE! ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ lib3ds-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/lib3ds-devel
