Results 1 to 6 of 6

Thread: Please help ! read .ase file

  1. #1
    Senior Member Regular Contributor
    Join Date
    Dec 2000
    Location
    Årsunda,gästrikland,Sweden
    Posts
    113

    Please help ! read .ase file

    I need help to read .ase files!
    this is the way I do to read a line and save it for later use:

    void LoadAse(char *filename)
    {
    char buff[200];
    ifstream fin:

    fin.open(filename);

    do {
    fin.getline(buff, sizeof(buff));

    if(strcmp("*MESH_VERTEX", buff) == 0)
    sscanf(buff, "*MESH_VERTEX %f %f %f", &object.x, &object.y, &object.z);

    }while(fin.eof() =! 1)

    this line : sscanf(buff, "*MESH_VERTEX %f %f %f", &object.x, &object.y, &object.z); doesn´t work because the *MESH_VERTEX isn´t at the start of the line how to fix this ?

  2. #2
    Senior Member Regular Contributor
    Join Date
    Feb 2000
    Posts
    154

    Re: Please help ! read .ase file

    Hardly related to opengl..

    Anyway, try put %s in the format string and a dummy variable to catch the MESH_VERTEX.

    [This message has been edited by AndersO (edited 02-28-2001).]

  3. #3
    Senior Member Regular Contributor
    Join Date
    Dec 2000
    Location
    Årsunda,gästrikland,Sweden
    Posts
    113

    Re: Please help ! read .ase file

    thanks for that I got a step on the way but I can´t read the Faces now I don´t know whats wrong. I have found a source for reading the ase files. they use fscanf instead of sscanf as I do I have tried to make it almost the same as they have except that I use sscanf and read from a buffer instead of fscanf.

    [This message has been edited by McZ (edited 03-01-2001).]

  4. #4
    Junior Member Newbie
    Join Date
    Nov 2000
    Location
    Nashua, NH
    Posts
    11

    Re: Please help ! read .ase file

    yes, use fscanf("%s", &data) where data is an array of 255 characters. then simply do a if(!strcmp(data, "data you are looking for")) to see if you're about to read vertices, normals or faces.

    btw, it bothers me when someone feels high and mighty enough to complain about non-opengl subjects in this forum, there's nothing wrong with asking a question that we all know can be answered by the people who read these forums.

    gl with the ASE loading! if you have any more questions, email me at s_fonden@mail.plymouth.edu.
    -Stephen R. Fonden

  5. #5
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: Please help ! read .ase file

    Originally posted by s_fonden:
    yes, use fscanf("%s", &data) where data is an array of 255 characters. then simply do a if(!strcmp(data, "data you are looking for")) to see if you're about to read vertices, normals or faces.
    Actually it should be fscanf("%s", data) if data is a char[255]. Passing it as &data would pass a pointer to the array pointer and the most likely result will be CRASH!!
    Deiussum
    Software Engineer and OpenGL enthusiast

  6. #6
    Senior Member Regular Contributor
    Join Date
    Dec 2000
    Location
    Årsunda,gästrikland,Sweden
    Posts
    113

    Re: Please help ! read .ase file

    thanks for your help but I think I have to learn little more about file reading and stuff my C++ book has only a little chapter but I got my .ASE reader to work but now I can´t rotate the object and I´m using the same rotating stuff as I did before and it worked OK then

Similar Threads

  1. How to read another file again?
    By LovingYou in forum OpenGL: Basic Coding
    Replies: 12
    Last Post: 11-27-2007, 06:47 PM
  2. re-read from the file
    By lara in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 11-26-2002, 11:17 AM
  3. How can I read the 3D Max file??? Thanks
    By arjie in forum OpenGL: Advanced Coding
    Replies: 9
    Last Post: 10-09-2002, 11:37 AM
  4. how to read MP3 file?
    By in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 05-13-2002, 08:48 PM
  5. how to read a file ?
    By McZ in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 02-05-2001, 12:32 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