MSV-Project / MSVTK

Multiscale Visualization ToolKit
https://web.archive.org/web/20141218040109/http://msvtk.org/
Apache License 2.0
14 stars 8 forks source link

Extra rendering view created for each button #40

Open finetjul opened 11 years ago

finetjul commented 11 years ago

On Ubuntu 12.04.1, I build MSVTK in Release mode a) Start vtkbuttons demo b) Load a polydata .vtk file -> the data is correctly loaded. => an extra black window (~100x100) is created in the top left corner of my desktop. an extra window is created for each loaded dataset Screenshot from 2013-02-04 08:36:58

alosi commented 11 years ago

Sorry I accidentally delete the previous comment. I wrote that it happens also on mac osx: It's a problem with VTK offscreen rendering (on linux and osx) that doesn't work properly and shows the rendering window so i think it's a VTK issue.

finetjul commented 11 years ago

You need to build VTK with VTK_OPENGL_HAS_OSMESA on. This can be done in External_VTK.cmake http://www.vtk.org/Wiki/VTK/Examples/Cxx/Utilities/OffScreenRendering However, I'm not sure the off screen rendering is working anyway. I don't see image in the tooltip.

alosi commented 11 years ago

I build VTK with VTK_OPENGL_HAS_OSMESA enabled on Ubuntu but vtkButtons application doesn't work properly: if I load a data the surface and the button are not shown in the rendering window; It seems that offscreen rendering is used for all rendering processes. could you tell me if the application built with osmesa works correctly for you?

Now I'm trying to build it with mangled mesa http://www.vtk.org/Wiki/VTK/OpenGL#OpenGL_.2B_Off_screen

If I build without osmesa the application works properly and the image is shown in the tooltip (but the extra window is created)

finetjul commented 11 years ago

You are right, VTK_OPENGL_HAS_OSMESA doesn't work. There is a fix suggested on the paraview mailing list that can work: http://www.cmake.org/pipermail/paraview/2009-December/014908.html

Can you try to change the line vtkXOpenGLRenderWindow.cxx:642 from

if (this->OwnWindow)

into

if (this->OwnWindow && !this->GetOffScreenRendering() )

Btw, I never manage to get any image in the tooltip, what type of file do you load ?

alosi commented 11 years ago

Thank you! With your fix it works and the extra window is not shown under ubuntu.

To answer your question: I don't load or save image file from disk, I use a buffer with PNG image format:

I get the image as a QImage from msvQVTKButtons https://github.com/MSV-Project/MSVTK/blob/master/Applications/VTKButtons/msvQVTKButtonsMainWindow.cxx#L272

then I write it in a QBuffer with PNG format and I put it in the tooltip with html code https://github.com/MSV-Project/MSVTK/blob/master/Applications/VTKButtons/msvQVTKButtonsMainWindow.cxx#L278

finetjul commented 11 years ago

Can you then push the fix in the MSVTK fork of VTK: https://github.com/MSV-Project/VTK/commits/master

I managed to get the preview show up in the tooltip on my ubuntu computer. I did it by building against a Qt 4.7.3, which means that this feature is broken for Qt 4.6.3 (it was displaying a "file" icon instead of the preview).

Concerning the conversion to base64, you can use ctkWidgetsUtils::base64HTMLImageTagSrc()

alosi commented 11 years ago

Ok. Could you please give me write access to the forked VTK repository?

finetjul commented 11 years ago

Done.