[vtkusers] Creating Polygons using coordinates - OpenGL code in VTK

kent williams nkwmailinglists at gmail.com
Tue Feb 5 11:24:53 EST 2008


There's a Tcl example if you look through the online documentation:

vtkPoints polygonPoints
  polygonPoints SetNumberOfPoints 4
  polygonPoints InsertPoint 0 0 0 0
  polygonPoints InsertPoint 1 1 0 0
  polygonPoints InsertPoint 2 1 1 0
  polygonPoints InsertPoint 3 0 1 0
vtkPolygon aPolygon
  [aPolygon GetPointIds] SetNumberOfIds 4
  [aPolygon GetPointIds] SetId 0 0
  [aPolygon GetPointIds] SetId 1 1
  [aPolygon GetPointIds] SetId 2 2
  [aPolygon GetPointIds] SetId 3 3
vtkUnstructuredGrid aPolygonGrid
  aPolygonGrid Allocate 1 1
  aPolygonGrid InsertNextCell [aPolygon GetCellType] [aPolygon GetPointIds]
  aPolygonGrid SetPoints polygonPoints
vtkDataSetMapper aPolygonMapper
  aPolygonMapper SetInput aPolygonGrid
vtkActor aPolygonActor
  aPolygonActor SetMapper aPolygonMapper
  aPolygonActor AddPosition 6 0 2
  [aPolygonActor GetProperty] SetDiffuseColor 1 .4 .5

VTK is a visualization toolkit that uses OpenGL as a rendering layer.
I don't think using OpenGL code mixed with VTK code is a very good
idea.

On Tue, Feb 5, 2008 at 10:05 AM,  <polys_poly at hotmail.com> wrote:
>
>
> Hi there.
>
> I have a set of coordinates in text files. Each line in the file is a
> specific point (x,y). How can I create polygons out of these coordinates?
> And furthermore, how can I create a volume using two or more of these
> polygons, each one in a different z.
>
> Also, how can i use OpenGl code in vtk?
>
> Thanx, Polys
> _______________________________________________
>  This is the private VTK discussion list.
>  Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>  Follow this link to subscribe/unsubscribe:
>  http://www.vtk.org/mailman/listinfo/vtkusers
>
>



More information about the vtkusers mailing list