Hi Robert

I am using non-dimensional throughout - I do not think that is the problem. The problem is y-up or y-down. In Producer there is a note in positionPointer() about this and it then continues to use y directly (and therefore y-down). If I am correct OsgProducer defaults to y-up and does not allow for this when calling Producer.

Cheers
Alan

Robert Osfield wrote:

HI Alan,

Producer by default uses non dimension screen coordinates, and
osgProducer follow this.  Non dimension screen coordinate go from -1
to 1.

osgGA::GUIEventAdapter can handle both dimension and non dimension
screen coordinates, and there is a convinience function
getXnormalized() and getYnormalised() than are rescaled to ensure the
final values are non-dimensional.

I presume you just need to unsure that you have consistency in whether
you values or dimensional or non-dimensional, and where you move from
one to other you have the conversion in place.

Robert.

On 6/10/06, Alan Harris <[EMAIL PROTECTED]> wrote:

Hi

Either I am using GUIActionAdapter::requestWarpPointer() wrong or there
is a problem in that y needs to be specified top-down.

The standard function is :

WFKeyboardMouseCallback* kbmcb = m_pkm->getKeyboardMouseCallback();

if (kbmcb->valid() && isRealized())
{
    //osg::notify(osg::INFO) << "requestWarpPointer x= "<<x<<"
y="<<y<<std::endl;

    EventAdapter::_s_mx = x;
    EventAdapter::_s_my = y;
    kbmcb->getKeyboardMouse()->positionPointer(x,y);
    return;
}

I have had to modify GUIActionAdapter to the following to get it to work
correctly:

WFKeyboardMouseCallback* kbmcb = m_pkm->getKeyboardMouseCallback();

if (kbmcb->valid() && isRealized())
{
    //osg::notify(osg::INFO) << "requestWarpPointer x= "<<x<<"
y="<<y<<std::endl;

    EventAdapter::_s_mx = x;
    EventAdapter::_s_my = y;

    Producer::RenderSurface* _rs =
m_pkm->getKeyboardMouse()->getRenderSurface();
Producer::RenderSurface::InputRectangle ir = _rs->getInputRectangle();

    // y DOWN needs to be passed to positionPointer - this works

kbmcb->getKeyboardMouse()->positionPointer(x,2*ir.bottom()+ir.height()-y);

    // this also works
    //unsigned int ww = _rs->getWindowWidth();
    //unsigned int wh = _rs->getWindowHeight();
    //int ix = int(((x - ir.left())/ir.width()) * float(ww-1)+ 0.5f );
//int iy = int(((y - ir.bottom())/ir.height()) * float(wh-1)+ 0.5f );
    //_rs->positionPointer(ix,wh-1-iy);

    return;
}

--

Regards
Alan Harris

ReSoft Ltd
7 Church Lane
Flitton
BEDFORD, MK45 5EL, UK
Tel: +44 (0) 1525 862616
Email: [EMAIL PROTECTED]
Web: www.resoft.co.uk
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

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

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

Reply via email to