Commit 818d115e authored by Ken Martin's avatar Ken Martin

paraview handles picking a little differently

This fix handles the fact that PV initializes the
zbuffer prior to setting the selector on the
mappers during a pick.
parent 1c02cec8
......@@ -185,26 +185,18 @@ void vtkOpenGLHardwareSelector::PostCapturePass(int pass)
}
//----------------------------------------------------------------------------
bool vtkOpenGLHardwareSelector::CaptureBuffers()
void vtkOpenGLHardwareSelector::BeginSelection()
{
if (!this->Renderer)
{
vtkErrorMacro("Renderer must be set before calling Select.");
return false;
}
// render normally to set the zbuffer
if (this->FieldAssociation == vtkDataObject::FIELD_ASSOCIATION_POINTS)
{
vtkRenderWindow *rwin = this->Renderer->GetRenderWindow();
this->Renderer->Clear();
rwin->SwapBuffersOff();
// do a normal render to set the zbuffer first
rwin->Render();
this->Renderer->PreserveDepthBufferOn();
}
return this->Superclass::CaptureBuffers();
return this->Superclass::BeginSelection();
}
//----------------------------------------------------------------------------
......
......@@ -63,7 +63,7 @@ public:
virtual void RenderProcessId(unsigned int processid);
// we need to initialze the depth buffer
virtual bool CaptureBuffers();
virtual void BeginSelection();
protected:
vtkOpenGLHardwareSelector();
......
......@@ -2244,15 +2244,6 @@ void vtkOpenGLPolyDataMapper::GetCoincidentParameters(
vtkRenderer* ren, vtkActor *actor,
float &factor, float &offset)
{
// hardware picking alsways offset due to saved zbuffer
vtkHardwareSelector* selector = ren->GetSelector();
if (selector)
{
offset = 2.0;
factor = 0.0;
return;
}
// 1. ResolveCoincidentTopology is On and non zero for this primitive
// type
factor = 0.0;
......@@ -2296,6 +2287,16 @@ void vtkOpenGLPolyDataMapper::GetCoincidentParameters(
factor = f;
offset = u;
}
// hardware picking always offset due to saved zbuffer
// This gets you above the saved surface depth buffer.
vtkHardwareSelector* selector = ren->GetSelector();
if (selector &&
selector->GetFieldAssociation() == vtkDataObject::FIELD_ASSOCIATION_POINTS)
{
offset -= 2.0;
return;
}
}
//-----------------------------------------------------------------------------
......
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