[vtkusers] Problem with volume rendering inside of Qt application

Andrea Brambilla andrea.bram at gmail.com
Tue Feb 17 09:11:27 EST 2015


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
> <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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150217/9ce9743e/attachment.html>


More information about the vtkusers mailing list