[osg-users] how to move a sphere

2014-11-26 Thread Gianni Ambrosio
Hi All,
I need to move an osg::Sphere. I tried with setCenter() in vain. Looking around 
I didn't found a solution to redraw the sphere. Isn't there a solution 
different from attaching a PositionAttutudeTransform (or something like that) 
as parent of the Drawable and modify then the transformation instead of the 
sphere center?

Regards,
Gianni

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





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


Re: [osg-users] how to move a sphere

2014-11-26 Thread Robert Osfield
HI Gianni,

How to go about it will depend upon what you are trying to achieve with
your application.

At the most basic level it's likely that the ShadpeDrawable has created a
display list and you aren't calling dirty to force it rebuild it after the
change in settings to the osg::Sphere, try calling
shapedrawable-dirtyDisplayList(); after you update the Sphere.

While this might fix the immediate problem, it may well be that
ShapeDrawable/Sphere isn't at all the right tool for the problem you are
trying to solve.  ShapeDrawable is really just a very simple way of
visualizing the primitive osg::Shape objects.  These osg::Shape exist to
support collision detection/physics that end users may want to layer on top
of the OSG - this is why you can assign them to osg::Drawable, as they can
form a more accurate representation of an object than the simple
BoundingBox that is used for view frustum culling.  The ShapeDrawable was
really just intended to help debug and for very simple vis tasks, not as a
general purpose visualization tool.

The most efficient way to create data for visualization is using
osg::Geometry where proper OpenGL fast paths can be used so you can get the
best performance and full control over the whole spectrum of vertex
attributes that you don't have with ShapeDrawable/Shape.  If you have large
number of sphere objects you may also want to start looking at point
sprites or geometry instancing.

Robert.

Robert.



On 26 November 2014 at 08:40, Gianni Ambrosio g.ambrosio+...@gmail.com
wrote:

 Hi All,
 I need to move an osg::Sphere. I tried with setCenter() in vain. Looking
 around I didn't found a solution to redraw the sphere. Isn't there a
 solution different from attaching a PositionAttutudeTransform (or something
 like that) as parent of the Drawable and modify then the transformation
 instead of the sphere center?

 Regards,
 Gianni

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





 ___
 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] how to move a sphere

2014-11-26 Thread Gianni Ambrosio
Thank you very much for the clarifications and suggestions.
Gianni

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





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


Re: [osg-users] Improving this scene frame rate

2014-11-26 Thread Aitor Ardanza
Ok, I fix the problem of the original characters. I did not notice that the 
geometry node was inside the skeleto node, so when I add the skeleton into the 
scene the original models was loaded. My solution is this:

Code:
osg::ref_ptrosgAnimation::Skeleton skelroot = new osgAnimation::Skeleton;
skelroot-setDefaultUpdateCallback();
skelroot-addChild(dynamic_castosgAnimation::Bone*(finder._root.get()-getChild(1)));
builder-setSkeleton(skelroot.get());




Now I have the same scene of characters, with deformed movements, without 
models loaded in the 0,0,0.

The improvement with the hardware instances relative to the first version is 
very noticeable.

Any idea why the animations are wrong?

Thanks!

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





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


[osg-users] I love openscenegraph

2014-11-26 Thread ????
hello,,I love openscenegraph!!___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Multiple render targets not working.

2014-11-26 Thread Sander Meessen
I (sort of) solved the problem. I re-implemented the camera system according 
the Cookbook chapter 6 (which I only used partially the previous time) and 
frame buffer objects and multiple render targets worked. It was a combination 
of wrong camera settings and scene hierarchy.
Although I did run into the problem again that screen resizing did not work and 
it requires a complete re-creation of the RTT camera's every time, while with 
my previous setup I only had to rescale the textures and viewports.
Additionally for some reason the entities of the scene are in the wrong 
location compared to the spherical earth (from osgEarth). 
Since I already have spent too much time on this I will stick with the old 
setup for now and maybe come back to it some other time.

Thanks for the help.

Cheers,
Sander

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





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


[osg-users] setUseVertexBufferObjects(true) not effective after loading objects

2014-11-26 Thread Christian Buchner
Hi,

I wrote the following little node visitor to switch part of a scene graph
from using display lists to using VBOs.

class VBOVisitor : public osg::NodeVisitor
{
public:
VBOVisitor()
{
setTraversalMode(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN);
}

virtual void apply(osg::Node node)
{
osg::Geode *geode = node.asGeode();
if (geode != NULL)
{
for (unsigned int i = 0; i  geode-getNumDrawables(); i++)
{
osg::Drawable drawable = *geode-getDrawable(i);
drawable.setUseDisplayList(false);
drawable.setUseVertexBufferObjects(true);
}
}
traverse(node);
}
};



I use it like this before attaching the object to the Viewer and rendering
it.

osg::Node *object = osgDB::readNodeFile(some_object.osg);
VBOVisitor vbo;
object-accept(vbo);



The OSG file in question contains a lot of Drawbles with the flags
  useDisplayList TRUE
  useVertexBufferObjects FALSE

This prevents advanced rendering techniques such as hardware instancing.
The idea was to use the VBOVisitor to get the same effect as if I had
changed these lines to

  useDisplayList TRUE
  useVertexBufferObjects FALSE


Editing the OSG file manually works, but using the VBOVisitor instead does
not produce the desired effect (i.e. hardware instancing fails)

What am I missing?

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


Re: [osg-users] setUseVertexBufferObjects(true) not effective after loading objects

2014-11-26 Thread Christian Buchner
Hi,

above node visitor is actually working. I just happened to edit a .cpp file
of same name, but belonging to a different project. Hence my changes never
had any effect. ;-)

Christian



2014-11-26 15:29 GMT+01:00 Christian Buchner christian.buch...@gmail.com:

 Sorry, the second block of flags in my posting should have said this:

   useDisplayList FALSE
   useVertexBufferObjects TRUE


 2014-11-26 15:28 GMT+01:00 Christian Buchner christian.buch...@gmail.com
 :

 Hi,

 I wrote the following little node visitor to switch part of a scene graph
 from using display lists to using VBOs.

 class VBOVisitor : public osg::NodeVisitor
 {
 public:
 VBOVisitor()
 {
 setTraversalMode(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN);
 }

 virtual void apply(osg::Node node)
 {
 osg::Geode *geode = node.asGeode();
 if (geode != NULL)
 {
 for (unsigned int i = 0; i  geode-getNumDrawables(); i++)
 {
 osg::Drawable drawable = *geode-getDrawable(i);
 drawable.setUseDisplayList(false);
 drawable.setUseVertexBufferObjects(true);
 }
 }
 traverse(node);
 }
 };



 I use it like this before attaching the object to the Viewer and
 rendering it.

 osg::Node *object = osgDB::readNodeFile(some_object.osg);
 VBOVisitor vbo;
 object-accept(vbo);



 The OSG file in question contains a lot of Drawbles with the flags
   useDisplayList TRUE
   useVertexBufferObjects FALSE

 This prevents advanced rendering techniques such as hardware instancing.
 The idea was to use the VBOVisitor to get the same effect as if I had
 changed these lines to

   useDisplayList TRUE
   useVertexBufferObjects FALSE


 Editing the OSG file manually works, but using the VBOVisitor instead
 does not produce the desired effect (i.e. hardware instancing fails)

 What am I missing?

 Christian



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


Re: [osg-users] [osgPlugins] ffmpeg plugin halting during playback of some videos

2014-11-26 Thread Trystan Larey-Williams
As this issue effects a large number of videos and is important functionality 
for us, we're willing to pay someone for a fix. If interested, please contact 
j...@digitaliseducation.com. 

Thanks,
Trystan

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





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


[osg-users] Problem with osgText???

2014-11-26 Thread Alex Malygin
Hi,

I was faced with the following problem.
On the stage there are several osgText. I need to text disappeared when the 
point to which I add it is not visible on the stage or overlaps another object. 
I can not find a solution to the problem ety.

Thank you!

Cheers,
Alex

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





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


Re: [osg-users] [vpb] Unusual Error while running vpbmaster

2014-11-26 Thread Peter Schlau
Hi,
I keep getting this unusual error message when running the vpb Master.
I'm pretty sure there is no such file, and i couldn't google it because this 
file doesn't seem to exist at all.

