[vtkusers] Trouble with QVTK
Joshua Pedrick
jpedrick at gmail.com
Thu May 21 10:08:30 EDT 2009
Does anyone have a working example using QVTK + QtDesigner on Linux that I
could try to compare?
On Tue, May 12, 2009 at 1:16 PM, Joshua Pedrick <jpedrick at gmail.com> wrote:
> Hello again Leo,
> Here's my code once again, but distilled and reordered a bit. I
> removed all the Deletes and whatnot. I'm still not getting anything but the
> gradient background. Any clues?
> I downloaded and compiled VTK-5.4 with QVTK, using Qt version 4.5.1
> from Qt SDK 2009.02. Still no luck. So the latest VTK from CVS and version
> 5.4 aren't working. I can't be the only one using QVTK. I am not using cmake
> to build my project, could this be the problem? Are there some compiler
> flags I need to set for QVTK to work?
>
> Regards,
> -Joshua
>
> void MainWindow::SetupScene()
> {
> QVTKWidget* qvtkwidget = ui.qvtkWidget;
>
> qvtkwidget->GetRenderWindow()->DoubleBufferOff();
>
> //Put cone in window
> {
> vtkConeSource *cone = vtkConeSource::New();
>
> //Create Cone Mapper.
> vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();
> coneMapper->SetInputConnection(cone->GetOutputPort());
>
> //Create Cone Actor
> vtkActor *coneActor = vtkActor::New();
> coneActor->SetMapper(coneMapper);
>
> //Create Cone Renderer
> vtkRenderer *ren = vtkRenderer::New();
> ren->SetBackground(0,0,0);
> ren->SetBackground2(1,1,1);
> ren->GradientBackgroundOn();
>
> ren->AddActor(coneActor);
>
> qvtkwidget->GetRenderWindow()->AddRenderer(ren);
>
> }
>
> }
>
> 2009/5/12 L.J. van Ruijven <L.J.vanRuijven at amc.uva.nl>
>
>> Hi Joshua,
>>
>> I allready deleted your first mail, so I cannot check the code again, but
>> I think here the background renderer is added. So that one is really drawn
>> in the render window.
>> But if I remember well, you created the pipeline for the cone in a
>> separate fragment. And in the end of this fragment you deleted the cone
>> renderer, but you never added it to the render window.
>>
>> regards,
>>
>> Leo.
>>
>>
>> ----- Original Message -----
>> From: Joshua Pedrick <jpedrick at gmail.com>
>> Date: Tuesday, May 12, 2009 3:36 pm
>> Subject: Re: Trouble with QVTK
>> To: vtkusers at vtk.org
>> Cc: "L.J. van Ruijven" <L.J.vanRuijven at amc.uva.nl>
>>
>>
>> > L.J. I think I do this in MainWindow::SetupScene() at the very end:
>> >
>> > qvtkwidget->GetRenderWindow()->AddRenderer(ren);
>> > qvtkwidget->GetRenderWindow()->BordersOn();
>> >
>> > ren->Delete();
>> >
>> > Is this not the correct way to add a renderer? I do get the lovely
>> gradient
>> > background I applied to the renderer, but no actors. The gradient
>> background
>> > makes me think the renderer is properly connected to the render window.
>> >
>> > I'm going to compile the stable version of VTK today and see how it
>> goes.
>> > I'm really suspecting there is a bug in the CVS QVTK.
>> >
>> > Regards
>> > -Joshua
>> >
>> > 2009/5/12 L.J. van Ruijven <L.J.vanRuijven at amc.uva.nl>
>> >
>> > > Hi Joshua,
>> > >
>> > > I think you forgot to connect the renderer to the renderwindow.
>> Somewhere
>> > > you should add the statement renWin->AddRenderer(ren).
>> > >
>> > > regards,
>> > >
>> > > Leo
>> > >
>> > >
>> > >
>> >
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090521/83bca1d0/attachment.htm>
More information about the vtkusers
mailing list