Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 7 of 7

Thread: how to load wavefront objects

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2009
    Posts
    3

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

  2. #2
    Junior Member Newbie
    Join Date
    Nov 2008
    Location
    California
    Posts
    9

    Re: how to load wavefront objects

    Quote Originally Posted by alexisgr
    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?

  3. #3
    Member Regular Contributor Rosario Leonardi's Avatar
    Join Date
    Aug 2008
    Location
    Italy
    Posts
    352

    Re: how to load wavefront objects

    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.
    ~ ~ I tell you, realtime 3D is made of blood, sweat and screams! ~ ~

  4. #4
    Junior Member Newbie
    Join Date
    Jan 2009
    Posts
    3

    Re: how to load wavefront objects

    Quote Originally Posted by Mike Werner
    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...

  5. #5
    Advanced Member Frequent Contributor _NK47's Avatar
    Join Date
    Mar 2008
    Posts
    574

    Re: how to load wavefront objects

    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.

  6. #6
    Senior Member OpenGL Guru
    Join Date
    Dec 2000
    Location
    Reutlingen, Germany
    Posts
    2,052

    Re: how to load wavefront objects

    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.
    GLIM - Immediate Mode Emulation for GL3

  7. #7
    Junior Member Newbie
    Join Date
    Jan 2009
    Posts
    3

    Re: how to load wavefront objects

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •