Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


3d model loading with OpenGL


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 drago   Members   -  Reputation: 150

Like
Likes
Like

Posted 28 November 1999 - 03:12 PM

Hi,

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


Sponsor:

#2 benjamin bunny   GDNet+   -  Reputation: 838

Like
Likes
Like

Posted 28 November 1999 - 03:12 PM

Prepare some structures to receive your triangle and vertex information

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








Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS