[osg-users] querying nodes/childs

2009-09-14 Thread Terrence Vergauwen
Hi,

I'm new to openscenegraph,
i've loaded an OBJ into a node,
what would be the best way to query everything this node contains ?

I need to extract all geodes/geometry/transforms/materials to place them into a 
nodegraph.

Thank you!

Cheers,
Terrence

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





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


[osg-users] creating integration with JUCE toolkit - manipulator not responding to mouse events

2009-09-12 Thread Terrence Vergauwen
Hi,

I'm writing a class to get an osg Viewer working from the JUCE framework 
(http://www.rawmaterialsoftware.com/juce/)

I've attached the class, things seem to work ok, i can see my node with a mesh 
object, expect that the mouse events aren't working.

I'm initializing this class from my main app as:


Code:


... build node tree ...

viewer-setSceneData( root );
//viewer.run();

viewer-setCameraManipulator(new osgGA::TrackballManipulator());
viewer-addEventHandler(new osgViewer::StatsHandler);
viewer-realize();




here's the class:


Code:

class OsgViewerComponent : public osgViewer::Viewer, public OpenGLComponent,
   public ChangeListener

{
public:
OsgViewerComponent () :
  window(NULL)
{
};

  ~OsgViewerComponent() {};

void newOpenGLContextCreated()
{
window = setUpViewerAsEmbeddedInWindow(getX(), getY(), 
getWidth(), getHeight());

getCamera()-setViewport(new osg::Viewport(0, 0, getWidth(), 
getHeight()));
getCamera()-setProjectionMatrixAsPerspective(60.0f, 
static_castdouble(getWidth())/static_castdouble(getHeight()), 1.0f, 
1.0f);
getCamera()-setGraphicsContext(window.get());
//getCamera()-setClearColor (osg::Vec4(0.2f, 0.2f, 0.2f, 
1.f));

setThreadingModel(osgViewer::Viewer::SingleThreaded);
};

void renderOpenGL()
{
frame();
};

void resized()
{
if(window.valid()) {
window-getEventQueue()-windowResize(getX(), getY(), 
getWidth(), getHeight() );
window-resized(getX(), getY(), getWidth(), 
getHeight());   
getCamera()-setViewport(new osg::Viewport(0, 0, 
getWidth(), getHeight()));
getCamera()-setProjectionMatrixAsPerspective(60.0f, 
static_castdouble(getWidth())/static_castdouble(getHeight()), 1.0f, 
1.0f);
}
};


void mouseDown (const MouseEvent e)
{
int mButton = 1; 
int flags = e.mods.getRawFlags();
if(flags == ModifierKeys::leftButtonModifier)
mButton = 1;
else if(flags == ModifierKeys::middleButtonModifier)
mButton = 2;
else if(flags == ModifierKeys::rightButtonModifier)
mButton = 3;

window-getEventQueue()-mouseButtonPress(e.x, e.y, mButton);
frame();
}

void mouseUp (const MouseEvent e)
{
int mButton = 1; 
int flags = e.mods.getRawFlags();
if(flags == ModifierKeys::leftButtonModifier)
mButton = 1;
else if(flags == ModifierKeys::middleButtonModifier)
mButton = 2;
else if(flags == ModifierKeys::rightButtonModifier)
mButton = 3;

window-getEventQueue()-mouseButtonRelease(e.x, e.y, mButton);
frame();
}

void mouseMove (const MouseEvent e)
{
window-getEventQueue()-mouseMotion(e.x, e.y);
frame();
};

void changeListenerCallback (void*) {};

juce_UseDebuggingNewOperator

private:
osg::observer_ptrosgViewer::GraphicsWindow window;

OsgViewerComponent (const OsgViewerComponent);
const OsgViewerComponent operator= (const OsgViewerComponent);
};




I've tested the juce mouseDown, mouseUp and mouseMove methods and these all 
work propperly, returning the required mouse positions (integer window coords) 
and buttons as ints.

It just seems the trackballmanipulator is'nt responding to them. 
Not sure how it should respond and what mouse/key combinations to say rotate 
the node are required as i can't find it anywhere in the openscenegrah docs.

Anyone have a clue ?

Thank you!

Cheers,
Terrence

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





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


Re: [osg-users] [solved] creating integration with JUCE toolkit - manipulator not responding to mouse events

2009-09-12 Thread Terrence Vergauwen
Hi,

I found the issue :)

Seems juce was interfering with the update with frame();
So had to request a full juce::repaint().

Cheers,
Terrence

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





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