Re: [osg-users] Different results from camera->getViewMatrix() in OSG 3.4.0 compared to OSG 3.2.1

2016-04-14 Thread Ronny Hatteland

> 
> I have no suggestions, because you have have said nothing at all about how 
> you are setting up your viewer - so there is absolutely no clues for us to go 
> on to why you might be seeing this difference.  All we have to go on is some 
> unknown application is producing difference results for some reason.
> 
> You have access to all the source code to OSG-3.4.0 and OSG-3.2.1, you have 
> access to your application and your data, you have all the tools available to 
> put breakpoints into your application code that sets up your viewer and the 
> OSG.  
> 
> 
> 
> Robert.


Thank you for the reply. It was the 
osg::GraphicsContext::createGraphicsContext(traits.get())) that now modifies 
the traits->y value to 138 (The size of the ribbon above the viewport).

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=66818#66818





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Different results from camera->getViewMatrix() in OSG 3.4.0 compared to OSG 3.2.1

2016-04-14 Thread Robert Osfield
On 14 April 2016 at 13:50, Ronny Hatteland  wrote:

>
> Thank you for the quick reply! You are right. I fixed the input and now it
> is evident that the difference is in the windowMatrix:
>
>
> Code:
> WindowMatrix
> 3.4.0:
> [0] {960.00, 0.0, 0.0,
> 0.0}
> [1] {0.0, 443.00, 0.0,
> 0.0}
> [2] {0.0, 0.0, 0.5,
> 0.0}
> [3] {960.00, 581.00, 0.5,
> 1.}
> 3.2.1
> [0] {960.00, 0.0, 0.0,
> 0.0}
> [1] {0.0, 443.00, 0.0,
> 0.0}
> [2] {0.0, 0.0, 0.5,
> 0.0}
> [3] {960.00, 443.00, 0.5,
> 1.}
>
>
>
> Is seems like the difference in value [3][1] is what gives the vertical
> offset on the screen of 138 pixels (between the cursor and the object I
> normally display on the cursor position).
>
> Do you have any suggestion of how I could solve this?
>

I have no suggestions, because you have have said nothing at all about how
you are setting up your viewer - so there is absolutely no clues for us to
go on to why you might be seeing this difference.  All we have to go on is
some unknown application is producing difference results for some reason.

You have access to all the source code to OSG-3.4.0 and OSG-3.2.1, you have
access to your application and your data, you have all the tools available
to put breakpoints into your application code that sets up your viewer and
the OSG.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Different results from camera->getViewMatrix() in OSG 3.4.0 compared to OSG 3.2.1

2016-04-14 Thread Ronny Hatteland

robertosfield wrote:
> Hi Ronny,
> 
> 
> I don't recall any specific changes to view matrix management between 
> OSG-3.2.1 and OSG-3.4.0.  I'm also not aware of any bugs being reported that 
> look relevant to this what you are describing.
> 
> 
> Printing out two sets of view matrices for the two versions without the 
> view's being identical isn't useful.  Try to create the exactly same input 
> conditions - for instance by explictly setting the view matrix.  The mouse 
> input are another variable you'd need to standardize.
> 
> 
> Also when describing the problem you'll need to do more than saying a 
> "vertical offset", this has so many different possible interpretations that 
> it's pointless even starting to guess what you mean.
> 
> 
> 
> Robert.
> 


Thank you for the quick reply! You are right. I fixed the input and now it is 
evident that the difference is in the windowMatrix:


Code:
WindowMatrix
3.4.0:
[0] {960.00, 0.0, 0.0, 
0.0}
[1] {0.0, 443.00, 0.0, 
0.0}
[2] {0.0, 0.0, 0.5, 
0.0}
[3] {960.00, 581.00, 0.5, 
1.}
3.2.1
[0] {960.00, 0.0, 0.0, 
0.0}
[1] {0.0, 443.00, 0.0, 
0.0}
[2] {0.0, 0.0, 0.5, 
0.0}
[3] {960.00, 443.00, 0.5, 
1.}



Is seems like the difference in value [3][1] is what gives the vertical offset 
on the screen of 138 pixels (between the cursor and the object I normally 
display on the cursor position).

Do you have any suggestion of how I could solve this?

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=66811#66811





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Different results from camera->getViewMatrix() in OSG 3.4.0 compared to OSG 3.2.1

2016-04-14 Thread Christian Buchner
The plug-in you used to load your model may behave differently and as a
result the scene's bounding sphere center could have shifted
.


2016-04-14 13:21 GMT+02:00 Robert Osfield :

