MCPcopy Create free account
hub / github.com/Kitware/VTK / UpdateVBO

Method UpdateVBO

Rendering/OpenGL2/vtkOpenGLES30PolyDataMapper2D.cxx:343–500  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

341
342//------------------------------------------------------------------------------
343void vtkOpenGLES30PolyDataMapper2D::UpdateVBO(vtkActor2D* act, vtkViewport* viewport)
344{
345 vtkPolyData* poly = this->GetInput();
346 if (poly == nullptr)
347 {
348 return;
349 }
350
351 this->MapScalars(act->GetProperty()->GetOpacity());
352 this->HaveCellScalars = false;
353 if (this->ScalarVisibility)
354 {
355 // We must figure out how the scalars should be mapped to the polydata.
356 if ((this->ScalarMode == VTK_SCALAR_MODE_USE_CELL_DATA ||
357 this->ScalarMode == VTK_SCALAR_MODE_USE_CELL_FIELD_DATA ||
358 this->ScalarMode == VTK_SCALAR_MODE_USE_FIELD_DATA ||
359 !poly->GetPointData()->GetScalars()) &&
360 this->ScalarMode != VTK_SCALAR_MODE_USE_POINT_FIELD_DATA && this->Colors)
361 {
362 this->HaveCellScalars = true;
363 }
364 }
365
366 // if we have cell scalars then we have to
367 // build the texture
368 vtkCellArray* prims[4];
369 prims[0] = poly->GetVerts();
370 prims[1] = poly->GetLines();
371 prims[2] = poly->GetPolys();
372 prims[3] = poly->GetStrips();
373 vtkDataArray* c = this->Colors;
374 if (this->HaveCellScalars)
375 {
376 this->CellCellMap->Update(prims, VTK_SURFACE, poly->GetPoints());
377 c = nullptr;
378 }
379
380 // Transform the points, if necessary
381 vtkPoints* p = poly->GetPoints();
382 if (this->TransformCoordinate)
383 {
384 vtkIdType numPts = p->GetNumberOfPoints();
385 if (!this->TransformedPoints)
386 {
387 this->TransformedPoints = vtkPoints::New();
388 }
389 this->TransformedPoints->SetNumberOfPoints(numPts);
390 for (vtkIdType j = 0; j < numPts; j++)
391 {
392 this->TransformCoordinate->SetValue(p->GetPoint(j));
393 if (this->TransformCoordinateUseDouble)
394 {
395 double* dtmp = this->TransformCoordinate->GetComputedDoubleViewportValue(viewport);
396 this->TransformedPoints->SetPoint(j, dtmp[0], dtmp[1], 0.0);
397 }
398 else
399 {
400 int* itmp = this->TransformCoordinate->GetComputedViewportValue(viewport);

Callers 1

RenderOverlayMethod · 0.95

Calls 15

GetVertsMethod · 0.80
GetPolysMethod · 0.80
GetStripsMethod · 0.80
CacheDataArrayMethod · 0.80
BuildAllVBOsMethod · 0.80
NewFunction · 0.50
ExecuteFunction · 0.50
assertFunction · 0.50
GetInputMethod · 0.45
MapScalarsMethod · 0.45

Tested by

no test coverage detected