Carsten Neumann wrote:
>       Hello Patrick,
> 
> Patrick Hartling wrote:
>> I am working on porting OpenManip to OpenSG 2, and I have run into a
>> difference WRT OpenSG 1.x that I cannot resolve. In OpenSG 1.x, the
>> following worked (where mRenderAction is an OSG::DrawActionBase*):
>>
>>    OSG::Camera* cam = mRenderAction->getCamera();
>>    OSG::CameraPtr camPtr(cam);
>>
>> I have not found a way to construct an OSG::CameraPtr from an OSG::Camera*,
>> and I am wondering if this is being done by design. In other words, is this
>> prevention of OSG::FCPtr<> construction from a raw pointer deliberate? The
>> closest I came was to try OSG::Camera::constructPtr(), but this method is
>> protected.
>>
>> The OSG::CameraPtr is needed because the pointer is sorted in that form
>> elsewhere in the code. It might be possible to eliminate the need for the
>> OSG::CameraPtr, but since I don't know the internal workings of
>> OSG::FCPtr<>, I do not know how far-reaching the side effects of that may be.
>>
>> Should this be considered a design flaw in OpenManip, or am I just missing
>> how to construct the OSG::CameraPtr that I need?
> 
> the definite answer probably has to come from Gerrit or Dirk, but I
> think constructing that CameraPtr could work like this:
> 
> // probably not needed:
> #include <OpenSG/OSGContainerCreateMixin.h>
> 
> OSG::CameraPtr camPtr =
> OSG::CPtrConstructionFunctions<OSG::Camera::ContainerFactory>::constructPtr(cam);
> 
> I haven't tested this, but it is used in the implementation of
> OSG::FieldContainer::constructPtr() so it should do the right thing.

That's precisely what I needed. Thanks!

Now that I have this final piece in place, OpenManip runs on top of OpenSG
2. However, the time between selecting an object and the manipulators
actually appearing is very, very long, and I need to figure out why that is.

 -Patrick


-- 
Patrick L. Hartling
VP Engineering, Infiscape Corp.
http://www.infiscape.com/

Attachment: signature.asc
Description: OpenPGP digital signature

-------------------------------------------------------------------------
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