------------------------------------------------------------------------------
| 355 | |
| 356 | //------------------------------------------------------------------------------ |
| 357 | void vtkOpenGLPolyDataMapper2D::SetMapperShaderParameters( |
| 358 | vtkOpenGLHelper& cellBO, vtkViewport* viewport, vtkActor2D* actor) |
| 359 | { |
| 360 | // Now to update the VAO too, if necessary. |
| 361 | if (this->VBOUpdateTime > cellBO.AttributeUpdateTime || |
| 362 | cellBO.ShaderSourceTime > cellBO.AttributeUpdateTime) |
| 363 | { |
| 364 | cellBO.VAO->Bind(); |
| 365 | |
| 366 | this->VBOs->AddAllAttributesToVAO(cellBO.Program, cellBO.VAO); |
| 367 | |
| 368 | cellBO.AttributeUpdateTime.Modified(); |
| 369 | } |
| 370 | |
| 371 | if (this->HaveCellScalars) |
| 372 | { |
| 373 | int tunit = this->CellScalarTexture->GetTextureUnit(); |
| 374 | cellBO.Program->SetUniformi("textureC", tunit); |
| 375 | } |
| 376 | |
| 377 | if (this->VBOs->GetNumberOfComponents("tcoordMC")) |
| 378 | { |
| 379 | vtkInformation* info = actor->GetPropertyKeys(); |
| 380 | if (info && info->Has(vtkProp::GENERAL_TEXTURE_UNIT())) |
| 381 | { |
| 382 | int tunit = info->Get(vtkProp::GENERAL_TEXTURE_UNIT()); |
| 383 | cellBO.Program->SetUniformi("texture1", tunit); |
| 384 | } |
| 385 | } |
| 386 | |
| 387 | // handle wide lines |
| 388 | if (this->HaveWideLines(viewport, actor)) |
| 389 | { |
| 390 | int vp[4]; |
| 391 | glGetIntegerv(GL_VIEWPORT, vp); |
| 392 | float lineWidth[2]; |
| 393 | lineWidth[0] = 2.0 * actor->GetProperty()->GetLineWidth() / vp[2]; |
| 394 | lineWidth[1] = 2.0 * actor->GetProperty()->GetLineWidth() / vp[3]; |
| 395 | cellBO.Program->SetUniform2f("lineWidthNVC", lineWidth); |
| 396 | } |
| 397 | |
| 398 | vtkRenderer* ren = vtkRenderer::SafeDownCast(viewport); |
| 399 | vtkHardwareSelector* selector = ren->GetSelector(); |
| 400 | if (selector && cellBO.Program->IsUniformUsed("mapperIndex")) |
| 401 | { |
| 402 | cellBO.Program->SetUniform3f("mapperIndex", selector->GetPropColorValue()); |
| 403 | } |
| 404 | } |
| 405 | |
| 406 | //------------------------------------------------------------------------------ |
| 407 | void vtkOpenGLPolyDataMapper2D::SetPropertyShaderParameters( |
no test coverage detected