Hi,
I'm trying to setup a camera as I'm used
to do with OpenGL, that is, setup a perspective
projection matrix and a position/orientation
matrix as modelview matrix (I almost always
used gluLookAt for the latter). I used an
example a tutorial sample that displays the
spinning donut. All I want to do is to setup
a certain position for the camera. I used
the code below but translation part of the camera
setup has no effect! What's wrong with it?
I also removed the "showAll" call on the SimpleSceneManager
object. The camera seems to be posiitoned on a default
position at (0,0,0) or something similar. (I see the donut
rotating around me).
Regards,
Toni
-------8<---------
[...]
TransformPtr CamTrans;
CamTrans = Transform::create();
// setup matrix for position, coi and up.
beginEditCP(CamTrans);
Matrix lookAtMatrix;
osg::MatrixLookAt( lookAtMatrix, 0, 0, -100, 1, 0, 0, 0, 1, 0 );
CamTrans->setMatrix(lookAtMatrix);
endEditCP(CamTrans);
NodePtr rootScene = Node::create();
beginEditCP(rootScene, Node::CoreFieldMask | Node::ChildrenFieldMask);
{
rootScene->setCore(CamTrans);
rootScene->addChild(scene); // scene was the original root node, torus with
matrix
}
endEditCP (rootScene, Node::CoreFieldMask | Node::ChildrenFieldMask);
PerspectiveCameraPtr camera = PerspectiveCamera::create();
beginEditCP(camera);
camera->setBeacon( rootScene );
camera->setFov( deg2rad( 60 ) );
camera->setNear( 0.5 );
camera->setFar( 8000 );
endEditCP(camera);
[...]
beginEditCP(vp, Viewport::CameraFieldMask );
{
vp->setCamera( camera );
}
endEditCP(vp, Viewport::CameraFieldMask);
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users