Discussion:
[Opensg-users] OpenSG 2: Porting to VC12
Johannes Brunen
2014-08-08 10:24:20 UTC
Permalink
Hello,



I'm in the process of porting our application to the MS Visual Studio
2013 (a.k.a. VC12) compiler and have found some minor problems.



1. In file opensg\Source\System\Cluster\Window\Base\OSGClusterWindow.cpp
at line 235 I have changed

from

SFATAL << "Error starting: " << command << std::endl;

to

SFATAL << "Error starting: " << command.str() <<
std::endl;



because I got the following error message:

...\OSGClusterWindow.cpp(235): error C2678: binary '<<' : no operator
found which takes a left-hand operand of type
'std::basic_ostream<char,std::char_traits<char>>' (or there is no
acceptable conversion)



2. The next two issues are relevant only because I switched to VTK 6.1:



a) CMakeLists.txt line 735

I changed the line

from

OSG_SET(OSG_VTK_LIBS
"vtkCommon;vtkFiltering;vtkGraphics;vtkIO;vtkRendering")

to

include(${VTK_USE_FILE})

OSG_SET(OSG_VTK_LIBS "${VTK_LIBRARIES}")



b) opensg\Source\Contrib\VTK\OSGVTKPolyDataMapper.cpp line 394

I changed the line

from

pMapper->GetInput()->Update();

to

#ifdef OSG_WITH_VTK_6

pMapper->Update();

#else

pMapper->GetInput()->Update();

#endif



and added a the flag OSG_WITH_VTK_6. I'm not sure if this change is
semantically correct, but at least it compiles fine :-)



3. The last issue is not related to the port. I compile and update all
the support libraries independent of OpenSG. Especially, OpenEXR is
compiled as a dynamic link library in my setup. Therefore the
OPENEXR_DLL flag must be set. However, the OSGConfigurePackages.cmake
forces the OPENEXR_USE_DLL option to be OFF which in turn forces not to
the the OPENEXT_DLL flag. Currently, I change the generated
CMakeCache.txt file, but it would be fine to have at least an option for
the flag.



No other problems so far...



Best,

Johannes
Carsten Neumann
2014-08-12 08:07:50 UTC
Permalink
Hello Johannes,
Post by Johannes Brunen
1. In file opensg\Source\System\Cluster\Window\Base\OSGClusterWindow.cpp
at line 235 I have changed
from
SFATAL << "Error starting: " << command << std::endl;
to
SFATAL << "Error starting: " << command.str() <<
std::endl;
fixed.
Post by Johannes Brunen
a) CMakeLists.txt line 735
from
OSG_SET(OSG_VTK_LIBS
"vtkCommon;vtkFiltering;vtkGraphics;vtkIO;vtkRendering")
to
include(${VTK_USE_FILE})
OSG_SET(OSG_VTK_LIBS "${VTK_LIBRARIES}")
Ok, this probably changes the set of libraries we link with. On the
other hand IIRC this case is used for when picking up whatever libs are
installed in the system and not assuming they were built with settings
that are compatible with the OpenSG build - in other words this is
probably a harmless change to make ;)
Post by Johannes Brunen
b) opensg\Source\Contrib\VTK\OSGVTKPolyDataMapper.cpp line 394
#ifdef OSG_WITH_VTK_6
pMapper->Update();
#else
pMapper->GetInput()->Update();
#endif
and added a the flag OSG_WITH_VTK_6. I'm not sure if this change is
semantically correct, but at least it compiles fine :-)
hmm, I suspect it does change the meaning (not sure though), but I'm
wondering more why this is necessary? At least according to the docs
vtkMapper::GetInput() has not been removed in vtk 6.
Could you post the error message?
Post by Johannes Brunen
3. The last issue is not related to the port. I compile and update all
the support libraries independent of OpenSG. Especially, OpenEXR is
compiled as a dynamic link library in my setup. Therefore the
OPENEXR_DLL flag must be set. However, the OSGConfigurePackages.cmake
forces the OPENEXR_USE_DLL option to be OFF which in turn forces not to
the the OPENEXT_DLL flag. Currently, I change the generated
CMakeCache.txt file, but it would be fine to have at least an option for
the flag.
You should have OPENEXR_USE_DLL show up as an option in your cmake
configuration; the line OSG_OPTION(OPENEXR_USE_DLL OFF) just sets the
default value.

Thanks for the report,

Cheers,
Carsten
Johannes
2014-08-12 14:52:22 UTC
Permalink
Hello Carsten,
Post by Carsten Neumann
Post by Johannes Brunen
b) opensg\Source\Contrib\VTK\OSGVTKPolyDataMapper.cpp line 394
#ifdef OSG_WITH_VTK_6
pMapper->Update();
#else
pMapper->GetInput()->Update();
#endif
and added a the flag OSG_WITH_VTK_6. I'm not sure if this change is
semantically correct, but at least it compiles fine :-)
hmm, I suspect it does change the meaning (not sure though), but I'm
wondering more why this is necessary? At least according to the docs
vtkMapper::GetInput() has not been removed in vtk 6.
Could you post the error message?
No, not currently. But the vtkDataObject does not have an Update()
method anymore.

See:
http://www.vtk.org/Wiki/VTK/VTK_6_Migration_Guide
http://www.vtk.org/Wiki/VTK/VTK_6_Migration/Removal_of_Methods_for_Manipulating_Update_Extent
Post by Carsten Neumann
You should have OPENEXR_USE_DLL show up as an option in your cmake
configuration; the line OSG_OPTION(OPENEXR_USE_DLL OFF) just sets the
default value.
Ok, I will try this option :-)

Best,
Johannes
Carsten Neumann
2014-08-18 11:59:43 UTC
Permalink
Hello Johannes,
Post by Johannes
Post by Carsten Neumann
hmm, I suspect it does change the meaning (not sure though), but I'm
wondering more why this is necessary? At least according to the docs
vtkMapper::GetInput() has not been removed in vtk 6.
Could you post the error message?
No, not currently. But the vtkDataObject does not have an Update()
method anymore.
ah, of course, I managed to confuse myself about which type had the
function removed.
Post by Johannes
http://www.vtk.org/Wiki/VTK/VTK_6_Migration_Guide
http://www.vtk.org/Wiki/VTK/VTK_6_Migration/Removal_of_Methods_for_Manipulating_Update_Extent
Thanks for these links. Reading a bit about the upgrade recommendations
it seems to me we can just unconditionally change it to
_pMapper->Update() - that works with 5 and 6.
Alternatively we can just guard this with VTK_MAJOR_VERSION >= 6, since
the code is only compiled when VTK is available and thus avoid adding
more custom defines :)
I've committed the change, thanks!

Cheers,
Carsten

Loading...