Re: [osg-users] Implementation of movement, rotation of scale

2019-05-31 Thread Maxim Senin
Hi, i finded code, but in this function is failed why?


Code:

osg::Node* addDraggerToScene(osg::Node* scene, const std::string& name)
{
scene->getOrCreateStateSet()->setMode(GL_NORMALIZE, 
osg::StateAttribute::ON);

osg::MatrixTransform* selection = new osg::MatrixTransform;
selection->addChild(scene);

osgManipulator::Dragger* dragger = createDragger(name);


osg::Group* root = new osg::Group;
root->addChild(dragger);
root->addChild(selection);

float scale = scene->getBound().radius() * 1.6;
dragger->setMatrix(osg::Matrix::scale(scale, scale, scale) *
osg::Matrix::translate(scene->getBound().center()));

osgManipulator::GridConstraint *con = new 
osgManipulator::GridConstraint(*selection, osg::Vec3(0, 0, 0), osg::Vec3(30, 
30, 30));
osg::ref_ptr m_pManipulator = new 
osgManipulator::TabBoxDragger;
m_pManipulator->addConstraint(con);

dragger->addConstraint(con);
dragger->addTransformUpdating(selection);

// we want the dragger to handle it's own events automatically
dragger->setHandleEvents(true);

// if we don't set an activation key or mod mask then any mouse click on
// the dragger will activate it, however if do define either of 
ActivationModKeyMask or
// and ActivationKeyEvent then you'll have to press either than mod key 
or the specified key to
// be able to activate the dragger when you mouse click on it.  Please 
note the follow allows
// activation if either the ctrl key or the 'a' key is pressed and held 
down.
dragger->setActivationModKeyMask(osgGA::GUIEventAdapter::MODKEY_CTRL);
dragger->setActivationKeyEvent('a');

return root;
}



after RETURN failde:(
... 

Thank you!

Cheers,
Maxim

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





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


Re: [osg-users] Implementation of movement, rotation of scale

2019-05-31 Thread Maxim Senin
Hi, i finded code, but in this function is failed why?


Code:

osg::Node* addDraggerToScene(osg::Node* scene, const std::string& name)
{
scene->getOrCreateStateSet()->setMode(GL_NORMALIZE, 
osg::StateAttribute::ON);

osg::MatrixTransform* selection = new osg::MatrixTransform;
selection->addChild(scene);

osgManipulator::Dragger* dragger = createDragger(name);


osg::Group* root = new osg::Group;
root->addChild(dragger);
root->addChild(selection);

float scale = scene->getBound().radius() * 1.6;
dragger->setMatrix(osg::Matrix::scale(scale, scale, scale) *
osg::Matrix::translate(scene->getBound().center()));

osgManipulator::GridConstraint *con = new 
osgManipulator::GridConstraint(*selection, osg::Vec3(0, 0, 0), osg::Vec3(30, 
30, 30));
osg::ref_ptr m_pManipulator = new 
osgManipulator::TabBoxDragger;
m_pManipulator->addConstraint(con);

dragger->addConstraint(con);
dragger->addTransformUpdating(selection);

// we want the dragger to handle it's own events automatically
dragger->setHandleEvents(true);

// if we don't set an activation key or mod mask then any mouse click on
// the dragger will activate it, however if do define either of 
ActivationModKeyMask or
// and ActivationKeyEvent then you'll have to press either than mod key 
or the specified key to
// be able to activate the dragger when you mouse click on it.  Please 
note the follow allows
// activation if either the ctrl key or the 'a' key is pressed and held 
down.
dragger->setActivationModKeyMask(osgGA::GUIEventAdapter::MODKEY_CTRL);
dragger->setActivationKeyEvent('a');

return root;
}



after RETURN failde:(
... 

Thank you!

Cheers,
Maxim

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





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


[osg-users] Keeping camera fixed

2019-05-31 Thread Renzo Scaletta
Hi All,

I am able to animate my scene (bodies translating and rotating in the space) 
providing a NodeCallback with setUpdateCallback to each 
PositionAttitudeTransform I want to animate.
What I see is that the camera "follows" in some way the bodies movements 
without having done anything in the code to trigger that behavior explicitly.

Do you have any tips to keep the camera fixed during the update of nodes 
position and attitude? Or any details of the OSG code I should focus on (I am 
quite a beginner)?

Thanks,
Renzo

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





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


[osg-users] Huge perfomance issues

2019-05-31 Thread Achilleas Margaritis
Hi,

I am developing a data visualization application with Qt + OSG, but I have huge 
performance problems.

These problems are not due to OSG itself but rather due to how I use OSG (I 
just started using OSG/OpenGL for the first time).

The application accepts a lot of data as messages over the network, and draws 
polygons and lines according to the received data.

In order to make drawing easy, I have developed a class which has many drawing 
functions: DrawPolygon, DrawPolygonLine, DrawLine, DrawRectangle. DrawCircle, 
DrawCube, etc.

In every of these functions, I do the following:

1) create a Geode.
2) create a Geometry and attach it to the Geode created above.
3) create a material with the appropriate colors for the drawing, attached to 
the Geode created above.
4) create a state set for the drawing properties, attached to the Geode created 
above.

At each frame, I delete all the objects created, and then use the API I 
described above (i.e. DrawPolygon, DrawPolygonLine etc) to recreate the 
drawings with the newly received data.

The frame rate is abysmal though. After the creation of a few tens of polygons 
and lines (around 100), the frame rate drops extremely low and the UI becomes 
totally unresponsive.

The code I have created is largely copied from the OSG examples I have found 
online, mostly from the osggeometry.cpp example.

My question is what am I doing wrong?

Is the multiple statesets created the problem? Each Drawing function creates a 
new stateset, a new vertex array, a new primitives array, a new geode etc.

Thank you!

Cheers,
Achilleas

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





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


Re: [osg-users] Compiling osgVRPN

2019-05-31 Thread Michael W Bogucki
Hi Again,
As an update, I whittled my way through several of the dependency issues


Code:


Scanning dependencies of target osgdb_tracker
Scanning dependencies of target osgVRPNwall
Scanning dependencies of target osgVRPNviewer
Scanning dependencies of target osgVRPNmod
[ 65%] Building CXX object 
src/osgPlugins/tracker/CMakeFiles/osgdb_tracker.dir/ReaderWriterTRACKER.cpp.o
[ 70%] Building CXX object 
examples/osgVRPNwall/CMakeFiles/osgVRPNwall.dir/osgVRPNwall.cpp.o
[ 80%] Building CXX object 
examples/osgVRPNmod/CMakeFiles/osgVRPNmod.dir/osgVRPNmod.cpp.o
[ 80%] Building CXX object 
examples/osgVRPNviewer/CMakeFiles/osgVRPNviewer.dir/osgVRPNviewer.cpp.o
[ 85%] Linking CXX shared module ../../../bin/osgdb_tracker.so
[ 85%] Built target osgdb_tracker
[ 90%] Linking CXX executable ../../bin/osgVRPNwall
../../bin/libosgVRPN.so: undefined reference to `q_from_axis_angle'
collect2: error: ld returned 1 exit status
examples/osgVRPNwall/CMakeFiles/osgVRPNwall.dir/build.make:102: recipe for 
target 'bin/osgVRPNwall' failed
make[2]: *** [bin/osgVRPNwall] Error 1
CMakeFiles/Makefile2:347: recipe for target 
'examples/osgVRPNwall/CMakeFiles/osgVRPNwall.dir/all' failed
make[1]: *** [examples/osgVRPNwall/CMakeFiles/osgVRPNwall.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs
[ 95%] Linking CXX executable ../../bin/osgVRPNviewer
[100%] Linking CXX executable ../../bin/osgVRPNmod
../../bin/libosgVRPN.so: undefined reference to `q_from_axis_angle'
collect2: error: ld returned 1 exit status
examples/osgVRPNviewer/CMakeFiles/osgVRPNviewer.dir/build.make:102: recipe for 
target 'bin/osgVRPNviewer' failed
make[2]: *** [bin/osgVRPNviewer] Error 1
CMakeFiles/Makefile2:237: recipe for target 
'examples/osgVRPNviewer/CMakeFiles/osgVRPNviewer.dir/all' failed
make[1]: *** [examples/osgVRPNviewer/CMakeFiles/osgVRPNviewer.dir/all] Error 2
../../bin/libosgVRPN.so: undefined reference to `q_from_axis_angle'
collect2: error: ld returned 1 exit status
examples/osgVRPNmod/CMakeFiles/osgVRPNmod.dir/build.make:102: recipe for target 
'bin/osgVRPNmod' failed
make[2]: *** [bin/osgVRPNmod] Error 1
CMakeFiles/Makefile2:292: recipe for target 
'examples/osgVRPNmod/CMakeFiles/osgVRPNmod.dir/all' failed
make[1]: *** [examples/osgVRPNmod/CMakeFiles/osgVRPNmod.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2





When I do the following:

Code:


# nm - list symbols from object files

$> nm bin/libosgVRPN.so | grep q_from_axis_angle
 U q_from_axis_angle




It shows it undefined in libosgVRPN.so

Same with libvrpn.a

Code:

$> nm ./libvrpn.a  | grep q_from_axis_angle
 U q_from_axis_angle




HOWEVER 

Code:

$> nm ./libquat.a  | grep q_from_axis_angle
0980 T q_from_axis_angle




So it seems either libquat isn't linked against libvrpn or libosgVRPN... 

Wondering if something is missing in the osgvrpnviewer makefile?

Again any help or ideas would be great. 


... 

Thank you!

Cheers,
Michael

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





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


Re: [osg-users] Huge perfomance issues

2019-05-31 Thread Werner Modenbach
Hi Achilleas,

your explanations look to me like "I want to repaint my living room. So I 
destroy my house and ..."
My suggestion:
For each kind of geometry create it as geode and add it to a switch node. So 
you can switch them on and off as needed.
For alterations keep pointers to the geodes and alter the geometries. I.e. 
assign new coordinate arrays etc. .
Also there is no need to do it within a frame.

Regards

- Werner -


Am 30.05.2019 um 12:53 schrieb Achilleas Margaritis:
> Hi,
>
> I am developing a data visualization application with Qt + OSG, but I have 
> huge performance problems.
>
> These problems are not due to OSG itself but rather due to how I use OSG (I 
> just started using OSG/OpenGL for the first time).
>
> The application accepts a lot of data as messages over the network, and draws 
> polygons and lines according to the received data.
>
> In order to make drawing easy, I have developed a class which has many 
> drawing functions: DrawPolygon, DrawPolygonLine, DrawLine, DrawRectangle. 
> DrawCircle, DrawCube, etc.
>
> In every of these functions, I do the following:
>
> 1) create a Geode.
> 2) create a Geometry and attach it to the Geode created above.
> 3) create a material with the appropriate colors for the drawing, attached to 
> the Geode created above.
> 4) create a state set for the drawing properties, attached to the Geode 
> created above.
>
> At each frame, I delete all the objects created, and then use the API I 
> described above (i.e. DrawPolygon, DrawPolygonLine etc) to recreate the 
> drawings with the newly received data.
>
> The frame rate is abysmal though. After the creation of a few tens of 
> polygons and lines (around 100), the frame rate drops extremely low and the 
> UI becomes totally unresponsive.
>
> The code I have created is largely copied from the OSG examples I have found 
> online, mostly from the osggeometry.cpp example.
>
> My question is what am I doing wrong?
>
> Is the multiple statesets created the problem? Each Drawing function creates 
> a new stateset, a new vertex array, a new primitives array, a new geode etc.
>
> Thank you!
>
> Cheers,
> Achilleas
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=76154#76154
>
>
>
>
>
> ___
> 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] Huge perfomance issues

2019-05-31 Thread Achilleas Margaritis
The problem is I need to destroy my house every frame. 

There is no standard number of objects received; any object, with any 
configuration, can be received at any time.

My only choice is to destroy everything and repaint everything.

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





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


Re: [osg-users] Keeping camera fixed

2019-05-31 Thread Alberto Luaces
"Renzo Scaletta" writes:

> What I see is that the camera "follows" in some way the bodies movements 
> without having done anything in the code to trigger that behavior explicitly.

Hi, Renzo, certainly it shouldn't be happening by default.  I am
thinking about some possible causes (they could be more, of course):

a) You are using some sort of NodeTrackerManipulator attached to the
viewer, otherwise its matrix shouldn't change.

b) You are repeatedly calling the home() method, or just pressing SPACE,
so the view is enlarged or shrunk in order to fit the whole scene.

-- 
Alberto

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


Re: [osg-users] Huge perfomance issues

2019-05-31 Thread Alberto Luaces
"Achilleas Margaritis" writes:

> The problem is I need to destroy my house every frame. 
>
> There is no standard number of objects received; any object, with any 
> configuration, can be received at any time.
>
> My only choice is to destroy everything and repaint everything.

You can also modify the primitives and statesets instead of creating/destroying.

-- 
Alberto

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


Re: [osg-users] Huge perfomance issues

2019-05-31 Thread Werner Modenbach
There should be a better approach.

Just a quick idea:

For each kind of object keep an array of pointers to already created geodes.
If you don't need a certain geode switch it off in the osg::Switch.
If you get a request for a new one, check the switch for inactive geodes. If 
found, just alter it and activate it.
Otherwise append a new one.

In some way you need an organization for the objects.

Am 31.05.2019 um 17:34 schrieb Achilleas Margaritis:
> The problem is I need to destroy my house every frame. 
>
> There is no standard number of objects received; any object, with any 
> configuration, can be received at any time.
>
> My only choice is to destroy everything and repaint everything.
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=76162#76162
>
>
>
>
>
> ___
> 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] Huge perfomance issues

2019-05-31 Thread Achilleas Margaritis
So, in other words, keep objects preallocated and switch on only the necessary 
ones?

And if there is no current object that matches the existing ones, then and only 
then create a new one?

Not a bad idea, in fact.

Thanks a lot for the reply.

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





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


Re: [osg-users] Huge perfomance issues

2019-05-31 Thread Yu Qi
Hi,
  By the way,the default vertex specification of geometry is displaylist,if you 
need to change vertex frequently,use VAO and VBO.
  
Thank you!

Cheers,
Yu

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





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