[vtkusers] Iterating through vtkCellArray *pStrips = pPolydata->GetStrips(); results

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Mon Aug 8 13:53:26 EDT 2005


Check vtkOpenGLPolyDataMapper::DrawTStrips().
The switch block decides if the macros can be used for rendering. The 
macros help avoid unnecessary conditionals in the loop, thus improving
run-time. The default case in the switch block does almost identical to 
what the macros can achieve, execpt that it has conditionals in it which 
are checked while rendering each cell/vertex.

The default case (line ~1274) in the switch block has the code to do 
what you are looking for.

Utkarsh


Jim Carroll wrote:
> Hi,
> 
> I've got an application that does some opengl rendering of its own, and I'd like
> to do my own 'Mapping' of data to opengl rendering commands...   I can't find a
> straight-forward example of iterating through a cell array and getting the strip
> verticies.  (The OpenglPolyDataMapper has lots of complex macros that I'm having
> trouble following.)
> 
> I need to get the verticies and their normals, something like:
> 
>     // This works
>     vtkCellArray *pStrips = pPolydata->GetStrips();
> 
>     // From here on I'm guessing...
> 
>     // Create an array for the biggest strip
> ?   int maxCellSize = pStrips->GetMaxCellSize();
> 
>     int iStrip;
>     for (iStrip = 0; iStrip < pStrips->???(); iStrip++)
>     {
> ?       vtkCell* pCell = pStrips->GetCell(iStrip);
>        
>         ::glBegin (GL_TRIANGLE_STRIP);
> 
>         // For each vertex in the strip
>         for (iVertex = 0; iVertex < numVerticies; iVertex++)
>         {
>             ::glNormal3f (??);
>             ::glVertex3f (??);
>         }
> 
>         ::glEnd ();
>     }
> 
> Is there an example of cell iteration in the books or the code that would help
> me fill in the blanks?
> 
> Thanks,
> -Jim Carroll
> 
> 
> 
> 
> _______________________________________________
> 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