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

Jim Carroll jim at microbrightfield.com
Mon Aug 8 13:23:57 EDT 2005


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







More information about the vtkusers mailing list