> Hi Ronny,
>
> I don't recall any specific changes to view matrix management between
> OSG-3.2.1 and OSG-3.4.0.  I'm also not aware of any bugs being reported
> that look relevant to this what you are describing.
>
> Printing out two sets of view matrices for the two versions without the
> view's being identical isn't useful.  Try to create the exactly same input
> conditions - for instance by explictly setting the view matrix.  The mouse
> input are another variable you'd need to standardize.
>
> Also when describing the problem you'll need to do more than saying a
> "vertical offset", this has so many different possible interpretations that
> it's pointless even starting to guess what you mean.
>
> Robert.
>
>
>
> On 14 April 2016 at 12:02, Ronny Hatteland 
> wrote:
>
>> Hi,
>>
>> I have some code for doing picking of objects on the screen:
>>
>>
>> Code:
>> float dX = ea.getX();
>> float dY = ea.getY();
>>
>> osg::ref_ptr camera = view->getCamera();
>>
>> // compute model to window transform
>> // Model*View*Projection*WindowMatrix
>> osg::Matrixd matrix;
>> matrix.postMult(camera->getViewMatrix());
>> matrix.postMult(camera->getProjectionMatrix());
>> osg::Matrixd windowMatrix = camera->getViewport()->computeWindowMatrix();
>> matrix.postMult(windowMatrix);
>>
>> osg::Matrixd inverse;
>> inverse.invert(matrix);
>>
>> // get the coordinates in screen-space:
>> osg::Vec3 mouseloc = osg::Vec3(dX, dY, 0) * inverse;
>> osg::Vec3 normalizedMouseRay = (osg::Vec3(dX, dY, 1) * inverse) -
>> mouseloc;
>> osg::Plane _dragPlane(osg::Vec4d(0, 1, 0, 0));
>>
>>
>> Which was working perfectly fine in OSG 3.2.1.
>> However, when I updated to OSG 3.4.0 a vertical offset was introduced,
>> which seems to be constant regardless of the camera.
>>
>> Positioning the camera at approximately the same place in both cases, and
>> looking at the matrices, it looks like the offset was introduced already by
>> the getViewMatrix() method, value[3][3]:
>>
>>
>> Code:
>> matrix.postMult(camera->getViewMatrix());
>> 3.4.0:
>> [0] {1., 0.0, 0.0,
>> 0.0}
>> [1] {0.0, 0.0, -1.,
>> 0.0}
>> [2] {0.0, 1., 0.0,
>> 0.0}
>> [3] {-1009.2817596644163, 216.03970056772232, -509.02834880430618,
>> 1.}
>> 3.2.1:
>> [0] {1., 0.0, 0.0,
>> 0.0}
>> [1] {0.0, 0.0, -1.,
>> 0.0}
>> [2] {0.0, 1., 0.0,
>> 0.0}
>> [3] {-1061.2815714627504, 239.85043859481812, -599.72003111232948,
>> 1.}
>>
>> matrix.postMult(camera->getProjectionMatrix());
>> 3.4.0:
>> [0] {1.7748398086904795, 0.0, 0.0,
>> 0.0}
>> [1] {0.0, 0.0, 1.0200,
>> 1.}
>> [2] {0.0, 3.8461539872299335, 0.0,
>> 0.0}
>> [3] {-1791.3134452375832, 830.92195573850609, 509.02834880411638,
>> 509.02834880430618}
>> 3.2.1
>> [0] {1.7748398086904795, 0.0, 0.0,
>> 0.0}
>> [1] {0.0, 0.0, 1.0200,
>> 1.}
>> [2] {0.0, 3.8461539872299335, 0.0,
>> 0.0}
>> [3] {-1883.6047812616794, 922.50172074030797, 599.72003111214144,
>> 599.72003111232948}
>>
>> WindowMatrix
>> 3.4.0:
>> [0] {960.00, 0.0, 0.0,
>> 0.0}
>> [1] {0.0, 443.00, 0.0,
>> 0.0}
>> [2] {0.0, 0.0, 0.5,
>> 0.0}
>> [3] {960.00, 581.00, 0.5,
>> 1.}
>> 3.2.1
>> [0] {960.00, 0.0, 0.0,
>> 0.0}
>> [1] {0.0, 443.00, 0.0,
>> 0.0}
>> [2] {0.0, 0.0, 0.5,
>> 0.0}
>> [3] {960.00, 443.00, 0.5,
>> 1.}
>>
>> matrix.postMult(windowMatrix);
>> 3.4.0:
>> [0] {1703.8462163428603, 0.0, 0.0,
>> 0.0}
>> [1] {960.00, 581.00, 1.0100,
>> 1.}
>> [2] {0.0, 1703.8462163428605, 0.0,
>> 0.0}
>> [3] {-1230993.6925759460, 

Re: [osg-users] Different results from camera->getViewMatrix() in OSG 3.4.0 compared to OSG 3.2.1

2016-04-14 Thread Robert Osfield
Hi Ronny,

I don't recall any specific changes to view matrix management between
OSG-3.2.1 and OSG-3.4.0.  I'm also not aware of any bugs being reported
that look relevant to this what you are describing.

Printing out two sets of view matrices for the two versions without the
view's being identical isn't useful.  Try to create the exactly same input
conditions - for instance by explictly setting the view matrix.  The mouse
input are another variable you'd need to standardize.

Also when describing the problem you'll need to do more than saying a
"vertical offset", this has so many different possible interpretations that
it's pointless even starting to guess what you mean.

Robert.



On 14 April 2016 at 12:02, Ronny Hatteland  wrote:

> Hi,
>
> I have some code for doing picking of objects on the screen:
>
>
> Code:
> float dX = ea.getX();
> float dY = ea.getY();
>
> osg::ref_ptr camera = view->getCamera();
>
> // compute model to window transform
> // Model*View*Projection*WindowMatrix
> osg::Matrixd matrix;
> matrix.postMult(camera->getViewMatrix());
> matrix.postMult(camera->getProjectionMatrix());
> osg::Matrixd windowMatrix = camera->getViewport()->computeWindowMatrix();
> matrix.postMult(windowMatrix);
>
> osg::Matrixd inverse;
> inverse.invert(matrix);
>
> // get the coordinates in screen-space:
> osg::Vec3 mouseloc = osg::Vec3(dX, dY, 0) * inverse;
> osg::Vec3 normalizedMouseRay = (osg::Vec3(dX, dY, 1) * inverse) - mouseloc;
> osg::Plane _dragPlane(osg::Vec4d(0, 1, 0, 0));
>
>
> Which was working perfectly fine in OSG 3.2.1.
> However, when I updated to OSG 3.4.0 a vertical offset was introduced,
> which seems to be constant regardless of the camera.
>
> Positioning the camera at approximately the same place in both cases, and
> looking at the matrices, it looks like the offset was introduced already by
> the getViewMatrix() method, value[3][3]:
>
>
> Code:
> matrix.postMult(camera->getViewMatrix());
> 3.4.0:
> [0] {1., 0.0, 0.0,
> 0.0}
> [1] {0.0, 0.0, -1.,
> 0.0}
> [2] {0.0, 1., 0.0,
> 0.0}
> [3] {-1009.2817596644163, 216.03970056772232, -509.02834880430618,
> 1.}
> 3.2.1:
> [0] {1., 0.0, 0.0,
> 0.0}
> [1] {0.0, 0.0, -1.,
> 0.0}
> [2] {0.0, 1., 0.0,
> 0.0}
> [3] {-1061.2815714627504, 239.85043859481812, -599.72003111232948,
> 1.}
>
> matrix.postMult(camera->getProjectionMatrix());
> 3.4.0:
> [0] {1.7748398086904795, 0.0, 0.0,
> 0.0}
> [1] {0.0, 0.0, 1.0200,
> 1.}
> [2] {0.0, 3.8461539872299335, 0.0,
> 0.0}
> [3] {-1791.3134452375832, 830.92195573850609, 509.02834880411638,
> 509.02834880430618}
> 3.2.1
> [0] {1.7748398086904795, 0.0, 0.0,
> 0.0}
> [1] {0.0, 0.0, 1.0200,
> 1.}
> [2] {0.0, 3.8461539872299335, 0.0,
> 0.0}
> [3] {-1883.6047812616794, 922.50172074030797, 599.72003111214144,
> 599.72003111232948}
>
> WindowMatrix
> 3.4.0:
> [0] {960.00, 0.0, 0.0,
> 0.0}
> [1] {0.0, 443.00, 0.0,
> 0.0}
> [2] {0.0, 0.0, 0.5,
> 0.0}
> [3] {960.00, 581.00, 0.5,
> 1.}
> 3.2.1
> [0] {960.00, 0.0, 0.0,
> 0.0}
> [1] {0.0, 443.00, 0.0,
> 0.0}
> [2] {0.0, 0.0, 0.5,
> 0.0}
> [3] {960.00, 443.00, 0.5,
> 1.}
>
> matrix.postMult(windowMatrix);
> 3.4.0:
> [0] {1703.8462163428603, 0.0, 0.0,
> 0.0}
> [1] {960.00, 581.00, 1.0100,
> 1.}
> [2] {0.0, 1703.8462163428605, 0.0,
> 0.0}
> [3] {-1230993.6925759460, 663843.89704746008, 509.02834880421130,
> 509.02834880430618}
> 3.2.1
> [0] {1703.8462163428603, 0.0, 0.0,
> 0.0}
> [1] {960.00, 443.00, 1.0100,
> 1.}
> [2] {0.0, 1703.8462163428605, 0.0,
> 0.0}
> [3]