Commit b92c70a6 authored by Ken Martin's avatar Ken Martin

Make release graphics resources public

Sometimes you want to free resources from an application
level, needs to be public to do so. And this is consistent
with the other classes signatures.
parent b3cb2825
......@@ -146,6 +146,13 @@ public:
*/
virtual void Render() = 0;
/**
* Release any graphics resources that are being consumed by this texture.
* The parameter window could be used to determine which graphic
* resources to release.
*/
virtual void ReleaseGraphicsResources(vtkWindow*) {}
//@{
/**
* Get the pixel data of an image, transmitted as RGBRGBRGB. The
......
......@@ -281,7 +281,7 @@ const char* vtkOpenGLRenderWindow::ReportCapabilities()
}
// ----------------------------------------------------------------------------
void vtkOpenGLRenderWindow::ReleaseGraphicsResources(vtkRenderWindow* renWin)
void vtkOpenGLRenderWindow::ReleaseGraphicsResources(vtkWindow* renWin)
{
this->PushContext();
......
......@@ -428,6 +428,12 @@ public:
// does VTKs framebuffer require resolving for reading pixels
bool GetBufferNeedsResolving();
/**
* Free up any graphics resources associated with this window
* a value of NULL means the context may already be destroyed
*/
void ReleaseGraphicsResources(vtkWindow*) override;
protected:
vtkOpenGLRenderWindow();
~vtkOpenGLRenderWindow() override;
......@@ -462,12 +468,6 @@ protected:
*/
virtual void DestroyWindow() = 0;
/**
* Free up any graphics resources associated with this window
* a value of NULL means the context may already be destroyed
*/
virtual void ReleaseGraphicsResources(vtkRenderWindow*);
/**
* Query and save OpenGL state
*/
......
......@@ -60,7 +60,7 @@ void vtkOpenVRModel::PrintSelf(ostream& os, vtkIndent indent)
os << indent << "Loaded " << (this->Loaded ? "On\n" : "Off\n");
}
void vtkOpenVRModel::ReleaseGraphicsResources(vtkRenderWindow* win)
void vtkOpenVRModel::ReleaseGraphicsResources(vtkWindow* win)
{
this->ModelVBO->ReleaseGraphicsResources();
this->ModelHelper.ReleaseGraphicsResources(win);
......
......@@ -58,7 +58,7 @@ public:
void SetRayLength(double length);
vtkOpenVRRay* GetRay() { return this->Ray; }
void ReleaseGraphicsResources(vtkRenderWindow* win);
void ReleaseGraphicsResources(vtkWindow* win);
// the tracked device this model represents if any
vr::TrackedDeviceIndex_t TrackedDevice;
......
......@@ -133,7 +133,7 @@ vtkOpenVRRenderWindow::~vtkOpenVRRenderWindow()
}
// ----------------------------------------------------------------------------
void vtkOpenVRRenderWindow::ReleaseGraphicsResources(vtkRenderWindow* renWin)
void vtkOpenVRRenderWindow::ReleaseGraphicsResources(vtkWindow* renWin)
{
// this->HelperWindow->ReleaseGraphicsResources(renWin);
this->Superclass::ReleaseGraphicsResources(renWin);
......
......@@ -381,15 +381,15 @@ public:
// OpenGL state
vtkOpenGLState* GetState() override;
protected:
vtkOpenVRRenderWindow();
~vtkOpenVRRenderWindow();
/**
* Free up any graphics resources associated with this window
* a value of nullptr means the context may already be destroyed
*/
virtual void ReleaseGraphicsResources(vtkRenderWindow*);
void ReleaseGraphicsResources(vtkWindow*) override;
protected:
vtkOpenVRRenderWindow();
~vtkOpenVRRenderWindow();
virtual void CreateAWindow() {}
virtual void DestroyWindow() {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment