Re: [PyOpenGL-Users] parse big list
Brought to you by:
mcfletch
From: Strato <fl...@id...> - 2002-07-01 18:30:16
|
I apologize for sending the wrong file. I hadn't noticed that I sent you a compressed one, but the clearly readable one is about 3MB. If you would like to see it, or if it would be enough to see a part, please tell me. Until now I haven't found out how many sides a polygon has. ----- Original Message ----- From: "Strato" <fl...@id...> To: "Rene Dudfield" <il...@ya...>; <pyo...@li...> Sent: Monday, September 30, 2002 8:00 PM Subject: Re: [PyOpenGL-Users] parse big list > Hi again, > helped a lot, fr drawing I put the file by mail. Not the same as I mentioned > before, to keep it small, but the file format is the same. At first only the > parts that describe the shape and the two textures are from interest. The > part about the lights and so on has to wait. > I tried "glVertex3f(x, y, z)" > and so on. before this the color was set. > Actually I don't now how many sides a polygon has. I'll try to figure it > out. > > > ----- Original Message ----- > From: "Rene Dudfield" <il...@ya...> > To: "Strato" <fl...@id...>; <pyo...@li...> > Sent: Sunday, June 30, 2002 2:59 PM > Subject: Re: [PyOpenGL-Users] parse big list > > > > Hello. > > > > --- Strato <fl...@id...> wrote: > The > > import problem got solved (Thanks!) but there is > > > one thing I have again. > > > I want to read in a file and used "file("E111B.s", > > > "R") > > > and then how do I get a long list inside this file > > > "point (x, y, z)" > > > ..... > > > > > > > So the file format is like this?: > > > > """point(1., 3., 3.9893824234) > > point(2., 2., 3.9893824234) > > point(7.2, 2.12, 3.9893824234) > > point(5.31, 2.32, 3.9893824234)""" > > > > How do you know how many sides each polygon has? > > > > > > You can read a file like this: > > > > f = open("E111B.s","r") > > lines = f.readlines() > > > > # if the last line does not have a newline at the end, > > # add one. > > if lines[-1][-1] != "\n": > > lines[-1] += "\n" > > > > points = [] > > > > for line in lines: > > # get rid of the "point(" and ")\n" > > point = line[len("point("):-2] > > > > # convert the parts into floats > > points.append( map(float, point.split(",")) ) > > > > > > For drawing we need to know how many points make up a > > polygon. > > > > > > Good luck! > > > > > > > read into a variable and then do for every point a > > > glVertex3f to draw the > > > shape. (of an engine) > > > If I have something valuable done I'll tell you > > > probably open an sourceforge > > > project > > > > > > Florian Idelberger > > > > > > P.S.: If you want the file as an example, tell me > > > and note if I could send > > > it to the list or not. (43,9kb) > > > > > > > > > > > > > __________________________________________________ > > Do You Yahoo!? > > Everything you'll ever need on one web page > > from News and Sport to Email and Music Charts > > http://uk.my.yahoo.com > > > |