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

Method ReleaseGraphicsResources

Rendering/OpenGL2/vtkTextureObject.cxx:407–445  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

405
406//------------------------------------------------------------------------------
407void vtkTextureObject::ReleaseGraphicsResources(vtkWindow* win)
408{
409 if (!this->ResourceCallback->IsReleasing())
410 {
411 this->ResourceCallback->Release();
412 return;
413 }
414
415 // Ensure that the context is current before releasing any graphics
416 // resources tied to it.
417 if (this->Handle)
418 {
419 vtkOpenGLRenderWindow* rwin = vtkOpenGLRenderWindow::SafeDownCast(win);
420 // you can commewnt out the next line to look for textures left active
421 rwin->DeactivateTexture(this);
422 if (this->OwnHandle)
423 {
424 GLuint tex = this->Handle;
425 glDeleteTextures(1, &tex);
426 this->OwnHandle = false;
427 }
428 this->Handle = 0;
429 this->NumberOfDimensions = 0;
430 this->Target = 0;
431 this->InternalFormat = 0;
432 this->Format = 0;
433 this->Type = 0;
434 this->Components = 0;
435 this->Width = this->Height = this->Depth = 0;
436 this->Modified();
437 }
438 if (this->ShaderProgram)
439 {
440 this->ShaderProgram->ReleaseGraphicsResources(win);
441 delete this->ShaderProgram;
442 this->ShaderProgram = nullptr;
443 this->Modified();
444 }
445}
446
447//------------------------------------------------------------------------------
448void vtkTextureObject::Bind()

Callers 1

Calls 4

IsReleasingMethod · 0.80
ReleaseMethod · 0.45
DeactivateTextureMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected