LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-27-2007, 05:27 AM   #1
knobby67
Member
 
Registered: Mar 2006
Posts: 627

Rep: Reputation: 43
Using lib3ds with Etch


Hi All,
I recently started using lib3ds, after a few attempts I got it working with models, lights and textures. I then got updated my Debian system to Etch and found my code didn't draw any models, that is exactly the same code I was using beforehand. On much testing it seemed that lib3ds was not producing any vertexes? I wrote this bit of test code to view the model, can anyone tell me if what I'm doing is right or is there a problem with Etch and lib3ds?
[source]
void LoadModel(char *filename)
{
Lib3dsFile* file = 0;
Lib3dsMesh *mesh;
Lib3dsFace *face;

unsigned int p,loop=0,i;
float *value;


/*******************************Load the model file****************************/
file=lib3ds_file_load(filename);
if ( ! file )
{
printf(" Loading 3DS file failed.\n");
}
else
{
printf("Model Loaded \n");
}
/******************************************************************************/
printf("Model Name %s\n",file->name);
printf("Model Version %lX\n",file->mesh_version);
/******************************************************************************/

/**********************Step through attributes*********************************/
for (mesh = file->meshes; mesh; mesh = mesh->next)
{
printf("Object name %s\n",mesh->name);

for (p = 0; p < mesh->faces; p++) /* step through mesh list */
{
face = &mesh->faceL[p];

printf("%d Material name %s",++loop,face->material);
printf(" points %o %o %o",face->points[0],face->points[1],face->points[2]);
printf(" flags %o ",face->flags);
printf(" smoothing %lX", face->smoothing);
printf(" normal %f %f %f \n",face->normal[0],face->normal[1],face->normal[2]);

/**********************Vertex ******************************************************/

for (i=0; i<3; ++i)
{
value=mesh->pointL[face->points[i]].pos;
printf("vertex point %d %f %f %f \n",i,*value,*(value+1),*(value+2))

}

if(p==3) exit(0);

}
}



}
[/source]

This produces the following output
Model Loaded
Model Name MAXSCENE
Model Version 3
Object name Sphere01
1 Material name blueShine points 0 1 2 flags 7 smoothing 1 normal 1.000000 0.000000 0.000000
vertex point 0 0.000000 0.000000 0.000000
vertex point 1 0.000000 0.000000 0.000000
vertex point 2 0.000000 0.000000 0.000000
2 Material name blueShine points 742 2 3 flags 7 smoothing 1 normal 1.000000 0.000000 0.000000
vertex point 0 0.000000 0.000000 0.000000
vertex point 1 0.000000 0.000000 0.000000
vertex point 2 0.000000 0.000000 0.000000



The vertex 0,1,1 is repeated for the rest of the model, can anyone give me a pointer in the right direction? Thanks.

Last edited by knobby67; 03-27-2007 at 06:24 AM.
 
Old 03-27-2007, 09:59 AM   #2
knobby67
Member
 
Registered: Mar 2006
Posts: 627

Original Poster
Rep: Reputation: 43
Solved the problem below added -lm to my make, but still have problem of 0.0 for all vettex so original question stands Thanks


Hi all,
I'm even more puzzled now? I've found and used the built in function lib3ds_mesh_dump(mesh) and this also lists my vertexes as all zeros. So I thought I'd uses ldd to see if I could see the lib3ds library listed, no sign of it, but it exists in both usr/lcal/lib and usr/lib.

As my print code doesn't do any screen drawing, so I thought I'd get rid of my library files except for lib3ds so I change part of my make from
*old make*
all:
$(CC) source/main.c -o test -lGL -lGLU `sdl-config --cflags --libs` `sdl-config --libs` -lSDL_image -l3ds

to
new make
all:
$(CC) source/main.c -o test -l3ds

Now when I compile I suddenly get a large number of errors

make -k all
gcc -Wall -ansi -g source/main.c -o test -l3ds
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/lib3ds.a(matrix.o): In function `lib3ds_matrix_rotate_z':
(.text+0xe62): undefined reference to `sinf'
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/lib3ds.a(matrix.o): In function `lib3ds_matrix_rotate_z':
(.text+0xe6d): undefined reference to `cosf'
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/lib3ds.a(matrix.o): In function `lib3ds_matrix_rotate_y':
(.text+0xf42): undefined reference to `sinf'
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/lib3ds.a(matrix.o): In function `lib3ds_matrix_rotate_y':
(.text+0xf4d): undefined reference to `cosf'
/

and many more similar errors, can anyone advise, has anyone seen this before? I think I'm going mad

Last edited by knobby67; 03-27-2007 at 10:40 AM.
 
Old 03-28-2007, 01:26 PM   #3
knobby67
Member
 
Registered: Mar 2006
Posts: 627

Original Poster
Rep: Reputation: 43
I found the answer lib3ds will not work with modern versions of GCC :s hopefully someone will fix this.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
update Debian testing etch RC1 to etch stable cccc Debian 11 01-08-2007 10:02 PM
lib3ds -> bones hylke Programming 6 09-24-2005 03:29 AM
Getting Etch BradDaBug Debian 1 07-05-2005 11:25 AM
cygwin -> compiling lib3ds hylke General 0 06-21-2005 02:02 AM
About Etch maginotjr Debian 6 06-07-2005 02:04 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration