Re: [osg-users] Setting modelview matrix with viewer.getCamera()-setViewMatrix(modelViewMatrix) not working

2011-12-11 Thread Juan Herrera
Hi,

The problem seemed to be twofold:

* I was first using OSG 2.8.3, for which
viewer.getCamera()-setViewMatrix(modelViewMatrix)
required that modelViewMatrix were a cv::Matrixd. This is not the case with 
3.0.1, which works with cv::Matrix too.

* Like filip suggested, I used 
viewer.getCameraManipulator()-setByMatrix(modelViewMatrix)
in the callback. It worked. I still have some registration glitches in the 
modeview matrix compared to my desired result, but maybe my original modelview 
matrix is wrong.

* I tried Paul's solution with both getCamera()-setViewMatrix() and 
getCameraManipulator()-setByMatrix(), but I wasn't able to reproduce the 
desired result (that's the solution in the Quickstart guide anyway, so I guess 
I may be missing something).

Thank you!

Cheers,
Juan Herrera

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





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


Re: [osg-users] Setting modelview matrix with viewer.getCamera()-setViewMatrix(modelViewMatrix) not working

2011-11-29 Thread Paul Martz

From the Viewer header file...

/** Execute a main frame loop.
  * Equivalent to while (!viewer.done()) viewer.frame();
  * Also calls realize() if the viewer is not already realized,
  * and installs trackball manipulator if one is not already assigned.
  */
virtual int run();

If you don't want a TrackballManipulator, you'll need to *not* use 
Viewer::run().
   -Paul


On 11/28/2011 9:35 PM, Juan Fernando Herrera J. wrote:

Hi,

I want to set the modelview matrix with
viewer.getCamera()-setViewMatrix(modelViewMatrix) like in the
following code:

int main(int argc, char **argv)
{
 osgViewer::Viewer viewer;
 osg::Node* rootNode = createRootNode();
 viewer.setSceneData(rootNode);
 return viewer.run();
}

Later, in an osg::NodeCallback,  I perform:

 viewer.getCamera()-setViewMatrix(modelViewMatrix);

But the modelview matrix isn't modified at all.

On the other hand,
viewer.getCamera()-setProjectionMatrix(projectionMatrix) seems to
work.

What should I do to the viewer in order for setViewMatrix() to work?

Thank you!

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





--
  -Paul Martz  Skew Matrix Software
   http://www.skew-matrix.com/

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


Re: [osg-users] Setting modelview matrix with viewer.getCamera()-setViewMatrix(modelViewMatrix) not working

2011-11-29 Thread Michael Guerrero
You could also prevent the trackballmanipulator from being created and used by 
doing something like this:


Code:

osg::Camera* cam = viewer.getCamera();
cam-setAllowEventFocus(false); // Prevent the manipulator being used and 
taking over



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





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


[osg-users] Setting modelview matrix with viewer.getCamera()-setViewMatrix(modelViewMatrix) not working

2011-11-28 Thread Juan Fernando Herrera J.
Hi,

I want to set the modelview matrix with
viewer.getCamera()-setViewMatrix(modelViewMatrix) like in the
following code:

int main(int argc, char **argv)
{
osgViewer::Viewer viewer;
osg::Node* rootNode = createRootNode();
viewer.setSceneData(rootNode);
return viewer.run();
}

Later, in an osg::NodeCallback,  I perform:

viewer.getCamera()-setViewMatrix(modelViewMatrix);

But the modelview matrix isn't modified at all.

On the other hand,
viewer.getCamera()-setProjectionMatrix(projectionMatrix) seems to
work.

What should I do to the viewer in order for setViewMatrix() to work?

Thank you!

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


Re: [osg-users] Setting modelview matrix with viewer.getCamera()-setViewMatrix(modelViewMatrix) not working

2011-11-28 Thread Filip Arlet
Hi,
This might be your problem:
If you use CameraManipulator (for example TrackballManipulator), it will 
overwrite your ViewMatrix every frame ... see Viewer.cpp @1040

Code:

if (_cameraManipulator.valid())
{
setFusionDistance( getCameraManipulator()-getFusionDistanceMode(),
getCameraManipulator()-getFusionDistanceValue() );

_camera-setViewMatrix(_cameraManipulator-getInverseMatrix());
}



Cheers,
Filip

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





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