Results 1 to 5 of 5

Thread: reading coordinates from a file

  1. #1
    Junior Member Newbie
    Join Date
    May 2003
    Posts
    24

    reading coordinates from a file

    Hi ...
    sometink i can't figure out how to do,

    Suppose I have this 2D coordinates file that is structured like

    Coordinates:
    {
    Coordinates -2.0 2.0
    Coordinates -1.9 2.1
    .
    .
    .
    }

    Anyone knows of the OpenGL function that can read the file???

  2. #2
    Member Contributor
    Join Date
    Aug 2000
    Location
    france
    Posts
    89

    Re: reading coordinates from a file

    Hi, i'm not sure there is a ogl function that read a file like u want.

    U just have to parse this file, u open it (FILE* file=fopen(namefile, "r")
    U read each of its components and u close it.

  3. #3
    Member Contributor
    Join Date
    Jun 2001
    Posts
    55

    Re: reading coordinates from a file

    OpenGL has no function to read from files, in fact OpenGL has only functions to draw polys and other graphics stuff
    everything else has to be done by yourself
    for reading files use a filestream (ifstream), parse these lines and convert the coordinates into numbers (e.g. atof or atol)
    now u can send them via glvertex to OpenGL

    hope that helps (;

  4. #4
    Junior Member Newbie
    Join Date
    Jul 2001
    Location
    Grenade, Spain
    Posts
    14

    Re: reading coordinates from a file

    Maybe you prefer load a binary file, and not to preprocess your data files when you run your application (if it's slow, you can avoid to do it everytime), so you can do a "tool" to do this. So, your program only need to read the binary file.

    (if quake2 must recompile his bsp maps every time you started it, nobody would had play).

    [excuse grammar and ortography mistakes, but english is not my mother language

  5. #5
    Junior Member Newbie
    Join Date
    May 2003
    Posts
    24

    Re: reading coordinates from a file

    i tink i get what u all mean ... thanks =>

Similar Threads

  1. Reading in a .obj file
    By MXA92 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-11-2012, 06:29 AM
  2. texture coordinates reading from .*obj file
    By alexiis in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 01-18-2010, 07:53 AM
  3. Replies: 12
    Last Post: 05-25-2005, 12:42 PM
  4. Error Reading File BMP File Size ?
    By Olumide in forum OpenGL: Advanced Coding
    Replies: 13
    Last Post: 01-31-2002, 10:57 AM
  5. reading coordinates into an array
    By mjr464 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 09-29-2000, 11:04 AM

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