Results 1 to 2 of 2

Thread: texture coordinates reading from .*obj file

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2010
    Posts
    16

    texture coordinates reading from .*obj file

    Hello, everyone. This is my first time writing here. I am beginner at OpenGL (i thing it is goind to be my hobby). So, my mission is to get texture coordinates from *.obj file. I have read this format description and structure (http://www.eg-models.de/formats/Format_Obj.html), but due my low programming skills i cannot write a function, that is going to read coordinates from file. Maybe someone of u already did it, i would appreciate any help. Thanks anyway!
    P.S. I also have found some code here : http://www.graphixer.com.cn/ShowWork...orks&ID=25, but comments are written in chineese so i cant understand

  2. #2
    Senior Member Frequent Contributor
    Join Date
    Feb 2006
    Location
    Sweden
    Posts
    744

    Re: texture coordinates reading from .*obj file

    well essentially for each line(or row if you prefer that) you read you have to do two things.
    1. determine what kind of data is on this line
    2. parse it into a data structure

    so for #1 i use a statement like this
    if (!strncmp (line,"vt ",3)) parse_vt(&line[2]);

    then for #2 i have a function that basically just calls
    sscanf (line,"%f%f",&u, &v); and inserts it into a data structure

    and that's about it, the only hard thing to parse is the faces since there could be many different layouts of this, but i leave that to you

Similar Threads

  1. Strange Texture Coordinates in OBJ file
    By uwi2k2 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 02-17-2013, 01:26 AM
  2. in a ase file, by what is indicated the coordinates of texture?
    By airseb in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 04-29-2003, 08:10 AM
  3. AsE file texture coordinates
    By McZ in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 10-17-2001, 03:44 PM
  4. reading coordinates from a file
    By mochi in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 07-09-2001, 07:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean