Etch and lib3ds

Hi All,
I recently started using lib3ds as my model loader for OpenGL, 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 lang=“cpp”]
void LoadModel(char filename)
file = 0;
Lib3dsMesh *mesh;
Lib3dsFace *face;

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

/Load the model file/
if ( ! file )
printf(" Loading 3DS file failed.
printf("Model Loaded
printf("Model Name %s
printf("Model Version %lX

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

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 


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

	for (i=0; i<3; ++i) 
	printf("vertex point %d %f %f %f 







This produces the following output
Model Loaded
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,0,0 is repeated for the rest of the model, can anyone give me a pointer in the right direction? Thanks. :slight_smile:
I should add I’ve tried loads of models all are the same. I’ve now also a built in function from lib3ds to show the vertexes and it also shows all zeros.
Sorry if this is not the correct forum, I’ve tried everywhere else with no answers, so I’m hoping some other opengl linux programmer also uses this libary and can give me a poiner.

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
$(CC) source/main.c -o test -lGL -lGLU sdl-config --cflags --libs sdl-config --libs -lSDL_image -l3ds

new make
$(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 tosinf’
/usr/lib/gcc/i486-linux-gnu/4.1.2/…/…/…/…/lib/lib3ds.a(matrix.o): In function lib3ds_matrix_rotate_z': (.text+0xe6d): undefined reference tocosf’
/usr/lib/gcc/i486-linux-gnu/4.1.2/…/…/…/…/lib/lib3ds.a(matrix.o): In function lib3ds_matrix_rotate_y': (.text+0xf42): undefined reference tosinf’
/usr/lib/gcc/i486-linux-gnu/4.1.2/…/…/…/…/lib/lib3ds.a(matrix.o): In function lib3ds_matrix_rotate_y': (.text+0xf4d): undefined reference tocosf’

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

It appears to me that you have not included the standard library in your compile? Or you need to include math.h in your code.

So, it compiles but when links it can’t find the calls in the library and pukes.

Just my guess…

Using math.h also requires to link against the math library so probably add -lm.

Hi thanks -lm solves my second problem. However I still have the first problem of all vectors loaded are 0.0f

Are you pretty sure the model you’re loading has vertices ? Did you tried blender and the 3ds plugin to see what it sees (or use wings3d) ? Even tried with another model file ?

I personally never used lib3ds providen in Debian/Etch. I use my own compiled one. But I don’t see why there should have a problem with Debiand and lib3ds.

Cannot tell much more for the moment.

Hi yes I’ve tried half a dozen models, on top of that my code worked under sarge. And I’ve tried both compiling my own and apt-get the debian package, both give the same results 0.0f for vertices :s I’m quiet at a loss.

I have Debian Etch, and all is working pretty well. Have you got some specific stuff installed, do you run under 64 bits cpus ?
Did you ever looked if the gcc you have is compatible with lib3ds ? Which version of both gcc and lib3ds do you use (and also the libc) ?

From a quick view at the bug browser of lib3ds I found that:

seems that lib3ds has some problems with recent compilers. My gcc version is currently 4.0.3 and it works well.
You might need to wait a bit (so I’ll do before upgrading gcc :slight_smile: )

I’ve got the latest Etch RC2 gcc shows
gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)

maybe this is the problem :s
Damn reading the report it seems it is, about 40 hours of my life lost.

Thanks for the help:)

This is not lost !

Whether you wait for a bug fix in lib3ds or whether you build an old gcc version (as 4.0.x). Would advise for building your own gcc…

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.