Skip to content
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

Add the ability to set custom render window and renderer for pcl_visualizer #1989

Closed
denix56 opened this issue Sep 5, 2017 · 7 comments
Closed

Comments

@denix56
Copy link
Contributor

denix56 commented Sep 5, 2017

Hi all.
I started working on it due to that pcl visualizer does not work correctly with new QVTKOpenGLWidget. It requires vtkGenericOpenGLRenderWindow.
I propose to add the constructor, that takes the smart pointers to render window and renderer and assigns them to internal pointers
PCLVisualizer(int &argc, char **argv, const std::string &name, vtkSmartPointer<vtkRenderWindow>& win, vtkSmartPointer<vtkRenderer>& renderer, PCLVisualizerInteractorStyle* style = PCLVisualizerInteractorStyle::New(), const bool create_interactor = true);

But there is small problem - in such signature we miss the default parameter for name. But i think the it will be not a problem for users to set it.

@taketwo
Copy link
Member

taketwo commented Sep 5, 2017

Hi, before we can jump into the discussion, I would like to have a better understanding of the problem we are addressing:

  • by "new" QVTKOpenGLWidget which one do you mean (VTK/Qt version)?
  • what exactly means "does not work"?
  • short example project that demonstrates the problem (you can upload it as a Gist)
  • any relevant information including tutorial links that are obsolete (provide code that does not work with new widget)

@denix56
Copy link
Contributor Author

denix56 commented Sep 5, 2017

http://pointclouds.org/documentation/tutorials/qt_visualizer.php
If we follow this tutorial and write our code base on it we get

 // Set up the QVTK window
  viewer.reset (new pcl::visualization::PCLVisualizer ("viewer", false));
  ui->qvtkWidget->SetRenderWindow (viewer->getRenderWindow ());
  viewer->setupInteractor (ui->qvtkWidget->GetInteractor (), ui->qvtkWidget->GetRenderWindow ());
  ui->qvtkWidget->update ();

And crashes with debug message saying that the vtkGenericOpenGLRenderWindow is required, but vtkWin32OpenGLRenderWindow was received.

I meant by 'new' that QVTKOpenGLWidget was added after qVTKWidget and requires Qt 5.4

@taketwo
Copy link
Member

taketwo commented Sep 5, 2017

What are the reasons to not use the "classical" QVTKWidget?

@denix56
Copy link
Contributor Author

denix56 commented Sep 5, 2017

QVTKOpenGLWidget is intended to be a replacement for QVTKWidget when using Qt 5, also it has features, that might be used in my project.

Also, I have found better solution - make win_ and some other fields protected instead of private and implement new class based on PclVisualizer.

@denix56
Copy link
Contributor Author

denix56 commented Sep 6, 2017

Also, it will give us the ability to use the visualizer in VR with vtkExternalOpenGLRenderWindow

@taketwo
Copy link
Member

taketwo commented Sep 6, 2017

Quick googling about QVTKOpenGLWidget vs. QVTKWidget does not yield many results. Basically, the only information I found is this passage from the release notes of VTK 8:

The new QVTKOpenGLWidget leverages Qt’s new OpenGL context creation mechanism and is meant to be a replacement for QVTKWidget for Qt5. Note that as of release time there are unresolved transparency related bugs that show up with this new Qt5 enabling class on some platforms.

Additionally, I see this list of changes, with multiple bugfixes for QVTKOpenGLWidget, from which I conclude that it is quite unstable.

With this in mind, keeping PCLVisualizer compatible with QVTKWidget is the priority. If there is an easy and non-intrusive way to let users couple it with the new QVTKOpenGLWidget, then let's do this.

@denix56
Copy link
Contributor Author

denix56 commented Sep 6, 2017

Ok, I will start working on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants