Re: [osg-users] Problem with picking a manipulator in a HUD

2012-10-27 Thread Robert Osfield
Hi Kristofer,

On 26 October 2012 20:48, Kristofer Tingdahl
 wrote:
> It has passed a week, and no, I have honestly not been looking at it
> further. I gave up in frustration. Life as a business administrator is
> a tiny bit software development, and tons of procurement, HR, finance
> and that kind of stuff.

All crucial stuff for running a business, impressive that you are
still able to code profiiciently ;-)

> The overall goal is to create a custom dragger in the form of a
> thumbwheel that will sit in the edges of the viewer and control the
> navigation of the camera. It will end up in osgGeo once it is done.
> osgGeo has btw moved from github to osggeo.googlecode.com as git drove
> me crazy. If you know anyone who has done any thumb-wheel similar
> things, let me know.

A thumbwheel like the ones that Inventor has on the window frame, but
moved to into the 3D window?

Personally I'd tackle such a feature via a custon Node+callbacks
rather than trying to leverage osgManipulator's existing features.  A
thumbwheel should be relatively straight forward as you only have one
axis to rotate the wheel around.  The very specific type of
interaction would probably mean that one could avoid using any mouse
picking and just take the create an event callback that takes mouse
coordinates directly and map them into non dimensional coordinates of
the HUD Camera's viewport and then use this to drive the rotation by
it horizontal or vertical.

As you planning to control the viewer's Camera then one would either
have the event callback push the rotation back to the main
Camera/CameraManipulator or in the main loop pull any rotations on
each new frame.

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


Re: [osg-users] Problem with picking a manipulator in a HUD

2012-10-26 Thread Kristofer Tingdahl
Sorry,

I did not see your reply. The reason for the current construction is
simply copy-paste from an example I found online. We are indeed
working with the composite viewer, so that route may be the best.

So, to summarize, for the hud I would:

1. create a new camera.
2. Set the graphic context to the same osgQt::GraphicsWindowQt as the
normal camera.
3. Create a new view for the hud camera, and add it to the common
composite viewer.

I'll look into this on Monday.

On Thu, Oct 25, 2012 at 12:36 PM, Robert Osfield
 wrote:
> Hi Kristofer,
>
> I have just tested your cube.cpp and see the problem with being able
> move the hud layer.  I haven't drilled down into the code yet but I
> strongly suspect the issue is nesting a HUD Camera in the scene graph
> and how an intersection traversal will handle this case.   My own
> inclination would be to place a HUD layer as a slave Camera in the
> viewer or use a CompositeViewer with a View for the 3D view and View
> for the HUD layer.  This way the intersections can happen indepdently
> for each View/Camera from the top and less likely to conflict.
>
> Robert.
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



-- 
Kristofer Tingdahl, Ph. D.
CEO
dGB Earth Sciences
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Problem with picking a manipulator in a HUD

2012-10-26 Thread Kristofer Tingdahl
Dear Robert,

It has passed a week, and no, I have honestly not been looking at it
further. I gave up in frustration. Life as a business administrator is
a tiny bit software development, and tons of procurement, HR, finance
and that kind of stuff.

The overall goal is to create a custom dragger in the form of a
thumbwheel that will sit in the edges of the viewer and control the
navigation of the camera. It will end up in osgGeo once it is done.
osgGeo has btw moved from github to osggeo.googlecode.com as git drove
me crazy. If you know anyone who has done any thumb-wheel similar
things, let me know.

- Kristofer

On Thu, Oct 25, 2012 at 11:23 AM, Robert Osfield
 wrote:
> Hi Kristofer,
>
> On 19 October 2012 13:17, Kristofer Tingdahl
>  wrote:
>> I am trying to get a Dragger on my HUD display, but I am not able to
>> manipulate it at all. If I add it the identical dragger to the normal scene,
>> it works as expected. Any insight in this is appreciated as I have reached
>> the end of trying to traverse the scene trying to gain understanding in this
>> matter.
>
> I am just setting up Qt on my dev machine - I installed an new disk
> and OS but didn't pull in all extenal dependencies right away.
> Getting there though...  Once I have Qt dev libs and headers installed
> I test out your example and have a look what might be going on.
>
> Without actual testing I can't say what might be amiss, I know that
> osgManipulator was original written for a 3D perspective window so
> perhaps there are assumption that don't map across. In principle I
> can't see a reason why using an orthographic view should prevent
> manipualtors from working, so if they don't this would be a
> bug/implementation limitation that should be addressed.
>
> As a nearly a week has passed since you posted you query, have you
> made any progress with understanding the issue at your end?
>
> Robert.
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



-- 
Kristofer Tingdahl, Ph. D.
CEO
dGB Earth Sciences
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Problem with picking a manipulator in a HUD

2012-10-25 Thread Robert Osfield
Hi Kristofer,

I have just tested your cube.cpp and see the problem with being able
move the hud layer.  I haven't drilled down into the code yet but I
strongly suspect the issue is nesting a HUD Camera in the scene graph
and how an intersection traversal will handle this case.   My own
inclination would be to place a HUD layer as a slave Camera in the
viewer or use a CompositeViewer with a View for the 3D view and View
for the HUD layer.  This way the intersections can happen indepdently
for each View/Camera from the top and less likely to conflict.

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


Re: [osg-users] Problem with picking a manipulator in a HUD

2012-10-25 Thread Robert Osfield
Hi Kristofer,

On 19 October 2012 13:17, Kristofer Tingdahl
 wrote:
> I am trying to get a Dragger on my HUD display, but I am not able to
> manipulate it at all. If I add it the identical dragger to the normal scene,
> it works as expected. Any insight in this is appreciated as I have reached
> the end of trying to traverse the scene trying to gain understanding in this
> matter.

