Hi Chris,

The osg:Camera methods directly map to the equivalent OpenGL ones so
what you are try should work.  What may be going wrong is that if you
have CameraManipulator attached to your viewer then it'll overwrite
the Camera's ViewMatrix on each new frame.  If you are using
viewer.run() it'll assign a TrackballManipulator for you as fallback,
but if you have your own viewer frame loop you'll be able to set the
Camera's view matrix on each new frame as required.

Robert.

On 23 February 2012 11:33, Chris Blizniak <bliznia...@hotmail.com> wrote:
> Hi,
>
> I'm trying to implement something similar to:
>
> http://linuxtoosx.blogspot.com/2010/06/fishtank-vr-project-with-opencv-and_30.html
>
> When I'm doing that using OpenGL only, I'm getting satisfactory results.
> The code is exactly the same as the one suggested on the website,
>
> Code:
> glMatrixMode(GL_PROJECTION);
> glLoadIdentity();
> glFrustum(-0.5 + x, 0.5 + x, -0.5 + y, 0.5 + y, nearPlane - z, 100.0);
> glMatrixMode(GL_MODELVIEW);
> glLoadIdentity();
> glTranslatef(x, y, z);
>
>
>
> But when I try to achieve the same result in OSG, the output is not exactly 
> the same, currently I'm using the following code:
>
> Code:
> osgViewer.getCamera()->setProjectionMatrixAsFrustum(-0.5 + x, 0.5 + x, -0.5 + 
> y, 0.5 + y, nearPlane - z, 100.0);
> osg::Matrixd cameraTrans;
> cameraTrans.makeTranslate(x, y, z);
> osgViewer.getCamera()->setViewMatrix(cameraTrans);
>
>
>
>
> Is that equivalent to the OpenGL implementation? Or am I missing something?
>
>
> Thank you!
>
> Cheers,
> Chris[/url]
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=45715#45715
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to