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

Method Initialize

Rendering/VolumeOpenGL2/vtkSmartVolumeMapper.cxx:276–318  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Initialize the render We need to determine whether the GPU or CPU mapper are supported First we need to know what input scalar field we are working with to find out how many components it has. If it has more than one and we are considering them to be independent components, then only GPU Mapper will be supported. ------

Source from the content-addressed store, hash-verified

274// them to be independent components, then only GPU Mapper will be supported.
275//------------------------------------------------------------------------------
276void vtkSmartVolumeMapper::Initialize(vtkRenderer* ren, vtkVolume* vol)
277{
278 vtkDataSet* input = this->GetInput();
279 if (!input)
280 {
281 this->Initialized = 0;
282 return;
283 }
284
285 int usingCellColors = 0;
286 vtkDataArray* scalars = vtkSmartVolumeMapper::GetScalars(input, this->ScalarMode,
287 this->ArrayAccessMode, this->ArrayId, this->ArrayName, usingCellColors);
288
289 if (!scalars)
290 {
291 vtkErrorMacro("Could not find the requested vtkDataArray! "
292 << this->ScalarMode << ", " << this->ArrayAccessMode << ", " << this->ArrayId << ", "
293 << this->ArrayName);
294 this->Initialized = 0;
295 return;
296 }
297
298 int const numComp = scalars->GetNumberOfComponents();
299 this->RayCastSupported = (usingCellColors || numComp > 1) ? 0 : 1;
300
301 if (!this->RayCastSupported &&
302 this->RequestedRenderMode == vtkSmartVolumeMapper::RayCastRenderMode)
303 {
304 vtkWarningMacro(
305 "Data array " << this->ArrayName
306 << " is not supported by"
307 "FixedPointVolumeRCMapper (either cell data or multiple components).");
308 }
309
310 // Make the window current because we need the OpenGL context
311 vtkRenderWindow* win = ren->GetRenderWindow();
312 win->MakeCurrent();
313
314 this->GPUSupported = this->GPUMapper->IsRenderSupported(win, vol->GetProperty());
315 this->Initialized = 1;
316 this->InitializedBlendMode = this->GetBlendMode();
317 this->SupportStatusCheckTime.Modified();
318}
319
320//------------------------------------------------------------------------------
321// Compute the render mode based on what hardware is available, what the user

Calls 8

GetBlendModeMethod · 0.80
GetScalarsClass · 0.50
GetInputMethod · 0.45
GetNumberOfComponentsMethod · 0.45
GetRenderWindowMethod · 0.45
MakeCurrentMethod · 0.45
GetPropertyMethod · 0.45
ModifiedMethod · 0.45