[GRASS5] Re: [GRASSLIST:4110] Re: nviz and polygons

Bob Covill bcovill at tekmap.ns.ca
Mon Jul 22 09:28:30 EDT 2002


Markus Neteler wrote:
> 
> (cc grass5)
> 
> On Sat, Jul 20, 2002 at 10:18:34PM +0200, Johannes Bühler wrote:
> > thats probably the best idea. but not very elegant. so that is way i was
> > looking for a more smartly way to solve this problem.
> > thanks.
> 
> In general there should be a function in OpenGL to draw filled
> polygons which needs to be implemented in NVIZ.
> 
> Does anyone know details how to fill vector polygons with OpenGL?
> 
> Markus
> 
> >
> > On Sat, 20 Jul 2002 19:46:45 +0100 (BST)
> > Paul Kelly <paul-grass at stjohnspoint.co.uk> wrote:
> >
> > > I think you could convert the vector layer containing the labelled
> > > polygons to a raster, using v.to.rast, and display that. You might have to
> > > use r.colors or something to make sure the lakes come out blue or whatever
> > > colour you need. The rest of the raster layer would be null so it would be
> > > transparent in NVIZ I think (haven't tried this)
> > >
> > > On Sat, 20 Jul 2002, Johannes Bühler wrote:
> > >
> > > > hi,
> > > > does anyone know if it is possible to show filled polygons (lakes) in nviz.
> > > >
> > > > thanks
> > > > Johannes Buehler
> > > >
> > > > --
> > > > --          Johannes Buehler
> > > >    __O      Feldtstr. 45
> > > >  =`\<,      14789 Greifswald
> > > > (=)/(=)     johannesbuehler at oderbruecke.de
> > > > -----------
> _______________________________________________
> grass5 mailing list
> grass5 at grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass5

Markus,

The current vector drawing is handled by the ogsf library calls
gsd_bgnline and gsd_endline. The gsd_bgnline initializes the OpenGL call
to glBegin(GL_LINE_STRIP). This simply draws a connected group of line
segments. Note that this is the same routine that draws the wire frame
surface. 

To draw a filled polygon you could use something like
glBegin(GL_POLYGON). This would require paying attention to the vertices
passed to the function to make sure it closes the way you want.

Note that the shaded surface is drawn with a more complex call to
glBegin(GL_TRIANGLE_STRIP).

I will take a look to see how easy (or not) implementing closed polygons
might be. 

Hope this helps.

-- 
Bob Covill

Tekmap Consulting
P.O. Box 2016
Fall River, N.S.
B2T 1K6
Canada

E-Mail: bcovill at tekmap.ns.ca
Phone: 902-860-1496
Fax: 902-860-1498



More information about the grass-dev mailing list