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

Method RenderPieceDraw

Rendering/OpenGL2/vtkOpenGLPolyDataMapper.cxx:3507–3584  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

3505
3506//------------------------------------------------------------------------------
3507void vtkOpenGLPolyDataMapper::RenderPieceDraw(vtkRenderer* ren, vtkActor* actor)
3508{
3509 int representation = actor->GetProperty()->GetRepresentation();
3510
3511 vtkOpenGLRenderWindow* renWin = static_cast<vtkOpenGLRenderWindow*>(ren->GetRenderWindow());
3512 vtkOpenGLState* ostate = renWin->GetState();
3513
3514#ifndef GL_ES_VERSION_3_0
3515 // when using IBL, we need seamless cubemaps to avoid artifacts
3516 if (ren->GetUseImageBasedLighting())
3517 {
3518 ostate->vtkglEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
3519 }
3520#endif
3521
3522 vtkHardwareSelector* selector = ren->GetSelector();
3523 int iEnd = vtkOpenGLPolyDataMapper::PrimitiveEnd;
3524 if (!actor->GetProperty()->GetVertexVisibility() ||
3525 (selector && selector->GetFieldAssociation() == vtkDataObject::FIELD_ASSOCIATION_POINTS))
3526 {
3527 // when selecting points, the selection pass renders points at a larger size.
3528 // so don't show vertices as they might conflict with the selection pass.
3529 iEnd = vtkOpenGLPolyDataMapper::PrimitiveVertices;
3530 }
3531 int numVerts = this->VBOs->GetNumberOfTuples("vertexMC");
3532 for (int i = vtkOpenGLPolyDataMapper::PrimitiveStart; i < iEnd; i++)
3533 {
3534 this->DrawingVertices = i > vtkOpenGLPolyDataMapper::PrimitiveTriStrips;
3535 this->DrawingSelection = false;
3536 if (this->Primitives[i].IBO->IndexCount)
3537 {
3538 GLenum mode = this->GetOpenGLMode(representation, i);
3539 if (this->PointPicking)
3540 {
3541 ostate->vtkglPointSize(this->GetPointPickingPrimitiveSize(i));
3542 mode = GL_POINTS;
3543 }
3544
3545 // Update/build/etc the shader.
3546 this->UpdateShaders(this->Primitives[i], ren, actor);
3547
3548 if (mode == GL_LINES && !this->HaveWideLines(ren, actor))
3549 {
3550 ostate->vtkglLineWidth(actor->GetProperty()->GetLineWidth());
3551 }
3552
3553 this->Primitives[i].IBO->Bind();
3554 glDrawRangeElements(mode, 0, static_cast<GLuint>(numVerts - 1),
3555 static_cast<GLsizei>(this->Primitives[i].IBO->IndexCount), GL_UNSIGNED_INT, nullptr);
3556 this->Primitives[i].IBO->Release();
3557 if (i < 3)
3558 {
3559 this->PrimitiveIDOffset = this->CellCellMap->GetPrimitiveOffsets()[i + 1];
3560 }
3561 }
3562
3563 // Selection
3564 this->DrawingSelection = true;

Callers 1

RenderPieceMethod · 0.95

Calls 15

GetOpenGLModeMethod · 0.95
UpdateShadersMethod · 0.95
HaveWideLinesMethod · 0.95
GetRepresentationMethod · 0.80
vtkglEnableMethod · 0.80
GetFieldAssociationMethod · 0.80
vtkglPointSizeMethod · 0.80
vtkglLineWidthMethod · 0.80
GetPropertyMethod · 0.45
GetRenderWindowMethod · 0.45
GetStateMethod · 0.45

Tested by

no test coverage detected