Does anybody here know how to load a 3d model into an OpenGL application, no GLUT, using C/C++... I dont care if it's .3ds or .obj or whatever, as long as it works..
Thanks in advance...
------------------
Drago
Does anybody here know how to load a 3d model into an OpenGL application, no GLUT, using C/C++... I dont care if it's .3ds or .obj or whatever, as long as it works..
Thanks in advance...
------------------
Drago
something like this
typedef struct{
unsigned ver[3];
//insert texture coords, normals etc here
} tri_t;
typedef struct{
{
float pos[3];
} ver_t;
typedef struct{
unsigned numverts;
unsigned numtris;
ver_t *ver;
tri_t *tri;
} object_t;
then declare a struct of object_t type, load in a 3D object from the 3D modeller of your choice (you'll have to research the file format a little so you can extract the data you want), allocate memory for tris and vertices
(something like)
object.tri=malloc(sizeof(tri_t)*numtris);
object.ver=malloc(sizeof(ver_t)*numvers);
and load the data into your structures.
hope that helps
BW
after loading the file, make sure you allocate memory for the tri
____________________________________________________________www.elf-stone.com | Automated GL Extension Loading: GLee 5.00 for Win32 and Linux