[vtkusers] Problem with volume rendering inside of Qt application
Andrea Brambilla
andrea.bram at gmail.com
Wed Feb 18 05:31:19 EST 2015
Right, my bad, vtkOpenGLRenderWindow does not even override New(), so
vtkRenderWindow is actually called.
I use VTK 5.10 and Qt 4.8 on windows 7 x64
The reason why I had to use the GL_ARB_compatibility is that the opengl
compatibility profile seems to be required by the QVTKWidget (I guess). It
also seems that the driver of my graphics card (GeForce GTX 580) disables
the compatibility profile by default.
Notice that, if I use only VTK (without Qt), everything works fine without
explicitly loading the compatibility profile.
Also, if I run the same code (with QVTKWidget) on my laptop (which has an
older graphics card) I don't need to load the compatibility profile either.
On Tue, Feb 17, 2015 at 6:36 PM, Aashish Chaudhary <
aashish.chaudhary at kitware.com> wrote:
> On Tue, Feb 17, 2015 at 11:12 AM, Ernesto Guevara <elguevara at uci.cu>
> wrote:
>
>> Hi, I'm afraid cannot use OpenGL2 backend since I'm using VTK 5.10, is
>> there any other way to do this???
>> I tried Andrea’s solution but I’m getting the message that the
>> application couldn’t load the GL_ARB_compatibility extension. I checked
>> with glxinfo and that extension is supported in my system, I can render the
>> volume quite well without QT. I’m using VTK 5.10 with Ubuntu 14.10. do to
>> this I cannot use QVTKWidget2.
>> I can’t use vtkOpenGLRenderWindow because it is an abstract class I used
>> vtkGenericOpenGLRenderWindow.
>> I’ll keep trying.
>>
>
> You shouldn't use the vtkOpenGLRenderWindow class, just use the
> vtkRenderWindow::New() which will create the concrete class for you. You
> may want to debug why its loading the compatability profile.
>
>
>>
>> Thanks
>> Ernesto
>>
>> PS: I just sent this message to Andrea, sorry about duplicates.
>>
>> De: Andrea Brambilla [mailto:andrea.bram at gmail.com]
>> Enviado el: Tuesday, February 17, 2015 9:11 AM
>> Para: Aashish Chaudhary
>> CC: Ernesto; vtkusers at public.kitware.com
>> Asunto: Re: [vtkusers] Problem with volume rendering inside of Qt
>> application
>>
>> I had a similar issue with QVTKWidget some time ago, which was due to
>> OpenGL
>> I solved the issue by checking for the available extensions when creating
>> the QVTKWidget:
>>
>> QVTKWidget* createQVTKWidget(QWidget *parent)
>> {
>> // create a RenderWindow and loads the compatibility profile on it
>> auto extManager= vtkSmartPointer<vtkOpenGLExtensionManager>::New();
>> auto renWin = vtkOpenGLRenderWindow::New();
>> extManager->SetRenderWindow(renWin);
>> if(extManager->ExtensionSupported("GL_ARB_compatibility" ) != 0)
>> extManager->LoadExtension("GL_ARB_compatibility");
>> else
>> ep::log << "Warning: GL_ARB_compatibility extension cannot be
>> loaded" << endl;
>>
>> // Create and add a renderer to the managed render window
>> auto ren = vtkOpenGLRenderer::New();
>> ren->SetBackground(1, 1, 1);
>> renWin->AddRenderer(ren);
>> /// Create the QVTKWidget and adds the managed render window to it
>> auto outWidget = new QVTKWidget(parent);
>> outWidget->SetRenderWindow(renWin);
>>
>> assert(renWin->GetInteractor());
>> renWin->Delete();
>> ren->Delete();
>> return outWidget;
>> }
>>
>> On Tue, Feb 17, 2015 at 2:57 PM, Aashish Chaudhary <
>> aashish.chaudhary at kitware.com> wrote:
>> If you are using older version of volume mapper (OpenGL backend) then it
>> is possible that when using QT window, it's not finding the extensions its
>> needed. Is it possible for you to try the OpenGL2 backend?
>>
>> Also, Do you see any error message on the console?
>>
>> Thanks,
>>
>>
>> On Mon, Feb 16, 2015 at 4:59 PM, Ernesto <elguevara at uci.cu> wrote:
>> Jakub Łągwa <kubalagwa <at> gmail.com> writes:
>>
>> >
>> > Hello,
>> > I have a strange problem with showing VTK volume in QVTKWidget. I can
>> compile example such as as:
>> >
>> http://vtk.org/gitweb?p=VTK.git;a=blob;f=Examples/Medical/Cxx/Medical4.cxxand
>>
>>
>> > it work fine. But when I want to use exactly the same code in my sample
>> > Qt application (let's say - render only after user press a button)
>> > nothing is shown in QVTKWidget (I tried also with QVTKInteractor instead
>> > of the one from example). I have this problem only when I want to use
>> > vtkVolume and than add the volume to renderer with AddVolume. If I make
>> > other 3D visualisation for example with vtkContourFilter and than I add
>> > it to renderer with AddActor method - everything works fine.
>> > I was trying to solve this problem for a couple of days but I found
>> > some things that I can't understand in any way. If I take, for example,
>> > Medical4.cxx file and add there
>> > #include <QApplication>
>> > and than
>>
>>
>> Hello Jakub I have the same problem with QVTKWidget and can't find a
>> solution I've been stopped for 4 days. I need to know whether you managed
>> to
>> solve this problem and how did you solved it.
>>
>> Thanks in advance.
>> Ernesto
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtkusers
>>
>>
>>
>>
>> --
>> | Aashish Chaudhary
>> | Technical Leader
>> | Kitware Inc.
>> | http://www.kitware.com/company/team/chaudhary.html
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtkusers
>>
>>
>>
>
>
> --
>
>
>
> *| Aashish Chaudhary | Technical Leader | Kitware Inc. *
> *| http://www.kitware.com/company/team/chaudhary.html
> <http://www.kitware.com/company/team/chaudhary.html>*
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150218/5760559a/attachment.html>
More information about the vtkusers
mailing list