This is my error:

 
 FindFileInPath() : trying /usr/lib/osgPlugins-3.2.1/osgdb_source.so ...
 itr='/usr/lib64/'
 FindFileInPath() : trying /usr/lib64/osgPlugins-3.2.1/osgdb_source.so ...
 itr='/usr/local/lib/'
 FindFileInPath() : trying /usr/local/lib/osgPlugins-3.2.1/osgdb_source.so ...
 itr='/usr/local/lib64/'
 FindFileInPath() : trying /usr/local/lib64/osgPlugins-3.2.1/osgdb_source.so 
 ...
 itr='/home/linux/OpenSceneGraph/lib/'
 FindFileInPath() : trying /home/linux/OpenSceneGraph/lib/osgdb_source.so ...
 itr='/home/linux/VirtualPlanetBuilder/lib/'
 FindFileInPath() : trying 
 /home/linux/VirtualPlanetBuilder/lib/osgdb_source.so ...
 itr='/usr/local/lib64/osgPlugins-3.2.1'
 FindFileInPath() : trying /usr/local/lib64/osgPlugins-3.2.1/osgdb_source.so 
 ...
 itr='/usr/lib/'
 FindFileInPath() : trying /usr/lib/osgdb_source.so ...
 itr='/usr/lib64/'
 FindFileInPath() : trying /usr/lib64/osgdb_source.so ...
 itr='/usr/local/lib/'
 FindFileInPath() : trying /usr/local/lib/osgdb_source.so ...
 itr='/usr/local/lib64/'
 FindFileInPath() : trying /usr/local/lib64/osgdb_source.so ...
 Warning: dynamic library 'osgPlugins-3.2.1/osgdb_source.so' does not exist 
 (or isn't readable):
 osgPlugins-3.2.1/osgdb_source.so: cannot open shared object file: No such 
 file or directory
 DynamicLibrary::failed loading osgPlugins-3.2.1/osgdb_source.so
 No data loaded
 
 Second attempt to load source file build_master.source also failed.
 


I hope someone can help me!

Thank you in advance!!

Cheers,
Peter[/quote][/code]

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





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


[osg-users] Vec3Array maximum size?

2014-11-26 Thread Max Müller
Hi all,

i want to draw a bunch of vertices into my scene, using Openscenegraph 3.3.1.
Therefore, i oriented towared the createBase-function from the Animate-example. 
Now if i have a small Vec3Array everything is fine (see first picture 1), but 
if the numTilesX and numTilesY (see code) are both set to 300, a very strange 
thing happens (see picture 2).
What did i overlook?

Here is the code of the createBase-function used: (nothing except the values 
for numTilesX and numTilesY was changed)

Code:

int numTilesX = 300;
int numTilesY = 300;

float width = 2*radius;
float height = 2*radius;

osg::Vec3 v000(center - osg::Vec3(width*0.5f,height*0.5f,0.0f));
osg::Vec3 dx(osg::Vec3(width/((float)numTilesX),0.0,0.0f));
osg::Vec3 dy(osg::Vec3(0.0f,height/((float)numTilesY),0.0f));

// fill in vertices for grid, note numTilesX+1 * numTilesY+1...
osg::Vec3Array* coords = new osg::Vec3Array;
int iy;
for(iy=0;iy=numTilesY;++iy)
{
for(int ix=0;ix=numTilesX;++ix)
{
coords-push_back(v000+dx*(float)ix+dy*(float)iy);
}
}

//Just two colours - black and white.
osg::Vec4Array* colors = new osg::Vec4Array;
colors-push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); // white
colors-push_back(osg::Vec4(0.0f,0.0f,0.0f,1.0f)); // black

osg::ref_ptrosg::DrawElementsUShort whitePrimitives = new 
osg::DrawElementsUShort(GL_QUADS);
osg::ref_ptrosg::DrawElementsUShort blackPrimitives = new 
osg::DrawElementsUShort(GL_QUADS);

int numIndicesPerRow=numTilesX+1;
for(iy=0;iynumTilesY;++iy)
{
for(int ix=0;ixnumTilesX;++ix)
{
osg::DrawElementsUShort* primitives = ((iy+ix)%2==0) ? whitePrimitives.get() : 
blackPrimitives.get();
primitives-push_back(ix +(iy+1)*numIndicesPerRow);
primitives-push_back(ix +iy*numIndicesPerRow);
primitives-push_back((ix+1)+iy*numIndicesPerRow);
primitives-push_back((ix+1)+(iy+1)*numIndicesPerRow);
}
}

// set up a single normal
osg::Vec3Array* normals = new osg::Vec3Array;
normals-push_back(osg::Vec3(0.0f,0.0f,1.0f));

osg::Geometry* geom = new osg::Geometry;
geom-setVertexArray(coords);

geom-setColorArray(colors, osg::Array::BIND_PER_PRIMITIVE_SET);

geom-setNormalArray(normals, osg::Array::BIND_OVERALL);

