wiki:Tutorial/OpenSG2/PortingFrom1Tips

Chapter Overview

  1. Porting from 1.x Tips

<< Previous Chapter: Debugging Tips Tutorial Overview

Porting from 1.x Tips

This list of porting tips is based on the experience of Christian Bar moving a windows application from 1.x to 2.0.

To simplify some of the porting tasks OpenSG 2 was compiled with the OSGCOMPAT_ENABLE flag to cmake (cmake -DOSGCOMPAT_ENABLE=ON).

  • remove all beginEditCP/endEditCP/CPEdit calls, they are now automatically handled
  • Ptrs and RefPtrs are now renamed to RecPtrs, use them from now on
  • Geometry properties are changed: they are now something like GeoUInt8PropertyRefPtr for the type, GeoUInt32PropertyRefPtr for lengths and indices, GeoPnt3fPropertyRefPtr for positions, GeoVec3fPropertyRefPtr for colors and normals, and so on
  • multi-indexed geometry indices are now handled differently: you must use geo->setIndex(someIndices, Geometry::ColorsIndex), geo->setIndex(someOtherIndices, Geometry::TexCoordsIndex) and so on
  • BoundingVolume does not exists anymore: use BoxVolume instead
  • TextureChunk does not exists anymore: use TextureObjChunk and TextureEnvChunk instead
  • !SHLChunk does not exists anymore: use !SimpleSHLChunk instead
  • CubeTextureChunk does not exists anymore: use CubeTextureObjChunk instead
  • ImageBackground does not exists anymore: use TextureBackground instead
  • !TextTXFFace and TextPixmapFace are now RecPtrs and not simple C++ pointers, you don't need to addRef and subRef them anymore
  • Thread and Barrier are now RecPtrs and not simple C++ pointers
  • GraphOp child classes and GraphOpSeq are now RecPtrs and not simple C++ pointers
  • Thread::getCurrentChangeList()->clearAll() does not exist anymore: use Thread::getCurrentChangeList()->clear() or Thread::getCurrentChangeList()->commitChangesAndClear()
  • material->isMultiPass() does not exist anymore: try a dcast instead
  • traverse method is changed, the new syntax is something like traverse(node, boost::bind(&YourNamespace::YourClass,YourMethod, this, _1)); YourMethod parameter is now a Node * and not a NodePtr
  • use OSG::commitChanges() when you want to apply che changelist to the aspects (eg. to update the BoxVolumes)
  • you need to substitute makeSphere() with makeLatLongSphere() to preserve texture coordinates
  • I had to change the preprocessor defines of my applications and add to them "OSG_DEBUG;OSG_DEBUGRT;OSG_BUILD_ACTIVE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_SECURE_SCL=0;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE" to make the release version work
  • a lot of class->getSomething() methods do not exist anymore, use the class->editSomething() call instead
  • point-to-vector and vector-to-point conversions are more restrictive, use point.subZero() and vector.addToZero() calls
  • ShadowViewport does not exists anymore, you need to manage shadow rendering using stages (see the tutorials)
  • under Windows if you want to read and write images or 3D models you need to call OSG::preloadSharedObject("OSGFileIO") and OSG::preloadSharedObject("OSGImageFileIO") before calling osgInit()
  • OpenSG 2.0 is split in several dlls, remember to link them all

<< Previous Chapter: Debugging Tips Tutorial Overview
Last modified 5 years ago Last modified on 10/05/11 00:28:39