PDA

View Full Version : how to load wavefront objects



alexisgr
01-25-2009, 05:11 PM
hello everybody!
i'm a beginner and i'm trying to load a wavefront object into my program
i have the ASCII code of the .obj...
can someone help me and explain me how can i load it?
thanx!!

Mike Werner
01-25-2009, 07:09 PM
i'm a beginner and i'm trying to load a wavefront object into my program i have the ASCII code of the .obj...
can someone help me and explain me how can i load it? What does your 'program' do so far?

Rosario Leonardi
01-26-2009, 02:04 AM
mmm.. the question in not strictly openGL related but here
http://people.scs.fsu.edu/~burkardt/data/obj/obj.html
you can find all the code/documentation you need. :)

alexisgr
01-26-2009, 04:44 AM
What does your 'program' do so far?

it is supposed to be a game
a cannon trying to shoot bunnies.
i've done the cannon,the environment and the cannon shots
and i've been given the ASCII code of the bunny,but i don't know how to load it in my program...

_NK47
01-26-2009, 04:48 AM
you need to parse the *.obj file and read out the vertices, normals, texture coordinates and so on. when you done reading them out you treat this data as you contruct your canon, f.e. upload to video memory or store them in a way appropriate for rendering.

the parsing isn't that difficult but that depends how familiar you are with the file format and how good your are at your programming language.

Jan
01-26-2009, 04:58 AM
If you are using C++ you can take a look at this code: http://www.artifactgames.de/Code/Loader.zip

It will parse an OBJ and load the data into an internal struct. From there on you can easily integrate it into your own structures. Feel free to use / modify, as you wish.

Jan.

alexisgr
01-26-2009, 05:15 AM
thank's for your help!
i think i can make it now!!