Polygons from text
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!
April 09, 2002 08:39 AM
Just loop until feof() becomes true. ... (if you use c input)... so
now do what u want... drawing blah blah blah
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
Popular Topics
Advertisement
Recommended Tutorials
Advertisement