[vtkusers] Access violation only when using VTK through Unreal Engine 4.

Magnus Elden magnus_elden at hotmail.com
Fri Jul 29 10:53:15 EDT 2016


Access violation - code c0000005 (first/second chance not available)

 

UE4Editor_ViveTest_3713!vtkFixedPointVolumeRayCastMapper::vtkFixedPointVolum
eRayCastMapper()

UE4Editor_ViveTest_3713!vtkFixedPointVolumeRayCastMapper::New()

UE4Editor_ViveTest_3713!vtkSmartVolumeMapper::vtkSmartVolumeMapper()

UE4Editor_ViveTest_3713!vtkSmartVolumeMapper::New()

UE4Editor_ViveTest_3713!vtkSmartPointer<vtkSmartVolumeMapper>::New()
[c:\users\noobsdesroobs\documents\unreal
projects\vivetest\thirdparty\vtk\include\vtk-7.0\vtksmartpointer.h:117]

UE4Editor_ViveTest_3713!AVTKVolumeActor::Render()
[c:\users\noobsdesroobs\documents\unreal
projects\vivetest\source\vivetest\vtkvolumeactor.cpp:118]

 

This is the error I get when I execute this code:

       // Process each file on the command line

       vtkSmartPointer<vtkImageData> imageData =

              vtkSmartPointer<vtkImageData>::New();

       vtkSmartPointer<vtkXMLImageDataReader> reader =

              vtkSmartPointer<vtkXMLImageDataReader>::New();

       reader->SetFileName(path.c_str());

       reader->Update();

       reader->GetOutput()->Register(reader);

       imageData->ShallowCopy(reader->GetOutput());

       vtkSmartPointer<vtkSmartVolumeMapper> volumeMapper =
vtkSmartPointer<vtkSmartVolumeMapper>::New();

 

It fails at the last line.

 

What makes me wonder why I get the error above is that it works when I am
using this code in a standalone project just fine and that the New() static
function has been used and did not crash.

I built the library from the VTK 7.0 source using VC14 and then included it
as normal in my UE4 project. However, the UE4 project crashes with this
error being printed to terminal:

 

http://puu.sh/qiF7t/25c8fc6a4d.png

 

I have no idea why it is talking about the source file and I have no idea
why it works outside the UE4 environment and not inside. 

Naturally, that should mean that the problem lies with UE4, but I have used
other libraries just fine and I managed to run the code above if I removed
the last line. I also know why such an exception is thrown, but I don't see
why it is thrown when the include path, lib path and lib files are all the
same. 

 

Thank you for your help.

 

Yours,

Magnus Elden

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160729/f5eaf96e/attachment.html>


More information about the vtkusers mailing list