Hi Jan,

Jan wrote:
>> did you insert some std::cout statements to see what coordinates you 
>> actually get ?
>>   
> Yes, I have. Below are some std::cout statements. In the output below, I 
> only translate my pointer in the X and Y direction. It's already strange 
> to mention that the direction of the calculated ray changes when I 
> translate my pointer in the x and y direction (without any rotate).

that does not necessarily mean it is wrong, since the ray is intended to
go from the eye point through the given (x,y) point on the projection
plane into the scene.

> Debugging the coordinate transformations clarified also that the 0,0 
> point of the viewport coordinates is located at the top left of my 
> viewport (I think this is correct?).

the OpenGL convention is to have the origin in the bottom left - might
that already explain the behavior you see ?

> The debug output below is structured like this :
> 
> Pointer position = the position of the pointer in 3D
> Pointer clipping coordinates = the result of WorldToClippingCoordinates
> Pointer viewport coordinates = the result of WorldToViewportCoordinates
> Ray direction = the direction of the ray calculated with calViewRay 
> (with the pointer viewport coordinates)
> 
> This is the debugging output :
> 
> Pointer position : 0.05,0.00999999,-1
> Pointer clipping coordinates : 0.090533,0.0241421,-1.07374e+008
> Pointer viewport coordinates : 348.971,234.206
> Ray direction : 0.0671957,0.0167989,-0.997598
> 
> Pointer position : 0.055,0.00999999,-1
> Pointer clipping coordinates : 0.0995863,0.0241421,-1.07374e+008
> Pointer viewport coordinates : 351.868,234.206
> Ray direction : 0.0743573,0.0167904,-0.99709
> 
> Pointer position : 0.065,0.00999999,-1
> Pointer clipping coordinates : 0.117693,0.0241421,-1.07374e+008
> Pointer viewport coordinates : 357.662,234.206
> Ray direction : 0.0886451,0.0167707,-0.995922
> 
> Pointer position : 0.07,0.00999999,-1
> Pointer clipping coordinates : 0.126746,0.0241421,-1.07374e+008
> Pointer viewport coordinates : 360.559,234.206
> Ray direction : 0.0957691,0.0167596,-0.995263
> 
> Pointer position : 0.07,0.005,-1
> Pointer clipping coordinates : 0.126746,0.0120711,-1.07374e+008
> Pointer viewport coordinates : 360.559,237.103
> Ray direction : 0.0957781,0.00957781,-0.995357
> 
> Pointer position : 0.07,-0.005,-1
> Pointer clipping coordinates : 0.126746,-0.0120711,-1.07374e+008
> Pointer viewport coordinates : 360.559,242.897
> Ray direction : 0.0957822,-0.00239456,-0.995399
> 
> Pointer position : 0.07,-0.00999999,-1
> Pointer clipping coordinates : 0.126746,-0.0241421,-1.07374e+008
> Pointer viewport coordinates : 360.559,245.794
> Ray direction : 0.0957781,-0.00957781,-0.995357
> 
> Pointer position : 0.07,-0.015,-1
> Pointer clipping coordinates : 0.126746,-0.0362132,-1.07374e+008
> Pointer viewport coordinates : 360.559,248.691
> Ray direction : 0.0957691,-0.0167596,-0.995263

Ok, these look about right to me, do you think they are wrong ?

>> hm, only thing that springs to mind is that you are using Vec3f and 
>> OpenSG handles vectors different from points, i.e. vectors ignore 
>> translation when transformed, so you might want to try using a Pnt3f there.
>>   
> I changed the Vec3f's to Pnt3f's but that doens't solve the problem :-(.
> 
> I have also some extra screenshot to show the strange behavior of my 
> picking routine : 
> http://lumumba.uhasselt.be/~meskensj/opensg/opensg_picking2.JPG

hm, strange indeed. Frankly, I'm running a bit out of ideas. Maybe you
could try to draw the ray as a line in your scene, that might give you
an idea on why it does not seem to follow your sphere.

        Sorry,
                Carsten

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to