Hello at all,

I'm currently working on frustum-culling for a roam-algorithm-implemetation. 
Maybe someone can give me a hint what I'm missing to nail my problem down.

I want to calculate the x,y-coordinates for a vertex on the screen. My 
approach (only for testing, to nail down the problem):

<code>

osg::Matrixd mv = osg::Matrixd::identity();
osg::Matrixd mp = osg::Matrixd::identity();
osg::Matrixd mw = osg::Matrixd::identity();

while( !viewer.done() )
{
  viewer.frame();

  if (viewer.getCameraWithFocus())
  {
    mv = viewer.getCameraWithFocus()->getViewMatrix();
    mp = viewer.getCameraWithFocus()->getProjectionMatrix();
    mw = viewer.getCameraWithFocus()->getViewport()->computeWindowMatrix();
  }
}

osg::Vec4d v = osg::Vec4d(0, 0, 0, 1.0);
v = v * mv;
v.normalize();
v = v * mp * mw;

</code>


Schould this give me the last-coordinates of v on the screen, when pressing 
"ESC" so the viewer terminates? I know this code only works, if the window has 
the focus at termination-time, this is not the problem why I'm asking.

Best regards,
Oli

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

Reply via email to