-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OSX VTK6 PCLVisualizer::wasStopped() behavior #1390
Comments
If |
In this source, it seems to indicate that if you don't have visible (open?) drawable window for vtk to render on, the condition will trigger. On OS X, if you press the 'x' button, the window will close, triggering the condition. |
|
We have quite a few conditionally compiled sections here and there to support both versions. So it's fine to add something that exists only in newer versions, given that we properly surround it with |
This seems to be Mac specific. On a Ubuntu system with vtk6.2, I tried probing the result from |
Hey, I want to start working on a fix for this. My idea at the moment is to make a check on Are there other methods, which get called regularly, where I can make this check, so that |
I'm not familiar with that part of the PCLVisualizer but |
A simple test case that triggers the issue. #include <pcl/visualization/pcl_visualizer.h>
int
main (int argc, char **argv)
{
pcl::visualization::PCLVisualizer viewer ("Test");
/* Main Loop */
while (!viewer.wasStopped ())
{
viewer.spinOnce (100);
boost::this_thread::sleep (boost::posix_time::microseconds (100000));
}
return 0;
} Edit: Gave it a try with |
Made a couple of test and the only suitable solution which did not output trash on the console was adding the check to void
pcl::visualization::PCLVisualizer::spinOnce (int time, bool force_redraw)
{
resetStoppedFlag ();
#if (defined (__APPLE__) && defined (__MACH__) \
&& ( (VTK_MAJOR_VERSION > 6) || ( (VTK_MAJOR_VERSION == 6) && (VTK_MINOR_VERSION >= 1))))
if (!win_->IsDrawable ())
{
close ();
return;
}
#endif
if (time <= 0)
time = 1;
if (force_redraw)
interactor_->Render ();
DO_EVERY (1.0 / interactor_->GetDesiredUpdateRate (),
exit_main_loop_timer_callback_->right_timer_id = interactor_->CreateRepeatingTimer (time);
interactor_->Start ();
interactor_->DestroyTimer (exit_main_loop_timer_callback_->right_timer_id);
);
} |
I would change |
My target was VTK >= 6.1.
I think this is the only check that respects this condition. Assuming your suggestion was
This would not return I'll submit the PR tonight. |
Oh you're right! |
Hi all,
PCLVisualizer::wasStopped()
is described in the documentation as "Returnstrue
when the user tried to close the window.". From various comments around the web, the intended behaviour seems to be for the method to return true when the user presses the 'x' corner button of the window.I'm working with OS X 10.10 and vtk6.2 and this is not working for me. When I close the window,
PCLVisualizer::wasStopped()
still returnsfalse
and my console then get's polluted with the following messageAfter some digging I found this mention in VTK's documentation for vtkRenderWindow::IsDrawable() acknowledging the issue with Cocoa.
I managed to correct this behavior by getting the smart pointer to the
vtkRenderWindow
and adding the additional check tovtkRenderWindow::IsDrawable()
.Would it not be best to add this additional check into
PCLVisualizer::wasStopped()
?My tests were limited to console apps.
The text was updated successfully, but these errors were encountered: