how to load wavefront objects

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!!

What does your ‘program’ do so far?

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. :slight_smile:

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…

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.

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.

thank’s for your help!
i think i can make it now!!