Advertisement

Polygons from text

Started by April 08, 2002 03:20 AM
1 comment, last by splash 22 years, 10 months ago
I''m very new to OpenGL and I''ve been going though some of the tutorials on this site, they''re great, I''ve learned heaps. So, thanks! I have a text file that contains a number (# of points) followed by a series of x, y coordinates. I need to turn this into a polygon. It''s easy to do, but the file can have many lines, and that''s where my knowledge runs out. I need to have access to all polygons later, so I can''t just draw them and forget about them. I don''t know if it''s important or not, but there won''t be many polygons iin the file, maybe 10 at the most. Any help is appreciated!
Just loop until feof() becomes true. ... (if you use c input)... so
FILE *f = fopen("urfile.dat","r";char *x[10][256];int y=0;while(!feof(f)){fgets(x[y],256,f);//parse your line of info however...y++;} 

now do what u want... drawing blah blah blah


Advertisement
Just loop until feof() becomes true. ... (if you use c input)... so
FILE *f = fopen("urfile.dat","r");char *x[10][256];int y=0;while(!feof(f)){fgets(x[y],256,f);//parse your line of info however...y++;} 

now do what u want... drawing blah blah blah


This topic is closed to new replies.

Advertisement