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

Method DrawLines

Rendering/ContextOpenGL2/vtkOpenGLContextDevice2D.cxx:839–985  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

837
838//------------------------------------------------------------------------------
839void vtkOpenGLContextDevice2D::DrawLines(float* f, int n, unsigned char* colors, int nc)
840{
841 assert("f must be non-null" && f != nullptr);
842 assert("n must be greater than 0" && n > 0);
843
844 if (SkipDraw())
845 {
846 return;
847 }
848
849 if (this->Pen->GetLineType() == vtkPen::NO_PEN)
850 {
851 return;
852 }
853
854 // Skip transparent elements.
855 if (!colors && this->Pen->GetColorObject().GetAlpha() == 0)
856 {
857 return;
858 }
859
860 vtkOpenGLClearErrorMacro();
861
862 this->SetLineType(this->Pen->GetLineType());
863
864 vtkOpenGLHelper* cbo = nullptr;
865 if (colors)
866 {
867 this->ReadyLinesCBOProgram();
868 cbo = this->LinesCBO;
869 }
870 else
871 {
872 this->ReadyLinesBOProgram();
873 cbo = this->LinesBO;
874 if (!cbo->Program)
875 {
876 return;
877 }
878 cbo->Program->SetUniform4uc("vertexColor", this->Pen->GetColor());
879 }
880 if (!cbo->Program)
881 {
882 return;
883 }
884
885 cbo->Program->SetUniformi("stipple", this->LinePattern);
886
887 this->SetMatrices(cbo->Program);
888
889 // for line stipple we need to compute the scaled
890 // cumulative linear distance
891 double* scale = this->ModelMatrix->GetScale();
892 std::vector<float> distances;
893 distances.resize(n * 2);
894 float totDist = 0.0;
895 distances[0] = 0.0;
896 for (int i = 1; i < n; i++)

Callers

nothing calls this directly

Calls 15

SetLineTypeMethod · 0.95
ReadyLinesCBOProgramMethod · 0.95
ReadyLinesBOProgramMethod · 0.95
SetMatricesMethod · 0.95
BuildVBOMethod · 0.95
SetLineWidthMethod · 0.95
SkipDrawFunction · 0.85
copyColorsFunction · 0.85
PreDrawFunction · 0.85
PostDrawFunction · 0.85
GetLineTypeMethod · 0.80
GetAlphaMethod · 0.80

Tested by

no test coverage detected