[vtkusers] VTK 6.0 with Visual Studio

Joseph Melnyk JMelnyk at pile.com
Fri Jul 26 12:31:04 EDT 2013


Indeed it does.  After I got this working, I did some digging into how exactly CMake had set the project up.  The main difference was that instead of having the #define AUTOINIT lines within all the headers which use VTK, the AUTOINITS were simply in an external .h file, which was then fed into the preprocessor and vtkRenderingCore_INCLUDE was also defined.  Once I tried this, everything worked great within my test project as well as the project I was trying to migrate to VTK 6.

To clarify for anyone else trying this, my project now has the following lines in the Preprocessor Definitions:
vtkRenderingCore_INCLUDE=\"$(ProjectDir)\vtkRenderingCore_AUTOINIT_vtkInteractionStyle_vtkRenderingFreeType_vtkRenderingFreeTypeOpenGL_vtkRenderingOpenGL.h\"
vtkRenderingVolume_AUTOINIT=1(vtkRenderingVolumeOpenGL)

Where the .h file referenced exists in my ProjectDir with only the following line:
#define vtkRenderingCore_AUTOINIT 4(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingFreeTypeOpenGL,vtkRenderingOpenGL)

My include and lib directories are set up as normal (no references to CMake build directory, etc.).  Seems there may be a *slightly* cleaner way of doing this, but I'm going to leave it alone for now.

Thanks for the help!
 



From: Bill Lorensen [mailto:bill.lorensen at gmail.com] 
Sent: Thursday, July 25, 2013 2:09 PM
To: Joseph Melnyk
Cc: Frédéric Speisser; vtkusers at vtk.org
Subject: Re: [vtkusers] VTK 6.0 with Visual Studio

If you use cmake to configure the example, does it work?

On Thu, Jul 25, 2013 at 2:02 PM, Joseph Melnyk <JMelnyk at pile.com> wrote:
OK.  I tried this and it's now giving the expected behavior of returning a NULL object from the New() call for vtkPolyDataMapper.  The vtkSphereSource allocation and use works fine, however.  This occurs both with and without the AUTOINIT lines.
 
Previously, I was using a chart/plotting example from the wiki found here: http://www.vtk.org/Wiki/VTK/Examples/Cxx/Plotting/LinePlot.  There, the usage of vtkTable and vtkFloatArray worked fine but it would then give me the previously described access violation exception when I tried to create vtkContextView.
 
I'm not doing this with CMake, by the way; this is all within VS2008, with VTK6 referenced and linked the way I've always used VTK5.x
 
Joseph
 
 
 
 
From: Bill Lorensen [mailto:bill.lorensen at gmail.com] 
Sent: Thursday, July 25, 2013 1:19 PM

To: Joseph Melnyk
Cc: Frédéric Speisser; vtkusers at vtk.org
Subject: Re: [vtkusers] VTK 6.0 with Visual Studio
 
Could you try one of the wiki examples?

http://vtk.org/Wiki/VTK/Examples/Cxx/GeometricObjects/Sphere
Follow the download instructions on the page.
 
On Thu, Jul 25, 2013 at 10:32 AM, Joseph Melnyk <JMelnyk at pile.com> wrote:
Bill
I have a small example that compiles and exhibits the same behavior.  I set it up as a VS2008 project, however even after being compressed it's still 5MB.  Obviously I don't want to flood inboxes with this.  Would you like me to send it to you directly or possibly just post the code from it and leave the project setup details aside?
 
Thanks
Joseph
 
 
 
 
From: Bill Lorensen [mailto:bill.lorensen at gmail.com] 
Sent: Tuesday, July 23, 2013 11:29 AM
To: Joseph Melnyk
Cc: Frédéric Speisser; vtkusers at vtk.org

Subject: Re: [vtkusers] VTK 6.0 with Visual Studio
 
1) Can you provide a small, compilable example that fails?
2) You could try some of the VTK Wiki Examples.
http://www.vtk.org/Wiki/VTK/Examples
3) Find one that uses a class that is failing.
    for example, in google search:
