[osg-users] Correct way to set auto scale with osg::AutoTransform

Victoria Rudakova vicrucann at gmail.com
Thu Mar 17 11:02:00 PDT 2016


Dear OSG community,

I am trying to set auto scale property of osg::AutoTransform variable. I
would like to achieve such an effect that whatever the viewing camera
position and its distance from a certain geometry, the geometry's size
would not change.

As an example geometry, I have this pyramid:

[image: Inline image 1]

I found an example "osgautotransform"
http://trac.openscenegraph.org/projects/osg//browser/OpenSceneGraph/trunk/examples/osgautotransform/osgautotransform.cpp

that seem to have an element of what I need. I tried to use the same
commands, for example:

*osg*::AutoTransform* at = *new* osg::AutoTransform;
at->addChild(geode); // geode constains my pyramid geometry and color
at->setAutoScaleToScreen(true);
at->setMinimumScale(1); // some test values
at->setMaximumScale(2);

// to render the scene:
root->addChild(at); // root is osg::Group
viewer->setSceneData(root);

However, it did not produce any changes in how the scene is rendered when I
change the camera view (i.e., the pyramid becomes smaller when camera zooms
out and bigger when zooms in). I tried the command that sets up auto rotate
mode and it works to fix the rotation. So how come I cannot control the
scale?

Could anyone point out what am I doing wrong or what is missing here? Thank
you!

Regards,
Victoria
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20160317/caebb650/attachment-0002.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 7664 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20160317/caebb650/attachment-0002.png>


More information about the osg-users mailing list