[osg-users] Changes in the way of compute intersections or in eventAdapter?

Björn Hein hein at ira.uka.de
Mon Sep 1 06:07:39 PDT 2008


Hello Robert,

Sorry... You are right. We are using an 
- osgViewer::Viewer integrated in an QGLWidget. 
- GUI events (Keys, mouse move, and so on) are recieved via Qt, translated
and entered in the EventQueue. 
- There is also an PickHandler registered to the eventqueue, that is called
during eventTraversal every time a mouse button is pushed. 
- At this position x y from osgViewer::Viewer the computeIntersection(
ea.getX(), ea.getY(), hitlist) is called.
- the first hit is returned

First of all: We found a "work around". Instead of directly setting the
given mouse positions by the event adapter we ask for the heigt of the
QGLWidget and subtract the y values:

----snip : 
Input : ea --> osgGA::GUIEventAdpater
	  q --> QGLWidget*
	  v --> osgViewer::Viewer*

      float mx = ea.getX();
      float my = ea.getY();

      // :Problem: Inverted y-axis since OSG 2.6.0
      if (OPENSCENEGRAPH_MAJOR_VERSION==2 &&
OPENSCENEGRAPH_MINOR_VERSION>=6) {
	      float ww = q->width();
	      float wh = q->height();
      	my = wh - my;
      }
      
      if (v->computeIntersections( mx, my, lastHitList_) ) 

---- snip:

For our point we have some kind of solution, I just wanted to know if there
was a general "concept" change we didn't recognize in between 2.4 to 2.6 or
do we have to investigate more in this because we have some weired code in
our application using some of OSG concepts wrongly... 

So I will have a closer look at osgpick - as you recommended.

Best regards 

Björn



Hi Björn,

You will need to give a bit more context before anyone can help give a
useful answer.

To start could explain what viewer setup you have.  My best guess is
that you have a CompositeViewer, with at least two Cameras/viewports,
but this guess is just that.  Also you'll need to explain what values
you using to at what point in the program flow.

Also please see if osgpick works for you.

Robert.




More information about the osg-users mailing list