Hello Patrick,

Patrick Hartling wrote:
> Are there any tips or guidelines for porting OpenSG 1.x code to 2? In
> particular, I want to port the manipulators, which includes a few different
> field containers. I started looking into it yesterday but got stuck pretty
> quickly because, honestly, I don't know where to begin or what sorts of
> things to expect.

hm, there should not be too much to do hopefully. Removing beginEditCP,
endEditCP and understanding where to call commitChanges is probably a
starting point and might be sufficient for the manipulators. More work
is probably needed in the OSGSimpleGeometryExt files to adapt them to
the different indexing used for geometry - I haven't looked into these,
so there might not be much to do.
The general advice is that it's now the users responsibility to call
commitChanges before accessing values that change in response to setting
a fields value. Another thing to pay attention to is the usage of Field*
because fields do not have virtual methods anymore.

> The first thing I did (after copying the code into the OpenSG 2 source tree
> under Source/System/Manipulators) was to try running fcd2code on one of the
> .fcd files. This did nothing, so I can only assume that I am not running
> fcd2code correctly. I ran it from Source/System/Manipulators as shown below:
> 
>    ../../../Tools/fcd2code/fcd2code -dOSGManipulator.fcd

to actually get any output you have to pass -f (to create the
OSB<FCName>.{cpp,h,inl} files -- almost never what you want) or -b (to
create the OSG<FCName>Base.{cpp,h,inl}, OSG<FCName>Fields.h> files).
Also -r option is usually required, otherwise the template files are not
found.

../../../Tools/fcd2code/fcd2code -dOSGManipulator.fcd -b -r
/opt/devel/opensg2/trunk

would be the line to use on my machine where I have a checkout of the
trunk in /opt/devel/opensg2/trunk. Running fcd2code with -h, --help or
no options prints a help message.

> I also ran the convScript tool on the whole Manipulators directory, and no
> changes were made to the code. If my interpretation of the available
> operations is correct, then this outcome is not surprising.

yeah, it does not do much unless the basic math functions are used.

> If nothing else, what would be very helpful is to get a tip about what code
> in OpenSG 1.x and 2 that I could compare as a way to see what changes need
> to be made. Of course, if there is something about porting the OpenSG 1.x
> manipulators to OpenSG 2 would make this a wasted effort, knowing that would
> be good, too. :)

Hm, pick any container that is in both versions, I just looked at
Billboard and there not many changes were necessary. To see the
RenderTraversalAction callback look into
Source/System/Action/RenderTraversal/OSGRenderTraversalActionInit.cpp

        Hope it helps,
                Carsten

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to