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

Method DrawPoly

Rendering/ContextOpenGL2/vtkOpenGLContextDevice3D.cxx:270–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268}
269
270void vtkOpenGLContextDevice3D::DrawPoly(
271 const float* verts, int n, const unsigned char* colors, int nc)
272{
273 assert("verts must be non-null" && verts != nullptr);
274 assert("n must be greater than 0" && n > 0);
275
276 if (this->Pen->GetLineType() == vtkPen::NO_PEN)
277 {
278 return;
279 }
280
281 vtkOpenGLClearErrorMacro();
282
283 this->EnableDepthBuffer();
284
285 this->Storage->SetLineType(this->Pen->GetLineType());
286
287 vtkOpenGLHelper* cbo = nullptr;
288 if (colors)
289 {
290 this->ReadyVCBOProgram();
291 cbo = this->VCBO;
292 if (!cbo->Program)
293 {
294 return;
295 }
296 }
297 else
298 {
299 this->ReadyVBOProgram();
300 cbo = this->VBO;
301 if (!cbo->Program)
302 {
303 return;
304 }
305 if (this->HaveWideLines())
306 {
307 vtkWarningMacro(
308 << "a line width has been requested that is larger than your system supports");
309 }
310 else
311 {
312 this->RenderWindow->GetState()->vtkglLineWidth(this->Pen->GetWidth());
313 }
314 cbo->Program->SetUniform4uc("vertexColor", this->Pen->GetColor());
315 }
316
317 this->BuildVBO(cbo, verts, n, colors, nc, nullptr);
318 this->SetMatrices(cbo->Program);
319
320 auto timer = this->RenderWindow->GetRenderTimer();
321 VTK_SCOPED_RENDER_EVENT(this->GetClassNameInternal()
322 << "::" << __func__ << "|glDrawArrays(cacheIdentifier: "
323 << "null"
324 << ",mode:GL_LINE_STRIP,n:" << n,
325 timer);
326 glDrawArrays(GL_LINE_STRIP, 0, n);
327

Callers

nothing calls this directly

Calls 15

EnableDepthBufferMethod · 0.95
ReadyVCBOProgramMethod · 0.95
ReadyVBOProgramMethod · 0.95
HaveWideLinesMethod · 0.95
BuildVBOMethod · 0.95
SetMatricesMethod · 0.95
DisableDepthBufferMethod · 0.95
GetLineTypeMethod · 0.80
vtkglLineWidthMethod · 0.80
assertFunction · 0.50
SetLineTypeMethod · 0.45
GetStateMethod · 0.45

Tested by

no test coverage detected