[vtkusers] VTK for Win64 vs. Win32

Gib Bogle g.bogle at auckland.ac.nz
Mon Feb 13 23:20:35 EST 2012


I'll probably get flack for providing inferior advice, but here goes.  After 
this you're on your own - all responsibility for following my path is yours.  ;-)

In my Qt form I have:

MainWindow             QMainWindow
   centralWidget          QWidget
     stackedWidget     QStackedWidget
       ...
       page_3D             QWidget
         mdiArea_VTK  QMdiArea
       ...
   ...

I doubt very much that this is a good way to do it.  It is the way I hit upon,
and it works for my purposes.

In
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)

I do this:

vtk = new MyVTK(mdiArea_VTK);

where:

#include "myvtk.h"

MyVTK::MyVTK(QWidget *page)
{
     double backgroundColor[] = {0.0,0.0,0.0};

     qvtkWidget = new QVTKWidget(page,QFlag(0));
     LOG_MSG("Created a new QVTKWidget");
     QVBoxLayout *layout = new QVBoxLayout;
     layout->addWidget(qvtkWidget);

     // Associate the layout with page_VTK
     page->setLayout(layout);

     // Create a renderer, and add it to qvtkWidget's render window.
     // The renderer renders into the render window.
     ren = vtkRenderer::New();
     renWin = qvtkWidget->GetRenderWindow();
     renWin->AddRenderer(ren);
     ren->SetBackground(backgroundColor);
     ren->ResetCamera();
     iren = qvtkWidget->GetInteractor();

     vtkSmartPointer<MouseInteractorStyle4> style =
       vtkSmartPointer<MouseInteractorStyle4>::New();
     iren->SetInteractorStyle( style );
     iren->Initialize();
     ...

I'm not sure that all parts of this are working as intended - I recall that 
there were some
things that I didn't sort out.

myvtk.h includes many VTK include files:

#include <QtGui>
#include <QtCore>
#include <QIODevice>
#include <QVTKWidget.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include "vtkSphereSource.h"
#include "vtkCylinderSource.h"
#include "vtkPolyDataMapper.h"
#include "vtkActor.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkProperty.h"
#include "vtkCamera.h"
#include <vtkMPEG2Writer.h>
#include <vtkPNGWriter.h>
#include <vtkJPEGWriter.h>
#include <vtkTIFFWriter.h>
#include <vtkBMPWriter.h>
#include <vtkWindowToImageFilter.h>
#include <vtkSmartPointer.h>
#include <vtkImageCast.h>
#include <vtkPolygon.h>
#include <vtkCellArray.h>
#include <vtkCellData.h>
#include <vtkTextSource.h>
#include <vtkGlyph3D.h>
#include <vtkPointData.h>
#include <vtkPolyData.h>
#include <vtkPoints.h>
#include <vtkPolyDataMapper.h>
#include <vtkUnsignedCharArray.h>
#include <vtkDoubleArray.h>

In the .pro file I have (note that I built VTK static):

INCLUDEPATH += C:\VTK-build-4.4.0-static C:\VTK-build-4.4.0-static\rendering \
                 C:\VTK-src\GUISupport\Qt C:\VTK-src\common C:\VTK-src\rendering \
                 C:\VTK-src\graphics C:\VTK-src\filtering C:\VTK-src\IO \
                 C:\VTK-src\imaging C:\VTK-src\hybrid

FORMS         = bone_GUI.ui
HEADERS       = mainwindow.h qmylabel.h params.h plot.h log.h myvtk.h misc.h \
                 libbone.h result_set.h transfer.h

LIBS += -L"c:\VTK-build-4.4.0-static\bin" -lQVTK -lvtkRendering -lvtkGraphics \
-lvtkImaging -lvtkIO -lvtkFiltering -lvtkCommon \
-lvtkpng -lvtktiff -lvtkjpeg -lvtkexpat -lvfw32 -lopengl32 -lVPIC -lCosmo \
-lwsock32 -lvtksys -lws2_32 -lvtkexoIIc -lvtkNetCDF \
-lvtklibxml2 -lvtkzlib -lpthread -lvtkalglib \
-lgdi32 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 \
-lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32

I'm sure this is not the right way to point to the VTK include files - I didn't 
know better when
I did this.  I think I skipped the "make install" step, which puts all the 
include files
in a single directory somewhere.  Somebody here will provide the proper procedure.

Gib

On 14/02/2012 4:30 p.m., Ahmad wrote:
> Do you use the plugin for QVTKWidget and directly insert or you promote a
> widget to it? How do you include the VTK include files in Qt Creator?
>
> Thanks,
> Ahmad
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/VTK-for-Win64-vs-Win32-tp5480905p5481334.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> 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


-- 
Dr. Gib Bogle
Senior Research Fellow
Auckland Bioengineering Institute
University of Auckland
New Zealand

http://www.bioeng.auckland.ac.nz

g.bogle at auckland.ac.nz
(64-9) 373-7599 Ext. 87030




More information about the vtkusers mailing list