Hi Luigi, Frank and others,

FYI I am currently using osgswig with a "patched" osg 2.9.5. This patch
consists of reverting the MixinVector stuff from osg 2.6+ with the standard
std:vector alternative in osg 2.4 so osgswig can wrap the VecArrays again. I
have tried this only on linux, and I'm not sure if I break anything in osg
itself by messin' up MixinVector.

Luigi, I am interested in your modifications, could you send them to me so I
can integrate them?

First thing would be to make a list of things that are wrapped or are
ignored. I started working in that direction by using a wrapped version of
osgIntrospection to inspect what's available in the osg libraries and
plugins. Adding unit tests for basic instantiation would be a bonus.

As far as automation of the process goes, I'm keen to see what the
techniques from the new wrapITK could bring us. (
http://code.google.com/p/wrapitk/) My colleagues tell me ITK is bigger a
beast than osg, an heavy on STL templates and nested classes, but that their
Python/Java wrappings are impressive.

As far as (potential) users go, please mail me your name,
company/institution and a use case so I can update "the list" (
http://code.google.com/p/osgswig/wiki/UsingOsgswig). Hopefully we can
convince others (e.g. bosses, colleagues) that working on and working with
osgswig is useful.

regards,
Gerwin


On Tue, Aug 4, 2009 at 4:15 PM, Frank Midgley <[email protected]>wrote:

> On Aug 4, 2009, at 7:55 AM, Luigi Calori wrote:
>
>  I'm unwilling to update as each time I update osg... there are some
>> problems with swig wrapping.
>> One of the worst issues has been the  MixinVector  that has broken all the
>> vecArrays wrapping thus preventing python construction of geometry.
>> I do not know weather Robert is aware of the hassle this mod has caused to
>> osgswig users.
>>
>
>
> I'm still running against OSG 2.6 but was finally able to construct custom
> geometry via Python with code similar to the following:
>
> def vectorArrayFromList(vectorList):
>    from ctypes import *
>    vectorArray = osg.Vec3Array(len(vectorList))
>    arrayPointer =
> pointer(c_float.from_address(int(vectorArray.getDataPointer())))
>    vectorSize = vectorArray.getDataSize()
>    offset = 0
>    for vector in vectorList:
>        for dim in range(3):
>            arrayPointer[offset + dim] = vector[dim]
>        offset += vectorSize
>    return vectorArray
>
> The vectorList argument should be a list of tuples to stick into the array,
> e.g. [(1.0, 2.0, 3.0), (4.0, 5.0, 6.0)].  The trick is to take advantage of
> the Vec3Array constructor that takes just a length argument.  You get a
> vector full of (0.0, 0.0, 0.0) values which you can then replace with real
> data via ctypes.  I adapted this from Randolph Fritz's post to osg-users (<
> http://www.mail-archive.com/[email protected]/msg23368.html
> >).
>
> You can do the same thing for primitive sets:
>
> def primitiveSetFromList(primitiveType, vertexIndexList):
>    from ctypes import *
>    primitiveSet = osg.DrawElementsUInt(primitiveType, len(vertexIndexList))
>    arrayPointer =
> pointer(c_uint.from_address(int(primitiveSet.getDataPointer())))
>    offset = 0
>    for vertex in vertexIndexList:
>        arrayPointer[offset] = vertex
>        offset += 1
>    return primitiveSet
>
> I haven't done massive testing but it's working fine so far on both Mac OS
> X and Win XP…
>
> -Frank
>
> ------------------------------------
> Frank Midgley
> HHMI JFRC - Scientific Computing
> [email protected]
> (571) 209-4629
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to