geom-addPrimitiveSet(whitePrimitives.get());
geom-addPrimitiveSet(blackPrimitives.get());



Thank you!

Cheers,
mfechter[/code][/quote]

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




Attachments: 
http://forum.openscenegraph.org//files/300x300_491.jpg
http://forum.openscenegraph.org//files/50x50_153.jpg


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


Re: [osg-users] Vec3Array maximum size?

2014-11-26 Thread Max Müller
Hi all,

in the meantime i found the mistake:

Code:
osg::ref_ptrosg::DrawElementsUShort whitePrimitives = new 
osg::DrawElementsUShort(GL_QUADS);


has to be 

Code:
osg::ref_ptrosg::DrawElementsUInt whitePrimitives = new 
osg::DrawElementsUInt(GL_QUADS);


because UShort only reaches from 0 .. 65535 :-* 

Cheers,
mfechter

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





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


Re: [osg-users] Vec3Array maximum size?

2014-11-26 Thread Sebastian Messerschmidt

Hi Max,

You are setting the limit yourself by using DrawElementsUShort. (Short 
== 65536, so I guess it will be working to 255*255)

Use DrawElementsUInt.
The second limit you might be hitting is the GL_MAX_ELEMENTS_VERTICES if 
glDrawArray is used.


Btw: What are you trying to achive? If you need a checkerboard you could 
use texturing ;-)


Cheers
Sebastian

Hi all,

i want to draw a bunch of vertices into my scene, using Openscenegraph 3.3.1.
Therefore, i oriented towared the createBase-function from the Animate-example. 
Now if i have a small Vec3Array everything is fine (see first picture 1), but 
if the numTilesX and numTilesY (see code) are both set to 300, a very strange 
thing happens (see picture 2).
What did i overlook?

Here is the code of the createBase-function used: (nothing except the values 
for numTilesX and numTilesY was changed)

Code:

int numTilesX = 300;
int numTilesY = 300;

float width = 2*radius;
float height = 2*radius;

osg::Vec3 v000(center - osg::Vec3(width*0.5f,height*0.5f,0.0f));
osg::Vec3 dx(osg::Vec3(width/((float)numTilesX),0.0,0.0f));
osg::Vec3 dy(osg::Vec3(0.0f,height/((float)numTilesY),0.0f));

// fill in vertices for grid, note numTilesX+1 * numTilesY+1...
osg::Vec3Array* coords = new osg::Vec3Array;
int iy;
for(iy=0;iy=numTilesY;++iy)
{
for(int ix=0;ix=numTilesX;++ix)
{
coords-push_back(v000+dx*(float)ix+dy*(float)iy);
}
}

//Just two colours - black and white.
osg::Vec4Array* colors = new osg::Vec4Array;
colors-push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); // white
colors-push_back(osg::Vec4(0.0f,0.0f,0.0f,1.0f)); // black

osg::ref_ptrosg::DrawElementsUShort whitePrimitives = new 
osg::DrawElementsUShort(GL_QUADS);
osg::ref_ptrosg::DrawElementsUShort blackPrimitives = new 
osg::DrawElementsUShort(GL_QUADS);

int numIndicesPerRow=numTilesX+1;
for(iy=0;iynumTilesY;++iy)
{
for(int ix=0;ixnumTilesX;++ix)
{
osg::DrawElementsUShort* primitives = ((iy+ix)%2==0) ? whitePrimitives.get() : 
blackPrimitives.get();
primitives-push_back(ix +(iy+1)*numIndicesPerRow);
primitives-push_back(ix +iy*numIndicesPerRow);
primitives-push_back((ix+1)+iy*numIndicesPerRow);
primitives-push_back((ix+1)+(iy+1)*numIndicesPerRow);
}
}

// set up a single normal
osg::Vec3Array* normals = new osg::Vec3Array;
normals-push_back(osg::Vec3(0.0f,0.0f,1.0f));

osg::Geometry* geom = new osg::Geometry;
geom-setVertexArray(coords);

geom-setColorArray(colors, osg::Array::BIND_PER_PRIMITIVE_SET);

geom-setNormalArray(normals, osg::Array::BIND_OVERALL);

geom-addPrimitiveSet(whitePrimitives.get());
geom-addPrimitiveSet(blackPrimitives.get());



Thank you!

Cheers,
mfechter[/code][/quote]

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




Attachments:
http://forum.openscenegraph.org//files/300x300_491.jpg
http://forum.openscenegraph.org//files/50x50_153.jpg


___
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