site:vtk.org/Wiki/VTK/Examples vtkImageViewer2
 
On Tue, Jul 23, 2013 at 11:24 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
Have you run one of the failing programs in the VS debugger?
 
On Tue, Jul 23, 2013 at 11:10 AM, Joseph Melnyk <JMelnyk at pile.com> wrote:
Thanks for your suggestion.  This is the definition I tried when I mentioned definition of VTK AUTOINIT.  The links you mentioned, and the ones I did, all discuss this within the context of the New() function returning a NULL value, however, not generating an exception.  As I said, I tried them anyway with no success.
Joseph Melnyk
 
From: Frédéric Speisser [mailto:speisser at kappaeng.com] 
Sent: Tuesday, July 23, 2013 9:56 AM
To: Joseph Melnyk
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] VTK 6.0 with Visual Studio
 
Hello,

When I ported VTK 5.9.1 to VTK 5.6, I encountered such issues maybe you are encountering the same, ensure you've done following :
o   extra definitions must be added in preprocessor settings : 
To have the os/rendering system  dependent classes created,  following macro must be set : 
#define vtkRenderingCore_AUTOINIT 4(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingFreeTypeOpenGL,vtkRenderingOpenGL)

or a reference to a file, containing the previous macro, like this must be added in preprocessor definitions :
vtkRenderingCore_INCLUDE="vtkRenderingCore_AUTOINIT_vtkInteractionStyle_vtkRenderingFreeType_vtkRenderingFreeTypeOpenGL_vtkRenderingOpenGL.h"

Hope that helps !

P.S. Links which were useful to me :

http://www.vtk.org/Wiki/VTK/VTK_6_Migration_Guide
http://www.visitusers.org/index.php?title=VTK_6.0_Upgrade 


Le 23/07/2013 15:14, Robert Maynard a écrit :
Are you able to provide more information on the exact violation
exceptions with a back trace? Access violations can occur when you
call methods on a NULL object, so it could be a case that a object
factory that is NULL is being asked to create classes.
 
On Mon, Jul 22, 2013 at 2:45 PM, Joseph Melnyk <JMelnyk at pile.com> wrote:
I'm attempting to port an existing code base from VTK 5.10 to 6.0.  This code base has existed and worked happily with VTK 5.x for a few years now, being built with Visual Studio 2008.  When I began the port to 6.0, I followed the migration guide found here: http://www.vtk.org/Wiki/VTK/VTK_6_Migration_Guide and the code builds and links just fine.  However, when I run it, I'm getting access violation exceptions (attempts to read/write protected memory) when I try instantiating with New().  Researching further, I see that this problem is mentioned here: http://www.vtk.org/Wiki/VTK/VTK_6_Migration/Factories_now_require_defines  HOWEVER I'm not getting NULL objects with the New() call, I'm getting exceptions.  Furthermore, it doesn't happen with ever
 y VTK o
bject; some instantiate and can be used just fine.  Nonetheless, I tried the suggestions at the second link, regarding definition of VTK AUTOINIT, and they proved fruitless.  So I'm currently at a loss...
 
For what it's worth, I'm building VTK with CMAKE and the only options I'm changing from the default configuration are the following:
- build shared libs
- don't build TESTING
- set custom install directory
 
Thanks for your time; any help would be greatly appreciated...
Joseph Melnyk
 
__Scanned by MessageLabs
_______________________________________________
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
.
 


_Scanned by MessageLabs

__Scanned by MessageLabs

_______________________________________________
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



-- 
Unpaid intern in BillsBasement at noware dot com



-- 
Unpaid intern in BillsBasement at noware dot com

_Scanned by MessageLabs

__Scanned by MessageLabs



-- 
Unpaid intern in BillsBasement at noware dot com

_Scanned by MessageLabs

__Scanned by MessageLabs



-- 
Unpaid intern in BillsBasement at noware dot com

_Scanned by MessageLabs

__Scanned by MessageLabs



More information about the vtkusers mailing list