Hello Enrico,

Enrico Borrione wrote:
> Hi openSG users,
>       i am working on a client server application. One of the features
> that I am trying to implement, relies on the mouse interaction with the
> server side scene. I thought about introducing a "virtual" 3d mouse hovering
> in front of the user, piloted in the client side.
> 
> Since in previous projects I used often the opensg picking example I thought
> about using the same principle on the viewport belonging to the
> MultiDisplayWindow I am using:
> 
> osg::CameraPtr camera = m_pClientRenderModule->getMainCamera ();
> osg::Line line;
> camera->calcViewRay (line, posX, posY,
> *m_pClientRenderModule->getMainViewPort().getCPtr());
>     
> osg::Pnt3f point;
> m_pCursorPlane.intersect (line, point);
> 
> setCursorPosition (point);
> 
> to check the intersection I simply intersect the unprojected line with a
> plane normal to the At-From vector.
> 
> The code is working, except from some weird coordinates problems. I thought
> that the cursor would have behaved like a normal mouse pointer, with
> coordinates ranging from 0,0 (upper left pixel) to winWidth, winHeight. 
> Instead, no matter what size I give to the MultiDisplayWindow, I can't get
> the "mouse coordinates" match the window dimensions (usually the 0,0 point
> in in the mid of the server window).
> 
> Any hints on what I am doing wrong?

hm, the line you get from calcViewRay is in world coordinates and I 
assume the same is true for the intersection point. It seems you now 
want to map that point back from world coordinates to window coords, but 
that should just give you the posX, posY you started with?
Sorry, I'm afraid I don't really understand how your mapping between 
window coords and the 3d world coords works.
Or are you saying that posX, posY already do not have values between 0 
and winWidth/Height ?

        regards,
                Carsten


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to