hi all

i feel like i am too stupid, i like to implement a new drawable to drawing a
plane on the bottom of the view frustum volume. the plane should always be
on the viewfrustumvolume bottom.
i have only the sceneview

       osg::Vec3 eye,center,up,vdir;
       sceneView->getViewMatrixAsLookAt(eye,center,up);
       double left,right,botton,top,zFar,zNear;

sceneView->getProjectionMatrixAsFrustum(left,right,botton,top,zNear,zFar);

       double fov,ratio;
       sceneView->getProjectionMatrixAsPerspective(fov,ratio,zNear,zFar);



       osg::Vec3 fdir(center-eye);
       osg::Vec3 dir(fdir);
       dir.normalize();
       osg::Vec3 s(dir^up);
       s.normalize();


       double Hnear = 2.0 * tan(fov / 2.0) * zNear;
       double Wnear = Hnear * ratio;
       double Hfar = 2.0 * tan(fov / 2.0) * zFar;
       double Wfar = Hfar * ratio;

       osg::Vec3d eyeAtNear = eye + dir * zNear;
       osg::Vec3d eyeAtFar = eye + dir * zFar;

       edgeNearLeft  = eyeAtNear + s * -Wnear/2.0;
       edgeNearRight = eyeAtNear + s *  Wnear/2.0;
       edgeFarLeft   = eyeAtFar  + s * -Wfar/2.0;
       edgeFarRight  = eyeAtFar  + s *  Wfar/2.0;




glBegin(GL_TRIANGLE_STRIP);
   glVertex3dv(edgeNearLeft.ptr());
   glVertex3dv(edgeNearRight.ptr());
   glVertex3dv(edgeFarLeft.ptr());
   glVertex3dv(edgeFarRight.ptr());
   glEnd();


what is wrong?
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to