PDA

View Full Version : object loader



OGL_PGR
01-08-2008, 03:27 AM
Hi,

Can someone please advise me this:

I need a 3DS loader on Linux.

Objective:

To create a 3D walk-through application using OpenGL (in a very short duration).

Thanks.

ZbuffeR
01-08-2008, 08:15 AM
The "3DS loader" part has nothing to do with OpenGL.
Personnaly, I would just outsource the job to Romania :p

Zengar
01-08-2008, 09:12 AM
just google... everyone out there has written a 3ds loader :)

RGHP
01-08-2008, 10:40 AM
http://lib3ds.sourceforge.net/

Lib3dsFile* myfile = lib3ds_file_load("MySuperModel.3ds");
Lib3dsMesh* miObjeto = lib3ds_file_mesh_by_name(myfile, "airplane");

Mesh objects have this members:

uint points;
uint faces;
uint texels//points = texels;
Lib3dsPoint* pointL;//vertex
Lib3dsFace* faceL;//indices

Copy this fields to your own arrays(I don't know why it doesn't work when i send them directly to VBOs);
If you are using VBOs:
glBufferData(GL_ARRAY_BUFFER, 3*sizeof(float)*points, myvertexarray, GL_STATIC_DRAW);//For the veretx, for the texels just change the pointer
glBufferData(GL_ELEMENT_ARRAY_BUFFER,3*sizeof(uint )*faces, myfacesarray,GL_STATIC_DRAW);


Then just call glDrawElements with indices to 0.

Bye


If you learn how to use the keyframe part, let me know ;).