Commit 00e4278a authored by Carson Brownlee's avatar Carson Brownlee Committed by David DeMarle
Browse files

crash fix

parent 4ac1e161
...@@ -185,9 +185,18 @@ vtkOSPRayRendererNode::~vtkOSPRayRendererNode() ...@@ -185,9 +185,18 @@ vtkOSPRayRendererNode::~vtkOSPRayRendererNode()
{ {
delete[] this->Buffer; delete[] this->Buffer;
delete[] this->ZBuffer; delete[] this->ZBuffer;
ospRelease((OSPModel)this->OModel); if (this->OModel)
ospRelease((OSPRenderer)this->ORenderer); {
ospRelease(this->OFrameBuffer); ospRelease((OSPModel)this->OModel);
}
if (this->ORenderer)
{
ospRelease((OSPRenderer)this->ORenderer);
}
if (this->OFrameBuffer)
{
ospRelease(this->OFrameBuffer);
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
...@@ -384,7 +393,7 @@ void vtkOSPRayRendererNode::Traverse(int operation) ...@@ -384,7 +393,7 @@ void vtkOSPRayRendererNode::Traverse(int operation)
(numAct != this->NumActors)) (numAct != this->NumActors))
{ {
this->NumActors = numAct; this->NumActors = numAct;
ospRelease((OSPModel)this->OModel); //ospRelease((OSPModel)this->OModel);
oModel = ospNewModel(); oModel = ospNewModel();
this->OModel = oModel; this->OModel = oModel;
it->InitTraversal(); it->InitTraversal();
...@@ -405,8 +414,9 @@ void vtkOSPRayRendererNode::Traverse(int operation) ...@@ -405,8 +414,9 @@ void vtkOSPRayRendererNode::Traverse(int operation)
it->GoToNextItem(); it->GoToNextItem();
} }
this->RenderTime = recent; this->RenderTime = recent;
ospSetObject(oRenderer,"model", oModel);
ospCommit(oModel); ospCommit(oModel);
ospSetObject(oRenderer,"model", oModel);
ospCommit(oRenderer);
} }
else else
{ {
...@@ -454,6 +464,7 @@ void vtkOSPRayRendererNode::Render(bool prepass) ...@@ -454,6 +464,7 @@ void vtkOSPRayRendererNode::Render(bool prepass)
{ {
oRenderer = (osp::Renderer*)this->ORenderer; oRenderer = (osp::Renderer*)this->ORenderer;
} }
ospCommit(this->ORenderer);
vtkRenderer *ren = vtkRenderer::SafeDownCast(this->GetRenderable()); vtkRenderer *ren = vtkRenderer::SafeDownCast(this->GetRenderable());
int *tmp = ren->GetSize(); int *tmp = ren->GetSize();
...@@ -514,10 +525,12 @@ void vtkOSPRayRendererNode::Render(bool prepass) ...@@ -514,10 +525,12 @@ void vtkOSPRayRendererNode::Render(bool prepass)
if (this->CompositeOnGL) if (this->CompositeOnGL)
{ {
OSPTexture2D glDepthTex=NULL; OSPTexture2D glDepthTex=NULL;
/*
if (glDepthTex) if (glDepthTex)
{ {
ospRelease(glDepthTex); ospRelease(glDepthTex);
} }
*/
vtkRenderWindow *rwin = vtkRenderWindow *rwin =
vtkRenderWindow::SafeDownCast(ren->GetVTKWindow()); vtkRenderWindow::SafeDownCast(ren->GetVTKWindow());
int viewportX, viewportY; int viewportX, viewportY;
...@@ -560,8 +573,12 @@ void vtkOSPRayRendererNode::Render(bool prepass) ...@@ -560,8 +573,12 @@ void vtkOSPRayRendererNode::Render(bool prepass)
this->GetZBuffer(), ospDepthBuffer, viewportWidth, viewportHeight); this->GetZBuffer(), ospDepthBuffer, viewportWidth, viewportHeight);
ospSetObject(oRenderer, "maxDepthTexture", glDepthTex); ospSetObject(oRenderer, "maxDepthTexture", glDepthTex);
ospCommit(oRenderer);
} }
else
{
ospSetObject(oRenderer, "maxDepthTexture", 0);
}
ospCommit(oRenderer);
ospRenderFrame(this->OFrameBuffer, oRenderer, ospRenderFrame(this->OFrameBuffer, oRenderer,
OSP_FB_COLOR | (this->ComputeDepth ? OSP_FB_DEPTH : 0) | (this->Accumulate ? OSP_FB_ACCUM : 0)); OSP_FB_COLOR | (this->ComputeDepth ? OSP_FB_DEPTH : 0) | (this->Accumulate ? OSP_FB_ACCUM : 0));
......
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