I am just setting up Qt on my dev machine - I installed an new disk
and OS but didn't pull in all extenal dependencies right away.
Getting there though...  Once I have Qt dev libs and headers installed
I test out your example and have a look what might be going on.

Without actual testing I can't say what might be amiss, I know that
osgManipulator was original written for a 3D perspective window so
perhaps there are assumption that don't map across. In principle I
can't see a reason why using an orthographic view should prevent
manipualtors from working, so if they don't this would be a
bug/implementation limitation that should be addressed.

As a nearly a week has passed since you posted you query, have you
made any progress with understanding the issue at your end?

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


[osg-users] Problem with picking a manipulator in a HUD

2012-10-22 Thread Kristofer Tingdahl
Hi all,

I am trying to get a Dragger on my HUD display, but I am not able to
manipulate it at all. If I add it the identical dragger to the normal
scene, it works as expected. Any insight in this is appreciated as I have
reached the end of trying to traverse the scene trying to gain
understanding in this matter.

The core of my code is:

#include 

#include 
#include 
#include 

#include 
#include 
#include 


int main( int argc, char** argv )
{
QApplication app(argc, argv);
osgQt::initQtWindowingSystem();

osg::Group* sceneroot = new osg::Group;
osg::Camera* hudcamera = new osg::Camera;

sceneroot->addChild( hudcamera );
hudcamera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
hudcamera->setViewMatrix(osg::Matrix::identity());
hudcamera->setClearMask(GL_DEPTH_BUFFER_BIT);
hudcamera->setRenderOrder(osg::Camera::POST_RENDER);
hudcamera->setAllowEventFocus(false);
hudcamera->setName("HUD Camera" );

osg::Matrix mat;
mat.makeTranslate( 200, 200, -200 );
mat.preMult( osg::Matrix::scale( 200, 200, 200 ) );

osgManipulator::TabBoxDragger* tbd = new osgManipulator::TabBoxDragger;
hudcamera->addChild( tbd );
tbd->setupDefaultGeometry();
tbd->setMatrix( mat );
tbd->setHandleEvents( true );

osg::Geode* geode = new osg::Geode;
geode->addDrawable( new osg::ShapeDrawable(new osg::Box) );
sceneroot->addChild( geode );

osg::ref_ptr viewer = new osgViewer::Viewer;
viewer->setSceneData( sceneroot );
viewer->setCameraManipulator( new osgGA::TrackballManipulator );
osgQt::setViewer( viewer.get() );

osgQt::GLWidget* glw = new osgQt::GLWidget;
osgQt::GraphicsWindowQt* graphicswin = new osgQt::GraphicsWindowQt( glw
);

hudcamera->setProjectionMatrix(osg::Matrix::ortho2D(0,glw->width(),0,glw->height()));

viewer->getCamera()->setViewport( new osg::Viewport(0, 0, glw->width(),
glw->height() ) );
viewer->getCamera()->setGraphicsContext( graphicswin );

glw->show();

return app.exec();
}





- Kristofer

-- 
Kristofer Tingdahl, Ph. D.
dGB Earth Sciences
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Problem with picking a manipulator in a HUD

2012-10-19 Thread Kristofer Tingdahl
Hi all,

I am trying to get a Dragger on my HUD display, but I am not able to
manipulate it at all. If I add it the identical dragger to the normal
scene, it works as expected. Any insight in this is appreciated as I have
reached the end of trying to traverse the scene trying to gain
understanding in this matter.


- Kristofer

-- 
Kristofer Tingdahl, Ph. D.
dGB Earth Sciences
/*+
 * (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
 * AUTHOR   : Kristofer Tingdahl
 * DATE : May 2000
-*/


#include 

#include 
#include 
#include 

#include 
#include 
#include 


int main( int argc, char** argv )
{
QApplication app(argc, argv);
osgQt::initQtWindowingSystem();

osg::Group* sceneroot = new osg::Group;
osg::Camera* hudcamera = new osg::Camera;

sceneroot->addChild( hudcamera );
hudcamera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
hudcamera->setViewMatrix(osg::Matrix::identity());
hudcamera->setClearMask(GL_DEPTH_BUFFER_BIT);
hudcamera->setRenderOrder(osg::Camera::POST_RENDER);
hudcamera->setAllowEventFocus(false);
hudcamera->setName("HUD Camera" );

osg::Matrix mat;
mat.makeTranslate( 200, 200, -200 );
mat.preMult( osg::Matrix::scale( 200, 200, 200 ) );

osgManipulator::TabBoxDragger* tbd = new osgManipulator::TabBoxDragger;
hudcamera->addChild( tbd );
tbd->setupDefaultGeometry();
tbd->setMatrix( mat );
tbd->setHandleEvents( true );

osg::Geode* geode = new osg::Geode;
geode->addDrawable( new osg::ShapeDrawable(new osg::Box) );
sceneroot->addChild( geode );

osg::ref_ptr viewer = new osgViewer::Viewer;
viewer->setSceneData( sceneroot );
viewer->setCameraManipulator( new osgGA::TrackballManipulator );
osgQt::setViewer( viewer.get() );

osgQt::GLWidget* glw = new osgQt::GLWidget;
osgQt::GraphicsWindowQt* graphicswin = new osgQt::GraphicsWindowQt( glw );
hudcamera->setProjectionMatrix(osg::Matrix::ortho2D(0,glw->width(),0,glw->height()));

viewer->getCamera()->setViewport( new osg::Viewport(0, 0, glw->width(), glw->height() ) );
viewer->getCamera()->setGraphicsContext( graphicswin );

glw->show();

return app.exec();
}
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org