Hi Dongpyo,

You should be able to set the osgViewer::Viewer's master Camera's view
and projection matrix directly in exactly the same way as you'd do
with OpenGL.  The only different is that the OSG uses row major, so
the matrix is transpose of the one you'll read in OpenGL texts, but...
it's actually stored in exactly the same way as the a float array used
to pass to OpenGL so the actual data is identical.

If you are setting your own view matrix then don't register a camera
manipulator with the viewer, and avoid calling viewer.run()  as it'll
attach one automatically, so just use an expanded frame loop i.e.

 viewer.realize();
 while(!viewer.done())
 {
     viewer.getCamera()->setViewMatrix(viewMatrix);
     viewer.getCamera()->setProjectionMatrix(projectionMatrix);
     viewer.frame();
 }

Robert.


On Thu, May 14, 2009 at 4:49 AM, Dongpyo Hong <[email protected]> wrote:
> Hi,
>
> Using osgViewer, I wanted to setup projection matrix
> and modelview matrix by using intrinsic and extrinsic
> parameter of a camera (which is not osg camera, but
> actual camera).
>
> My problem is that I want to rotate and translate a model
> by using a matrix form (+z-axis is inward screen, i.e., opposite to opengl),
> so simply changing translation vector in the matrix by the negation (i.e.,
> -z) didn't
> work because translation was fine at least z-axis but rotation was not.
>
> I tested the same projection matrix and modelview matrix in OpenGL which was
> working.
> But not in osg or osgViewer.
>
> Any idea? or explanation?
>
> Cheers,
> Dongpyo
> ====
> Dongpyo Hong
> Research Assistant
> GIST U-VR Lab.
> http://uvr.gist.ac.kr
> http://uvr.gist.ac.kr/~dhong
> Tel. +82-62-970-3157
> Fax. +82-62-970-2204
> Email. [email protected]
> [email protected]
> ====
>
>
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to