Re: [PyOpenGL-Users] tessellation example
Brought to you by:
mcfletch
From: Mike C. F. <mcf...@ro...> - 2004-07-22 03:16:45
|
You don't actually need much of OpenGLContext. The OpenGLContext/scenegraph/polygontessellator.py module is only dependent on the utilities module, which is just providing very low-level operations such as cross and dot products, and the vertex module, which is just a trivial modeling of a vertex. With the polygontessellator module, the code to tessellate a polygon is that seen in OpenGLContext/tests/glu_tess.py, to wit: for type, vertices in self.tess.tessellate( vertices, forceTriangles=0 ): glNormal( 0,0,-1 ) glBegin( type ) for v in vertices: glVertex2dv( v.point ) glEnd() Though there's more to it to actually use each vertex's colour, normal, etceteras, but that's all pretty straightforward, they're just attributes of the vertex object. There's also a method tessContours which allows for defining multiple-contour shapes, such as those between two map contour lines. Anyway, just reading the polygontessellator module should give you just about everything you need to do tessellation. Good luck, Mike Fulko van Westrenen wrote: >Hello, > >I wrote a geographical-map display-system. The whole thing works >very nice, but needs a major improvement. At the moment all areas >only have the boundaries drawn, and I would like to have them filled. >Tessellation seems the answer, and glu my friend. I looked it up in >the red_book, but that was far too complex for me. Then I studied >OpenGLContext; very hard for me to rewrite for my needs. > >Does someone have a clean and _simple_ example-program that converts >a list of funny shaped polygons (like shorelines) into a list of >convex polygons? > >Thanks for any help. > >Fulko > > ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://members.rogers.com/mcfletch/ blog: http://zope.vex.net/~mcfletch/plumbing/ |