Hi, Projection Matrix converts to post projection clip space. OpenGL uses [ -1..1 x -1..1 x -1..1 ] clipping box (also called unit frustum). All objects beyond that range will get clipped as extending beyond visible space. In OpenGL clipping Z range is exactly the same as for X and Y coordinates.
Window matrix trasforms post projection XY coords to viewport range and Z coord to depth range to get final Window/Zbuffer coordinates. I haven't checked it but most likely the method You used does also aditional multiplication by Window matirx which produces final screen coords. Both methods are good you. Use the one which is more convenient ;-) Regards, Wojtek ----- Original Message ----- From: "Robert Balfour" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Sunday, December 30, 2007 10:10 PM Subject: Re: [osg-users] Is point in view? > Wojciech Lewandowski wrote: >> >> osg::Vec3 projectedPoint = osg::Vec3( x,y,z ) * camera->getViewMatrix() * >> camera->getProjectionMatrix(); >> bool pointInFrustum = osg::BoundingBox( -1, -1, -1, 1,1,1 ).contains( >> projectedPoint ); >> > > I actually wound up using sceneview->projectObjectIntoWindow(), which > likely does the same matrix mult, but seems to return a viewport xy with > 0,0 in lower left corner. Then I could just do a 2D viewport limit > check. > > The above code looks like it assumes it would get an x,y,z screen > location each clamped to -1->1 centered at 0,0,0 - which I guess is > what you would get just applying the view and proj transforms without > any viewport adjustment? I'm not sure what happens to z here. > > Thanks. > > Bob. > > >> >> -----Original Message----- >> From: [EMAIL PROTECTED] >> [mailto:[EMAIL PROTECTED] Behalf Of Robert >> Balfour >> Sent: Saturday, December 29, 2007 11:12 PM >> To: [email protected] >> Subject: [osg-users] Is point in view? >> >> Is there a straight forward method to determine if a ground xyz target >> point (or geode bbox centerpoint) is currently visible (i.e. within the >> current view frustrum)? >> >> I'm drawing a HUD target line, but don't want to draw it if the target >> point is not in view. >> >> Thanks. >> >> Bob. >> -- >> Robert E. Balfour, Ph.D. >> Exec. V.P. & CTO, BALFOUR Technologies LLC >> 960 South Broadway, Suite 108, Hicksville NY 11801 >> Phone: (516)513-0030 Fax: (516)513-0027 email: [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

