[vtkusers] Trouble with QVTK
Joshua Pedrick
jpedrick at gmail.com
Thu May 21 11:38:18 EDT 2009
Ok, I guess I wasn't clear. I am using CentOS 5.2 64-bit. Qt sdk 2009.02 (Qt
v4.5.1). I've built VTK to include GUISupport and Qt support. I've tried to
replicate the GUI4 example. Using the GUI 4 example I get all the correct
behavior, including changing the background, but I can not see any 3D VTK
objects(cone or sphere) in the RenderWindows. I've the relevent source
files.
So, I was hoping for an example that actually worked or some advice as to
what I have done incorrectly.
Regards,
-Joshua
On Thu, May 21, 2009 at 10:16 AM, Clinton Stimpson <clinton at elemtech.com>wrote:
>
> There are examples in VTK/Examples/GUI/Qt.
> Both SimpleView/ and Events/ have designer .ui files.
>
> Clint
>
> Joshua Pedrick wrote:
>
>> 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<mailto:
>> 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
>> <mailto: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
>> <mailto:jpedrick at gmail.com>>
>> Date: Tuesday, May 12, 2009 3:36 pm
>> Subject: Re: Trouble with QVTK
>> To: vtkusers at vtk.org <mailto:vtkusers at vtk.org>
>> Cc: "L.J. van Ruijven" <L.J.vanRuijven at amc.uva.nl
>> <mailto: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
>> <mailto: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
>> > >
>> > >
>> > >
>> >
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> 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
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
>
>
> _______________________________________________
> 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
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090521/e3bd58a0/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MainWindow.cpp
Type: application/octet-stream
Size: 6157 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090521/e3bd58a0/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MainWindow.h
Type: application/octet-stream
Size: 627 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090521/e3bd58a0/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MainWindow.ui
Type: application/x-designer
Size: 2966 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090521/e3bd58a0/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ui_MainWindow.h
Type: application/octet-stream
Size: 6187 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090521/e3bd58a0/attachment-0002.obj>
More information about the vtkusers
mailing list