Hi, 

There is a mode in our application where the user does not control the camera. 
The camera is initially set to look at the z=0 plane (perpendicular to the 
plane) at a fixed height. We then get notifications from the application to 
move the camera in x and y only.

I was looking at our code we had for that, and I found out that we may have 
been doing a mistake. On the other hand, the view looks correct so I wanted to 
ask for more insight on this.

When the application comes in with a delta [x, y], we only move the frustum of 
the orthographic projection, without moving the camera.
I would imagine the right thing to do would be to move the camera in [x, y] 
without changing the frustum. But for some reason just moving the frustum works 
fine. I am not sure if this is valid or not.
[I do know that if we were in perspective we would have to move the camera, 
since the frustum is defined by the angle and ratio of the view.]

Just as an example, we start by setting the camera:

Code:
camera->setProjectionMatrixAsOrtho(-100.0, 100.0, -100.0, 100.0, 0.0, 320); // 
frustum of [200X200]
camera->setViewMatrixAsLookAt( osg::Vec3(0.0, 0.0, 320.0), osg::Vec3(0.0, 0.0, 
0.0), osg::Vec3(0.0, 1.0, 0.0)); // [eye, center, up]


then at a later time, the application may say: "move the camera in x=50, y=25"

Instead of moving the camera location we just call:

Code:
camera->setProjectionMatrixAsOrtho(-50.0, 150.0, -75.0, 125.0, 0.0, 320); 


Without moving the camera.


Cheers,
Ron

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=48990#48990





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to