disabled Ubuntu workaround code for Windows

This commit is contained in:
Anatoly Baksheev 2014-01-19 02:16:59 +04:00
parent 0d12fb0346
commit 8f15a8abdb
2 changed files with 18 additions and 6 deletions

View File

@ -57,6 +57,7 @@ cv::viz::Viz3d::VizImpl::VizImpl(const String &name) : spin_once_state_(false),
window_ = vtkSmartPointer<vtkRenderWindow>::New(); window_ = vtkSmartPointer<vtkRenderWindow>::New();
cv::Vec2i window_size = cv::Vec2i(window_->GetScreenSize()) / 2; cv::Vec2i window_size = cv::Vec2i(window_->GetScreenSize()) / 2;
window_->SetSize(window_size.val); window_->SetSize(window_size.val);
window_->AddRenderer(renderer_);
// Create the interactor style // Create the interactor style
style_ = vtkSmartPointer<InteractorStyle>::New(); style_ = vtkSmartPointer<InteractorStyle>::New();
@ -107,6 +108,7 @@ void cv::viz::Viz3d::VizImpl::close()
void cv::viz::Viz3d::VizImpl::recreateRenderWindow() void cv::viz::Viz3d::VizImpl::recreateRenderWindow()
{ {
#if !defined _MSC_VER
//recreating is workaround for Ubuntu -- a crash in x-server //recreating is workaround for Ubuntu -- a crash in x-server
Vec2i window_size(window_->GetSize()); Vec2i window_size(window_->GetSize());
int fullscreen = window_->GetFullScreen(); int fullscreen = window_->GetFullScreen();
@ -118,12 +120,7 @@ void cv::viz::Viz3d::VizImpl::recreateRenderWindow()
window_->SetSize(window_size.val); window_->SetSize(window_size.val);
window_->SetFullScreen(fullscreen); window_->SetFullScreen(fullscreen);
window_->AddRenderer(renderer_); window_->AddRenderer(renderer_);
window_->AlphaBitPlanesOff(); #endif
window_->PointSmoothingOff();
window_->LineSmoothingOff();
window_->PolygonSmoothingOff();
window_->SwapBuffersOn();
window_->SetStereoTypeToAnaglyph();
} }
@ -134,6 +131,12 @@ void cv::viz::Viz3d::VizImpl::spin()
interactor_ = vtkSmartPointer<vtkRenderWindowInteractor>::New(); interactor_ = vtkSmartPointer<vtkRenderWindowInteractor>::New();
interactor_->SetRenderWindow(window_); interactor_->SetRenderWindow(window_);
interactor_->SetInteractorStyle(style_); interactor_->SetInteractorStyle(style_);
window_->AlphaBitPlanesOff();
window_->PointSmoothingOff();
window_->LineSmoothingOff();
window_->PolygonSmoothingOff();
window_->SwapBuffersOn();
window_->SetStereoTypeToAnaglyph();
window_->Render(); window_->Render();
window_->SetWindowName(window_name_.c_str()); window_->SetWindowName(window_name_.c_str());
interactor_->Start(); interactor_->Start();
@ -152,6 +155,12 @@ void cv::viz::Viz3d::VizImpl::spinOnce(int time, bool force_redraw)
interactor_->SetInteractorStyle(style_); interactor_->SetInteractorStyle(style_);
interactor_->AddObserver(vtkCommand::TimerEvent, timer_callback_); interactor_->AddObserver(vtkCommand::TimerEvent, timer_callback_);
interactor_->AddObserver(vtkCommand::ExitEvent, exit_callback_); interactor_->AddObserver(vtkCommand::ExitEvent, exit_callback_);
window_->AlphaBitPlanesOff();
window_->PointSmoothingOff();
window_->LineSmoothingOff();
window_->PolygonSmoothingOff();
window_->SwapBuffersOn();
window_->SetStereoTypeToAnaglyph();
window_->Render(); window_->Render();
window_->SetWindowName(window_name_.c_str()); window_->SetWindowName(window_name_.c_str());
} }

View File

@ -316,6 +316,8 @@ TEST(Viz, show_overlay_image)
viz.getWidget("img1").cast<WImageOverlay>().setImage(lena * pow(sin(i*10*CV_PI/180) * 0.5 + 0.5, 1.0)); viz.getWidget("img1").cast<WImageOverlay>().setImage(lena * pow(sin(i*10*CV_PI/180) * 0.5 + 0.5, 1.0));
viz.spinOnce(1, true); viz.spinOnce(1, true);
} }
viz.showWidget("text2d", WText("Overlay images (stopped)", Point(20, 20), 20, Color::green()));
viz.spin();
} }
@ -356,6 +358,7 @@ TEST(Viz, show_image_3d)
viz.getWidget("img0").cast<WImage3D>().setImage(lena * pow(sin(i++*7.5*CV_PI/180) * 0.5 + 0.5, 1.0)); viz.getWidget("img0").cast<WImage3D>().setImage(lena * pow(sin(i++*7.5*CV_PI/180) * 0.5 + 0.5, 1.0));
viz.spinOnce(1, true); viz.spinOnce(1, true);
} }
viz.showWidget("text2d", WText("Images in 3D (stopped)", Point(20, 20), 20, Color::green()));
viz.spin(); viz.spin();
} }