[osg-users] 2D orthographic view with panning and zooming

2014-06-17 Thread Radu Marin Butoi

Hello everyone,

I am writing an application to display and select elements from 2D 
triangular meshes and 3D tetrahedral meshes. Displaying the 3D mesh 
works fine (thanks Robert for the previous help!). With the 2D I'd like 
to have the display show the XY (or XZ, or YZ, depending on the input; 
the bounding of the geometry can be used to determine this) plane 
directly and enable panning and zooming with the mouse. I have a single 
osgViewer and I have tried using the various 
getCamera()->set{View,Projection}* functions, but as I understand the 
camera manipulator will overwrite the view matrix. So, what is the 
simplest way to display an orthographic 2D scene with mouse panning and 
zooming in a similar way that a perspective 3D scene is displayed by 
default?


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


Re: [osg-users] 2D orthographic view with panning and zooming

2014-06-17 Thread Robert Osfield
Hi Radu,

osgViewer::CompositeViewer is the appropriate tool to use when you
want multiple VIew on to one or more scenes.  Have a look at the
osgcompositeviewer and osghud examples.

Robert.

On 17 June 2014 21:43, Radu Marin Butoi  wrote:
> Hello everyone,
>
> I am writing an application to display and select elements from 2D
> triangular meshes and 3D tetrahedral meshes. Displaying the 3D mesh works
> fine (thanks Robert for the previous help!). With the 2D I'd like to have
> the display show the XY (or XZ, or YZ, depending on the input; the bounding
> of the geometry can be used to determine this) plane directly and enable
> panning and zooming with the mouse. I have a single osgViewer and I have
> tried using the various getCamera()->set{View,Projection}* functions, but as
> I understand the camera manipulator will overwrite the view matrix. So, what
> is the simplest way to display an orthographic 2D scene with mouse panning
> and zooming in a similar way that a perspective 3D scene is displayed by
> default?
>
> Thank you,
> Radu
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] 2D orthographic view with panning and zooming

2014-06-18 Thread David Sellin
Hi,

If think if you set viewer->setCameraManipulator( 0 ) the view matrix won't be 
overwritten by any camera manipulator. I haven't tried it recently but I think 
that's how it works.

Otherwise maybe this could work:


Code:
while( !viewer->done() )
{

viewer->advance();
viewer->eventTraversal();
viewer->updateTraversal();

// Modify view matrix here

viewer->renderingTraversals();
}



Thank you!

Cheers,
David

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





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


Re: [osg-users] 2D orthographic view with panning and zooming

2014-06-18 Thread Marco Kliko
Hi,

I think the best way is to go with:

Code:
Viewer.getCamera().setViewMatrixAsLookAt(); 



Not sure if you can change these values on the fly while rendering, but maybe 
you can stop the rendering an after changing the values start the rendering 
again...

You can do this with:

Code:
viewer.stopThreading ()
viewer.startThreading()



I'm not sure if it works, but it is worth the try...  ;) 

Thank you!

Cheers,
Marco

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





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


Re: [osg-users] 2D orthographic view with panning and zooming

2014-06-18 Thread Trajce Nikolov NICK
Hi Radu,

I have done 2D display in the past for mapping purpose and what I did, I
kept the default (TrackBall) manipulator and only changed the projection
matrix (viewer->getCamera()->setProjectionMatrixAsOrtho2D()). Then I was
able to pan, zoom my 2D view

Nick


On Wed, Jun 18, 2014 at 10:28 AM, Marco Kliko 
wrote:

> Hi,
>
> I think the best way is to go with:
>
> Code:
> Viewer.getCamera().setViewMatrixAsLookAt();
>
>
>
> Not sure if you can change these values on the fly while rendering, but
> maybe you can stop the rendering an after changing the values start the
> rendering again...
>
> You can do this with:
>
> Code:
> viewer.stopThreading ()
> viewer.startThreading()
>
>
>
> I'm not sure if it works, but it is worth the try...  ;)
>
> Thank you!
>
> Cheers,
> Marco
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=59800#59800
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



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


Re: [osg-users] 2D orthographic view with panning and zooming

2014-06-19 Thread Radu Marin Butoi

Hi,

Thanks everyone for the help. Taking a look at all your responses, I 
realized my problem was a lot simpler than I was making it; since my 
geometry only exists in a single plane all I needed to do was to set 
the home position through the TrackballManipulator with the bounding 
box of the geometry. It is fine to leave the projection matrix as 
perspective since there is no depth to the scene. However, I have a 
follow up now: how can I disable left click rotation and animation in 
the manipulator? I've tried subclassing the TrackballManipulator class 
and implementing some virtual functions with empty or just "return 
true" bodies (startAnimationByMousePointerIntersection, 
applyAnimationStep) but motion still continues after I release the 
mouse button.


Thanks again,
Radu

On Wed 18 Jun 2014 05:05:00 AM EDT, Trajce Nikolov NICK wrote:

Hi Radu,

I have done 2D display in the past for mapping purpose and what I did,
I kept the default (TrackBall) manipulator and only changed the
projection matrix
(viewer->getCamera()->setProjectionMatrixAsOrtho2D()). Then I was able
to pan, zoom my 2D view

Nick


On Wed, Jun 18, 2014 at 10:28 AM, Marco Kliko mailto:marco_kl...@hotmail.com>> wrote:

Hi,

I think the best way is to go with:

Code:
Viewer.getCamera().setViewMatrixAsLookAt();



Not sure if you can change these values on the fly while
rendering, but maybe you can stop the rendering an after changing
the values start the rendering again...

You can do this with:

Code:
viewer.stopThreading ()
viewer.startThreading()



I'm not sure if it works, but it is worth the try...  ;)

Thank you!

Cheers,
Marco

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org

http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




--
trajce nikolov nick


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

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