[osg-users] Simple camera setup question

Judie judie.m.stanley at gmail.com
Thu Jul 31 12:26:13 PDT 2008


I am using the SceneView object. I have specific eye, center and up
vectors that I am using to initialize my viewpoint.

osg::Vec3 eye(ex, ey, ez);

osg::Vec3 center(cx, cy, xz);

osg::Vec3 up(ux, uy, uz);


But now I have a dilema. I have some offset in screen coordinates (or
pixels) example: Xoffset = 19 and Yoffset = -9;

So basically, I would like to do a one time "camera pan" to this
offset amount.

I suppose I could translate the view matrix if I knew what the offset
was in world coordinates. I have been looking through the osg code and
I can't seem to find what I need.

If you want to know why I need this: I am aligning a background image
that has to be processed and requires an offset in order to match up
with the 3D scene. When I offset the image, then I get a border on one
or two sides of the window - depending whether the offset is +- for X
& Y. This border looks bad so I would rather just pan the camera by
the offset amount which is in pixels.

Any thoughts would be appreciated,


More information about the osg-users mailing list