Re: [osg-users] 3D texture construction and fill it with magnitudes

2011-03-04 Thread Ulrich Hertlein
Hi Sajjadul,

On 4/03/11 18:13 , Sajjadul Islam wrote:
 I need to construct a 3D Texture and fill it with the magnitudes of the 
 displacements.
 
 I looked into the class Texture3D . But i did not find any operator or 
 function
 that let us to set the value at certain position in the texture as follows:
 
 img(x,y,z) = value.

You can't modify the Texture, but you can modify the associated Image which 
will then be
uploaded into the texture.

It doesn't look like there is an accessor for x,y,z (only x,y) but you can get 
the data
pointer (osg::Image::data) and work out the offset yourself.

Don't forget to call 'osg::Image::dirty()' when you're done so that it's 
uploaded.

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


Re: [osg-users] How to Develop/Create a Cylinder Intersector ??

2011-03-04 Thread Peter Hrenka
Hi Sanat,

Am 03.03.2011 20:21, schrieb Sanat Talmaki:
 Hi,
 
 I want to test for intersection in my scene using a cylinder instead of a 
 line segment. 
 
 For example if my object is on a terrain I want to highlight all features 
 that are within an imaginary cylinder around my object.
 
 I read about polytope intersector but it seems as though that is for planes 
 only or can I get cylinder intersector from there as well ?

You could use the PolytopeIntersector with a hexagonal shape
which envelops the cylinder and post-process the results.
This sould give you a good aproximation and little false
positives.

As was noted by Chris PolytopeIntersector can be very slow
if there are many Intersections in the picking volume.
That is because every primitive and every vertex that
is inside the volume is recorded in the result.

The kd-tree is not integrated into PolytopeIntersector
as of now.


 Any tips on how I can get started will be much appreciated.
 
 Thanks!
 
 Sincerely,
 Sanat.
 
 --

Cheers,

Peter
-- 
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Roland Niemeier, 
Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Michel Lepert
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196 


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


Re: [osg-users] About Depth_bound_Test

2011-03-04 Thread Robert Osfield
Hi Lee,

The OSG doesn't presently support the EXT_depth_bounds_test.  It
wouldn't be difficult to implement as a custom osg::StateAttribute.
Have a look at how other extensions are implemented in the OSG, such
as src/osg/TextEnvCombine.cpp.

Robert.

2011/3/4 heishuijing_2000 heishuijing_2...@126.com:
 Hi,
 I just want to know how to use Opengl Depth_Bound_Test in Osg.I have read
 through all the examples in Osg,but i can't find anything which can help me.
 Any help in this matter would be great! (If my explanation has not been
 clear, I would be happy to re-post)

 Thanks in advance.

 Sincerely,
 Lee




 ___
 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] [osgOcean] OceanExample - MakeTransform - Much different results with different boat model

2011-03-04 Thread Kim Bale

 Or you could make a small function that would find the bounding box of the
 model


There's an app for that :)

http://code.google.com/p/osgworks/

*osgwbvv:* A bounding volume visualizer to display bounding spheres and
boxes.

K.

On 4 March 2011 02:49, Jean-Sébastien Guay
jean-sebastien.g...@cm-labs.comwrote:

 Hi Tim,


  I still would like to know  the whys and wherefors and how comes
 surrounding this effect do different models have built in heights with
 respect to 0,0,0?


 It all depends on how the model was built in the modeling program...
 Clearly if one model's local origin (its own (0,0,0)) is 10 meters below the
 bottom of the hull, then when just naively placing it in the scene at the
 world origin, it will look like it's floating in the air...

 If you can't load the boat model in a modeling program, you can easily make
 a model that is just a plane at Z=0. Then load that along with your boat
 model, and see if the boat model floats high above that plane.

 There are a few solutions you could adopt to make sure this doesn't happen.
 You could make sure your models are built with a local origin that makes
 sense. For a boat it could be the center in XY, and Z at the normal
 waterline. For a car it might be in the center in XY, and Z at the bottom of
 the wheels.

 Or you could make a small function that would find the bounding box of the
 model (try the osg::ComputeBoundsVisitor) and then from that tries to find a
 correct position to move the local origin to, using a MatrixTransform to
 decorate your model's subgraph and setting that matrix to translate the
 local origin. For example if your boat was 10m higher than you wanted, the
 MatrixTransform would have a translation by (0,0,-10). Then you just pass
 that node as the new root of the model, and from then on the model will be
 placed correctly. This offset could also be stored in a config file, or you
 can save out the transform I just mentioned and use that instead of your
 previous model with a bad local origin.

 So, it's all about how your data was created. Hope this helps,

 J-S
 --
 __
 Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/

 ___
 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 Develop/Create a Cylinder Intersector ??

2011-03-04 Thread Robert Osfield
Hi Sanat,

The way I would tackle the task would be to write a ClinderIntersector
class along the lines of the existing osgUtil::LineSegmentIntersector.
  The only major difference would be how you do the intersection tests
with the bounding spheres, and bounding boxes of the nodes during the
IntersectionVisitor traversal, and the intersection tests of the
cylinder against the geometry data found in the Drawable leaves.

Robert.

On Thu, Mar 3, 2011 at 7:21 PM, Sanat Talmaki sanat.sch...@gmail.com wrote:
 Hi,

 I want to test for intersection in my scene using a cylinder instead of a 
 line segment.

 For example if my object is on a terrain I want to highlight all features 
 that are within an imaginary cylinder around my object.

 I read about polytope intersector but it seems as though that is for planes 
 only or can I get cylinder intersector from there as well ?

 Any tips on how I can get started will be much appreciated.

 Thanks!

 Sincerely,
 Sanat.

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





 ___
 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


[osg-users] GDebugger Free Licence

2011-03-04 Thread Kim Bale
Hi all,

I recently noticed that gDebugger is now giving out free licences.

http://www.gremedy.com/

It's a great tool so I thought I'd share the new for those that missed the
release.

Regards,

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


Re: [osg-users] Bug in AutoTransform ?

2011-03-04 Thread Miguel Lokida
I have found the problem but don't know where it comes from.

So I have this:

Root 
- positionAttitudeTransform - Group - AutoTransform - Geode1
 - Geode2

When geode2 has a bound radius that is equal to zero, then nothing is 
displayed. When it is greater than 0 everything is displayed.

Here the example code (modification from an osg example) that give me this 
strange behaviour:

ie: you can see the problem by modifying here in the code:

//Modify size of the quad here. 0 size and no display
group-addChild(setupQuad(0)); // DON'T WORK
//group-addChild(setupQuad(1)); // WORK


[/code]
#include iostream
#include osg/AutoTransform
#include osg/Geometry
#include osg/PositionAttitudeTransform
#include osg/Shape
#include osg/ShapeDrawable
#include osgViewer/Viewer
#include osgGA/TrackballManipulator
#include osg/MatrixTransform
#include osg/Material
#include osgAnimation/Sampler

osg::Geode* createAxis()
{
osg::Geode* geode  = new osg::Geode;  
osg::ref_ptrosg::Geometry geometry (new osg::Geometry());

osg::ref_ptrosg::Vec3Array vertices (new osg::Vec3Array());
vertices-push_back (osg::Vec3 ( 0.0, 0.0, 0.0));
vertices-push_back (osg::Vec3 ( 10.0, 0.0, 0.0));
vertices-push_back (osg::Vec3 ( 0.0, 0.0, 0.0));
vertices-push_back (osg::Vec3 ( 0.0, 10.0, 0.0));
vertices-push_back (osg::Vec3 ( 0.0, 0.0, 0.0));
vertices-push_back (osg::Vec3 ( 0.0, 0.0, 10.0));
geometry-setVertexArray (vertices.get());

osg::ref_ptrosg::Vec4Array colors (new osg::Vec4Array());
colors-push_back (osg::Vec4 (1.0f, 0.0f, 0.0f, 1.0f));
colors-push_back (osg::Vec4 (1.0f, 0.0f, 0.0f, 1.0f));
colors-push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
colors-push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
colors-push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
colors-push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
geometry-setColorArray (colors.get());

geometry-setColorBinding (osg::Geometry::BIND_PER_VERTEX);
geometry-addPrimitiveSet(new 
osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));

geode-addDrawable( geometry.get() );
geode-getOrCreateStateSet()-setMode(GL_LIGHTING, false);
return geode;
}

osg::Node* setupQuad(int size)
{
osg::Geode* geode = new osg::Geode;
   
osg::ref_ptrosg::Geometry geom = new osg::Geometry();

unsigned int numCoords = 4;
osg::Vec3 coords[] =
{
osg::Vec3(-size, size, 0),
osg::Vec3(-size, -size, 0),
osg::Vec3(size, -size, 0),
osg::Vec3(size, size, 0),
};

osg::ref_ptrosg::Vec3Array sommets = new osg::Vec3Array(numCoords, 
coords);

// vertices
geom-setVertexArray(sommets);

// normal
osg::ref_ptrosg::Vec3Array normale = new osg::Vec3Array;
normale-push_back(osg::Vec3(0.0f, 0.0f, 1.0f));
geom-setNormalArray(normale);
geom-setNormalBinding(osg::Geometry::BIND_OVERALL);

// texture coords
osg::ref_ptrosg::Vec2Array texCoords = new osg::Vec2Array(4);

(*texCoords)[0].set(1.0f, 1.0f);
(*texCoords)[1].set(1.0f, 0.0f);
(*texCoords)[2].set(0.0f, 0.0f);
(*texCoords)[3].set(0.0f, 1.0f); 

geom-setTexCoordArray(0, texCoords);

osg::ref_ptrosg::DrawArrays array = new 
osg::DrawArrays(osg::PrimitiveSet::QUADS, 0, 4);

geom-addPrimitiveSet(array);

geode-addDrawable(geom);

return geode;
}

int main (int argc, char* argv[])
{
osg::ArgumentParser arguments(argc, argv);
osgViewer::Viewer viewer(arguments);

osgGA::TrackballManipulator* manipulator = new 
osgGA::TrackballManipulator();
viewer.setCameraManipulator(manipulator);
  
osg::Group* root = new osg::Group;
root-setInitialBound(osg::BoundingSphere(osg::Vec3(10,0,10), 30));
root-addChild(createAxis());

//Add a simple quad to the group
osg::ref_ptrosg::PositionAttitudeTransform pat = new 
osg::PositionAttitudeTransform();
pat-setPosition( osg::Vec3(0,0, 0));

osg::ref_ptrosg::Group group = new osg::Group();

osg::ref_ptrosg::AutoTransform autoTransformNode = new 
osg::AutoTransform();
autoTransformNode-setAutoScaleToScreen(true);

autoTransformNode-addChild(setupQuad(5));

group-addChild(autoTransformNode);

//Add an other quad to the group

//Modify size of the quad here. 0 size and no display
group-addChild(setupQuad(0)); // DON'T WORK
//group-addChild(setupQuad(1)); // WORK

pat-addChild(group);

root-addChild(pat);

viewer.setSceneData( root );
viewer.realize();

while (!viewer.done()) 
{
viewer.frame();
}
}
[/code]

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






Re: [osg-users] Bug in AutoTransform ?

2011-03-04 Thread Robert Osfield
Hi Miguel,

It sounds like you are on to something w.r.t bounding volume being 0.
Could try disabling small feature culling for the viewer's main Camera
to see if it's the traversal of the subgraph that is not happening due
to small feature culling cutting short the traversal?

You can disable small feature culling via:

viewer.getCamera()-setCullingMode(
viewer.getCamera()-getCullingMode()  
~osg::CullSettings:SMALL_FEATURE_CULLING);

Robert.

On Fri, Mar 4, 2011 at 10:54 AM, Miguel Lokida mlok...@yahoo.fr wrote:
 I have found the problem but don't know where it comes from.

 So I have this:

 Root
 - positionAttitudeTransform - Group - AutoTransform - Geode1
                                                         - Geode2

 When geode2 has a bound radius that is equal to zero, then nothing is 
 displayed. When it is greater than 0 everything is displayed.

 Here the example code (modification from an osg example) that give me this 
 strange behaviour:

 ie: you can see the problem by modifying here in the code:

 //Modify size of the quad here. 0 size and no display
 group-addChild(setupQuad(0)); // DON'T WORK
 //group-addChild(setupQuad(1)); // WORK


 [/code]
 #include iostream
 #include osg/AutoTransform
 #include osg/Geometry
 #include osg/PositionAttitudeTransform
 #include osg/Shape
 #include osg/ShapeDrawable
 #include osgViewer/Viewer
 #include osgGA/TrackballManipulator
 #include osg/MatrixTransform
 #include osg/Material
 #include osgAnimation/Sampler

 osg::Geode* createAxis()
 {
    osg::Geode* geode  = new osg::Geode;
    osg::ref_ptrosg::Geometry geometry (new osg::Geometry());

    osg::ref_ptrosg::Vec3Array vertices (new osg::Vec3Array());
    vertices-push_back (osg::Vec3 ( 0.0, 0.0, 0.0));
    vertices-push_back (osg::Vec3 ( 10.0, 0.0, 0.0));
    vertices-push_back (osg::Vec3 ( 0.0, 0.0, 0.0));
    vertices-push_back (osg::Vec3 ( 0.0, 10.0, 0.0));
    vertices-push_back (osg::Vec3 ( 0.0, 0.0, 0.0));
    vertices-push_back (osg::Vec3 ( 0.0, 0.0, 10.0));
    geometry-setVertexArray (vertices.get());

    osg::ref_ptrosg::Vec4Array colors (new osg::Vec4Array());
    colors-push_back (osg::Vec4 (1.0f, 0.0f, 0.0f, 1.0f));
    colors-push_back (osg::Vec4 (1.0f, 0.0f, 0.0f, 1.0f));
    colors-push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
    colors-push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
    colors-push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
    colors-push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
    geometry-setColorArray (colors.get());

    geometry-setColorBinding (osg::Geometry::BIND_PER_VERTEX);
    geometry-addPrimitiveSet(new 
 osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));

    geode-addDrawable( geometry.get() );
    geode-getOrCreateStateSet()-setMode(GL_LIGHTING, false);
    return geode;
 }

 osg::Node* setupQuad(int size)
 {
    osg::Geode* geode = new osg::Geode;

        osg::ref_ptrosg::Geometry geom = new osg::Geometry();

        unsigned int numCoords = 4;
        osg::Vec3 coords[] =
        {
                osg::Vec3(-size, size, 0),
                osg::Vec3(-size, -size, 0),
                osg::Vec3(size, -size, 0),
                osg::Vec3(size, size, 0),
        };

        osg::ref_ptrosg::Vec3Array sommets = new osg::Vec3Array(numCoords, 
 coords);

        // vertices
    geom-setVertexArray(sommets);

        // normal
        osg::ref_ptrosg::Vec3Array normale = new osg::Vec3Array;
        normale-push_back(osg::Vec3(0.0f, 0.0f, 1.0f));
        geom-setNormalArray(normale);
        geom-setNormalBinding(osg::Geometry::BIND_OVERALL);

        // texture coords
        osg::ref_ptrosg::Vec2Array texCoords = new osg::Vec2Array(4);

        (*texCoords)[0].set(1.0f, 1.0f);
        (*texCoords)[1].set(1.0f, 0.0f);
        (*texCoords)[2].set(0.0f, 0.0f);
        (*texCoords)[3].set(0.0f, 1.0f);

        geom-setTexCoordArray(0, texCoords);

        osg::ref_ptrosg::DrawArrays array = new 
 osg::DrawArrays(osg::PrimitiveSet::QUADS, 0, 4);

        geom-addPrimitiveSet(array);

        geode-addDrawable(geom);

    return geode;
 }

 int main (int argc, char* argv[])
 {
    osg::ArgumentParser arguments(argc, argv);
    osgViewer::Viewer viewer(arguments);

    osgGA::TrackballManipulator* manipulator = new 
 osgGA::TrackballManipulator();
    viewer.setCameraManipulator(manipulator);

    osg::Group* root = new osg::Group;
    root-setInitialBound(osg::BoundingSphere(osg::Vec3(10,0,10), 30));
    root-addChild(createAxis());

        //Add a simple quad to the group
        osg::ref_ptrosg::PositionAttitudeTransform pat = new 
 osg::PositionAttitudeTransform();
        pat-setPosition( osg::Vec3(0,0, 0));

        osg::ref_ptrosg::Group group = new osg::Group();

        osg::ref_ptrosg::AutoTransform autoTransformNode = new 
 osg::AutoTransform();
        autoTransformNode-setAutoScaleToScreen(true);

        autoTransformNode-addChild(setupQuad(5));

        group-addChild(autoTransformNode);

        //Add an other quad to the group

      

Re: [osg-users] Trouble Understanding osgPick (pick example QSG)

2011-03-04 Thread Sanat Talmaki
Hi Tom,

My scene graph structure is:

Root--Terrain

Root--group1--model1
 --autotransform1
 --shapefileNode1

Root--group2--model2
 --autotransform2
 --shapefileNode2

I am trying to pick for model1 and model2 in my graph. 

So I have modified the pick function as follows: (I changed the polytope to 
have width = 2.0 and height = 100.0)

The thing that puzzles me is when I pick the screen from far out (not zooming 
in), and output all the nodes in nodePath, the model1 and model2 are not even 
displayed when I cout the names.

I don't know what I am doing wrong here so thought I would post the pick() code 
as well my scene graph structure.

Thanks in advance.

Sincerely,
Sanat.



Code:
//perform the pick operation
bool pick(const double x, double y, osgViewer::Viewer* viewer)
{
  //colors the drawable in yellow
  ColorVisitor highlighter;
  highlighter.setColor(1.0, 1.0, 0.0, 1.0);
  //colors the drawable in red i.e. the normal un-picked color
  ColorVisitor redVisitor;
  highlighter.setColor(1.0, 0.0, 0.0, 1.0);

  if(!viewer-getSceneData())
  //nothing to pick
  {   
return false;
  }
  double w(2.0);
  double h(100.0);
  osgUtil::PolytopeIntersector* picker = 
   new 
osgUtil::PolytopeIntersector(osgUtil::Intersector::PROJECTION, x-w, y-h, x+w, 
y+h);
  osgUtil::IntersectionVisitor iv(picker);
  viewer-getCamera()-accept(iv);
  //pipe1Model-accept(iv);

  if(picker-containsIntersections())
  {
const osg::NodePath nodePath = picker-getFirstIntersection().nodePath;
unsigned int idx = nodePath.size();
std::cout  -\n;
std::cout  size of nodePath is =   idx  std::endl;
while(idx--)
{
  std::cout  node name:   nodePath.at(idx)-getName()  
std::endl;
  //Find the group in the node path
  //This will be the group to attach our visitor to
  osg::Node* modelNode = dynamic_castosg::Node*(nodePath.at(idx));
  if(modelNode == NULL)
  {
continue; 
  }
  //if not NULL then a matrix transform was found in the nodePath
  if(_selectedNode != NULL)
  {
if(_selectedNode-getName() == Model1 || 
   _selectedNode-getName() == Model2)  
{
  //clear the previous selected node's callback to make it stop 
spinning
  //_selectedNode-setUpdateCallback(NULL);
  std::cout  _selectedNode-getName()  std::endl;
  _selectedNode-accept(redVisitor);
}
  }
  _selectedNode = modelNode;
  if(_selectedNode-getName() == Model1 || 
 _selectedNode-getName() == Model2)
  {
std::cout  _selectedNode-getName()  std::endl;
_selectedNode-accept(highlighter);
  }
  break;
}//while(...) 
if(!_selectedNode.valid())
{
  osg::notify()  Pick failed.  std::endl;
}
  }
  else if(_selectedNode.valid())
  {
//_selectedNode-setUpdateCallback(NULL); 
if(_selectedNode-getName() == Model1 || 
   _selectedNode-getName() == Model2)
{
  std::cout  _selectedNode-getName()  std::endl;
  _selectedNode-accept(highlighter);
  _selectedNode = NULL;
}
  }
  return _selectedNode.valid();
}



Thank you!

Cheers,
Sanat

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





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


Re: [osg-users] Bug in AutoTransform ?

2011-03-04 Thread Miguel Lokida
Hi Robert,

For me, using 
viewer.getCamera()-setCullingMode( viewer.getCamera()-getCullingMode()  
~osg::CullSettings::SMALL_FEATURE_CULLING);

make no difference.

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





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


Re: [osg-users] Bug in AutoTransform ?

2011-03-04 Thread Robert Osfield
Hi Miguel,

On Fri, Mar 4, 2011 at 12:02 PM, Miguel Lokida mlok...@yahoo.fr wrote:
 Hi Robert,

 For me, using
 viewer.getCamera()-setCullingMode( viewer.getCamera()-getCullingMode()  
 ~osg::CullSettings::SMALL_FEATURE_CULLING);

 make no difference.

At least this discounts it as a possible issue then ;-)

I'm not sure what you are expecting when trying to auto scale a zero
sized object, what exactly the auto scale code should be doing in the
case is something I'd need to think about, but in the end what ever it
does you still aren't go to the the zero sized object unless you use
points and keep small feature culling disabled.

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


Re: [osg-users] 16 Bit Image

2011-03-04 Thread Martin Großer
Hello Ulrich,

yes, the depth = 4 for RGBA, that's right. After the writing I want a 16 bit 
image (tiff or something linke this). I want to load this in another 
application and 8 bit per channel (red, green, blue and alpha) is too 
imprecise. So I need a 16 bit image.

I didn't get errors but the values are false in the image. It looks wrong. If I 
set all data values to 1.0f then I get a half transparent bluish image.

You see my problem? Or isn't it clear?

Thank you

Martin

 Original-Nachricht 
 Datum: Fri, 04 Mar 2011 09:06:13 +1100
 Von: Ulrich Hertlein u.hertl...@sandbox.de
 An: OpenSceneGraph Users osg-users@lists.openscenegraph.org
 Betreff: Re: [osg-users] 16 Bit Image

 Hi Martin,
 
 On 4/03/11 1:32 , Martin Großer wrote:
  I would like write a 16 bit image. I tried the follow:
  
  // image Data
  float* data = new float[width * height * depth];
 
 (float != 16-bit, but float seems to be what you're after?  'depth' == 4? 
 For RGBA?)
 
  // set data to image
  img-setImage(width, height, 1, GL_RGBA16F_ARB, GL_RGBA, GL_FLOAT,
 (unsigned char*) data, Image::USE_NEW_DELETE);
  
  osgDB::writeImageFile(*img, test_image.tiff);
  
  How can I do this?
 
 My divining rod seems to be broken.  What is the problem again?
 Do you get an error?  Does it crash?  Does it look wrong?
 
 Cheers,
 /ulrich
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

-- 
NEU: FreePhone - kostenlos mobil telefonieren und surfen!   
Jetzt informieren: http://www.gmx.net/de/go/freephone
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] 16 Bit Image

2011-03-04 Thread Robert Osfield
Hi Martin,

The osg::Image::setInternalTextureFormat(..) only affects what the
osg::Texture will do with passing the image data to OpenGL.  In you
case you have an Image that is full 32bit floats, it won't store the
image data as 16bit floats, it's only down on the GPU that you'll find
the 16bit floats.

Given this it's not surprising that the tiff plugin won't write half
floats, and it only has full floats to write out.  I'd be surprised in
tiff even supports 16bit floats.   Tiff will support ushort images
though, so perhaps this is the route you should go.

Robert.

2011/3/4 Martin Großer grosser.mar...@gmx.de:
 Hello Ulrich,

 yes, the depth = 4 for RGBA, that's right. After the writing I want a 16 bit 
 image (tiff or something linke this). I want to load this in another 
 application and 8 bit per channel (red, green, blue and alpha) is too 
 imprecise. So I need a 16 bit image.

 I didn't get errors but the values are false in the image. It looks wrong. If 
 I set all data values to 1.0f then I get a half transparent bluish image.

 You see my problem? Or isn't it clear?

 Thank you

 Martin

  Original-Nachricht 
 Datum: Fri, 04 Mar 2011 09:06:13 +1100
 Von: Ulrich Hertlein u.hertl...@sandbox.de
 An: OpenSceneGraph Users osg-users@lists.openscenegraph.org
 Betreff: Re: [osg-users] 16 Bit Image

 Hi Martin,

 On 4/03/11 1:32 , Martin Großer wrote:
  I would like write a 16 bit image. I tried the follow:
 
  // image Data
  float* data = new float[width * height * depth];

 (float != 16-bit, but float seems to be what you're after?  'depth' == 4?
 For RGBA?)

  // set data to image
  img-setImage(width, height, 1, GL_RGBA16F_ARB, GL_RGBA, GL_FLOAT,
 (unsigned char*) data, Image::USE_NEW_DELETE);
 
  osgDB::writeImageFile(*img, test_image.tiff);
 
  How can I do this?

 My divining rod seems to be broken.  What is the problem again?
 Do you get an error?  Does it crash?  Does it look wrong?

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

 --
 NEU: FreePhone - kostenlos mobil telefonieren und surfen!
 Jetzt informieren: http://www.gmx.net/de/go/freephone
 ___
 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] Bug in AutoTransform ?

2011-03-04 Thread Miguel Lokida
In fact, I use one geode to display an object and a second geode to display the 
trajectory of this object. When the object doesn't move, the trajectory as a 
zero bounding radius. 

Moreover, I can't know if my objects will move or not. So I can't know if their 
trajectories will have a zero bounding radius.  To avoid the problem, I verify 
the bound radius of my geometry and if it 0, I don't add it to the geode. But I 
find that it's not a good issue.

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





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


Re: [osg-users] 3D texture construction and fill it with magnitudes

2011-03-04 Thread Sajjadul Islam
Hello Ulrich,

Thanks for the hint. I should have explained a little more.

I am calculating a distance map and want to store it in the 3D texture for 
pixel processing.

Which function should i used inside Texture3D to store the 3D data.

Is this data be need to be stored as image. The corresponding OpenGL 

command could be as follows:


Code:


glTexImage3D(GL_TEXTURE_3D, 0, 1, width, height, depth, 0, GL_RED, 
GL_UNSIGNED_SHORT, final.m_data);

DistanceMap final(width, height, depth, 1);

for (int z = 0; z  depth; z++) 
{
  for (int y = 0; y  height; y++) 
  {
for (int x = 0; x  width; x++) 
{
   double value = 0;
   for (int i = 0; i  3; i++) 
   {
  value += dmap(x, y, z, i)*dmap(x, y, z, i);
   }
  
   value = sqrt(value)/depth;
   if (value  1.0) 
  value = 1.0;
 
   final(x, y, z, 0) = value; 
}  
  }   
}






I want to achieve the same scenario using OSG. Even if i set  the distance map 
using the osg::Image, how do i store 3 dimensional data in image using data(int 
col,int row) where i need the depth index as well? 

Regards
Sajjadul

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





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


Re: [osg-users] Trouble Understanding osgPick (pick example QSG)

2011-03-04 Thread Tom Pearce
Hi Sanat,


Code:
const osg::NodePath nodePath = picker-getFirstIntersection().nodePath;


is only giving you the first intersection, which may not be either of your 
models (it could be terrain, for example).  I'm guessing you need to search the 
entire set rather than just trying the first intersection.


Code:

Intersections osgUtil::PolytopeIntersector::getIntersections   ()
typedef std::setIntersection osgUtil::PolytopeIntersector::Intersections





Cheers,
Tom

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





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


Re: [osg-users] Textures Problem!!! Urgent!!

2011-03-04 Thread Nectarios Pelekanos
Hi,

I managed to solve the problem by setting the display List to false. But i did 
this by converting the models to osg and changing the display list from there.

Does anyone know how can i set the display list false globally?

Thank you!

Cheers,
Nectarios

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





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


[osg-users] FBX plugin use (was: [osgPlugins] Michael Platings)

2011-03-04 Thread Alberto Luaces
Josue Hernandez writes:

 i dont mix the versions, i just said that i route the path to the adress of 
 osg 2.8.3. but wherever, let's star again: after that i compile the .sln that 
 genered the cmake, what next?

Throw a FBX file to osganimationviewer.

P.S.: Dont't mix the versions!
-- 
Alberto

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


Re: [osg-users] Texture Problem with ATI Radeon Mobility!!!!

2011-03-04 Thread Nectarios Pelekanos
Hi,

The problem is solved, it was what Sergev mentioned above, setting the display 
list off.

But how can I do it globally? Now I am setting the display list off in the osg 
code of the model

Thank you!

Cheers,
Nectarios

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





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


[osg-users] Display List

2011-03-04 Thread Nectarios Pelekanos
Hi,

I recently faced a problem with messed up textures on ATI GPU while it was 
working fine on nVidia GPU. The problem was fixed by setting the Display List 
to FALSE.

My problem is that I am using osgDB to load .obj and .3ds files in my 
application and I dont know how to set the display list off.  

As a temporary solution I have converted mt models to .osg and disabled the 
display list from the osg files.

Thank you!

Cheers,
Nectarios

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





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


Re: [osg-users] Display List

2011-03-04 Thread Jean-Sébastien Guay

Hi Nectarios,


My problem is that I am using osgDB to load .obj and .3ds files in my 
application and I dont know how to set the display list off.


There's no global setting that will disable display lists for all files 
loaded. Why don't you just write a small NodeVisitor that traverses the 
loaded file and turns off display lists on every geometry?


J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] How can I change the RGBA value of the shadow?

2011-03-04 Thread Sebastian Messerschmidt

Hi Matthew,

I think i have answered this question like two times before, so please 
try to look into the forum/archives next time.
Anyway, probably  you'll have to modify the shader source to change the 
color. Usually after the depth compare the shadowed fragments are given 
the a biased ambient color.
The lines you are looking for are in the SoftShadowMap.cpp right in the 
beginning.
(somewhere around  gl_FragColor = gl_Color * (osgShadow_ambientBias.x + 
shadow * osgShadow_ambientBias.y); \n)
IIRC you can set a custom shader to all ShadowMap techniques, so just 
clone this one from the cpp and bind it manually.


cheers
Sebastian

I've got the same question as the OP, I'm using the SoftShadowMap class in my 
program and would like to change the shadow colour to something other than 
black. I had a look through the source of SoftShadowMap but couldn't find an 
obvious answer (still fairly new to OSG). Any help would be appreciated!

Cheers,
Matthew

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





___
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] Trouble Understanding osgPick (pick example QSG)

2011-03-04 Thread Sanat Talmaki
Thanks Tom. I will try that out.

Cheers,
Sanat.

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





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


Re: [osg-users] How to Develop/Create a Cylinder Intersector ??

2011-03-04 Thread Sanat Talmaki
Hi Wang, Rob, Peter,

Thanks for your replies. I try using CylinderIntersector and post my feedback.

Cheers,
Sanat

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





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


[osg-users] [osgPlugins] Problem writing COLLADA node animation

2011-03-04 Thread Rob Chadwick
I'm not sure if this is the right place to post this - if there is a developers 
forum I missed it. I'm doing format conversion work using osg, and I recently 
upgraded to 2.9.8. I've been testing the COLLADA plugin by loading, saving and 
reloading models. It looks like the order of the transforms written in 
daeWriter::writeUpdateTransformElements should be scale, translate, 
rotationZ,Y,X. Currently, the translation is written last - this causes 
animated transforms to be in the wrong coord space when reading then writing 
animated DAE files. 

Also of note: I've only tried this with DAE file exported from 3DSMax, but some 
with openCollada, and some with the built in FBX DAE writer. 

I guess I should check the svn head and see if this is still in there.
 
Cheers,
Rob

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





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


[osg-users] Kinect

2011-03-04 Thread Chris 'Xenon' Hanson
  I recently published some info I've learned about Kinect on my web page.

http://xenon.arcticus.com/kinect-z-buffer-noise-and-audio-beam-steering-precision

  I'd like to talk to other OSG people who are using, or plan to use Kinect, 
and see what
you're up to.

-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com 
http://www.alphapixel.com/
  Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. 
Contracting.
There is no Truth. There is only Perception. To Perceive is to Exist. - 
Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] NSM file format

2011-03-04 Thread Chris 'Xenon' Hanson
  A student of mine is interested in loaded NSM-format solid geometry into OSG 
for
non-visual analysis purposes.

  I'm not very familiar with the NSM format myself. What application produces 
this data?

  I notice one other OSG user worked on an NSM loader, but they are apparently 
not able to
share code at this time. I'm just checking to see if anyone else worked on one 
before I
advise the folks to start their own from scratch. If there's an existing F/OSS 
one I
expect they would be happy to collaborate, but if they roll their own, I don't 
know if I
can convince them to share it either.

-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com 
http://www.alphapixel.com/
  Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. 
Contracting.
There is no Truth. There is only Perception. To Perceive is to Exist. - 
Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Textures Problem!!! Urgent!!

2011-03-04 Thread Robert Osfield
Hi Nectarios,

On Fri, Mar 4, 2011 at 3:21 PM, Nectarios Pelekanos
 Does anyone know how can i set the display list false globally?

There is no global settings for display lists, you just have to set
each Drawable separately.   It's easy to write a visitor that finds
the Geodes and then sets the Drawable settings. i.e


class DisableDisplayListsVisitor : public osg::NodeVisitor
{
public:

DisableDisplayListsVisitor():
  osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}

void apply(osg::Geode geode)
{
 for(unsigned int i=0; igeode.getNumDrawables(); ++i)
 {
 geode.getDrawable(i)-setUseDisplayList(false);
 }
}
};

// then to run it..
DisableDisplayListVisitor ddlv;
node-accept(ddlv);

You can customize this visitor to switch on VBO's etc.

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


Re: [osg-users] [osgOcean] OceanExample - MakeTransform - Much different results with different boat model

2011-03-04 Thread tim paige
J.S, Kim...

Thank you!
I wasn't expecting multiple models to exhibit the same behaviour. I'll try some 
different types other than collada models to see how they do.

I'll see about the bounding box idea... sounds useful... Thanks for the tips.

I'll keep studying... there is much I would like to do with this over and under 
water world... mostly under, but I'm really interested in my own project of 
building a nice underwater vehicle with navigation, sonar, inertial guidance 
and hopefully without tether... of course I need to start with tether so far, 
and will have to learn much to get there.

As part of the design... modeling came into play, and I am trying to get up to 
speed. OSGOcean will be a neat way of realizing part of my hopes.

A small step in this direction is trying to place my vehicle model into the 
environment and be able to control its multiple motors within OSGOcean.
Ahhh so much time and so little to do. 

I did a small bit of Blender, then switched to sketchup for speed, and then 
found the relationship of it to collada. I'll get it over here soon. 

I'm a diver, and so found e-diving on the net... and the Venus underwater 
simulator project sounds great. Hope to know enough to help some day.

Thanks for the basics. Looking forward to lights, cameras and ACTION!

Cheers,
tim

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





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


[osg-users] Retrieved Vertices for FLT Model Not Consistent

2011-03-04 Thread Steven Sell
Hi,

I am currently using a NodeVisitor to traverse the osg::Node of a .flt model 
loaded in by osgDB::readNodeFile( ) to retrieve the vertices that belong to it. 
I am doing this because I need access to do volume calculations on the model.

I am successfully getting the vertices, but despite using the same model, 
loaded into the same position, they are not consistent from one program run to 
another (but they remain constant within the same run). What follows is the 
code used to retrieve the vertices:

MMTVolumeTestVisitor.h

Code:

//--

#ifndef __MMT_VOLUME_TEST_VISITOR_H__
#define __MMT_VOLUME_TEST_VISITOR_H__

//--

#include glue.h

//--

namespace MMT
{
class VolumeVisitor : public osg::NodeVisitor
{
public:
VolumeVisitor( );
~VolumeVisitor( );

virtual void apply( osg::Node node );
virtual void apply( osg::Geode geode );

std::list osg::Geode*  getGeode( );

private:
std::list osg::Geode*  m_Geodes;

};
}

//--

#endif // __MMT_VOLUME_TEST_VISITOR_H__




MMTVolumeTestVisitor.cpp

Code:

//--

#include MMTVolumeTestVisitor.h

//--

namespace MMT
{
VolumeVisitor::VolumeVisitor( )
: osg::NodeVisitor( osg::NodeVisitor::TRAVERSE_ALL_CHILDREN )
{

}

VolumeVisitor::~VolumeVisitor( )
{

}


//--

void VolumeVisitor::apply( osg::Node node )
{
traverse( node );
}


//--

void VolumeVisitor::apply( osg::Geode geode )
{
m_Geodes.push_back( geode );
}


//--

std::list osg::Geode*  VolumeVisitor::getGeode( )
{
return m_Geodes;
}
}




MMTVolumeTest.cpp

Code:

bool VolumeTester::calculateFLTVolume( )
{
std::vector osg::Vec3  vertices;


//--
//Get the list of geodes contained within the node

MMT::VolumeVisitor visitor;

m_FLT-head-accept( visitor );

std::list osg::Geode*  geodeList = visitor.getGeode( );


//--
//With the geodes known, we can access their geometries and their 
vertices

std::list osg::Geode* ::iterator geodeIter;

for( geodeIter = geodeList.begin( ); geodeIter != geodeList.end( ); 
geodeIter++ )
{
for( int i = 0; i != ( *geodeIter )-getNumDrawables( ); i++ )
{
osg::Vec3Array* tempVerts = dynamic_cast osg::Vec3Array* ( ( 
*geodeIter )-getDrawable( i )-asGeometry( )-getVertexArray( ) );

if( tempVerts )
{
for( int j = 0; j != tempVerts-size( ); j++ )
{
vertices.push_back( tempVerts-at( j ) );
}
}
}
}

getMeshVolume( vertices );

m_FLTVertCount = vertices.size( );
m_XMLVertCount = m_XML-componentVector.size( ) * 8;

return true;
}




getMeshVolume( std::vector osg::Vec3  verts ) is an implementation of the 3D 
Volume calculation found in the article titled Area and Volume Calculations 
on Gamedev dot net (not enough posts to actually link).

But as you can see, the MMTVolumeTestVisitor simply traverses a node and stores 
every Geode that it finds. These are then passed to calculateFLTVolume( ) with 
the MMT::VolumeVisitor::getGeode( ) call. Then calculateFLTVolume iterates 
through the list and stores away all of the individual osg::Vec3 objects into a 
vector. This new vector is provided to getMeshVolume( ).

From everything that I have read, I am accessing these vertices correctly. So 
does anyone have any idea why they are changing from one program run to 
another? (This change is also affecting the calculated volume)

Thank you!

Cheers,
Steven[/code][/b]

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





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


[osg-users] Move Default Near Culling Plane

2011-03-04 Thread Robert Kern
Hi,

I'm trying to figure out how to move the near culling plane closer to the 
camera for a VR application I'm working on. Currently, parts of my models are 
being culled before they reach the viewing plane of the HMD. Can anyone help me 
out with this?

Thank you!

Cheers,
Robert

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





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


Re: [osg-users] Move Default Near Culling Plane

2011-03-04 Thread Robert Osfield
Hi Robert,

The Viewer's osg::Camera inherits from osg::CullSettings, and this
class provides all the controls for how the near/far planes are
computed.  Two approaches you can take are to reduce the
ComputeNearFarRatio to move the near plane towards the eye, or switch
of ComputeNearFarMode so that the near/far plane isn't computed on the
fly, and instead the near/far settings from the projection matrix are
used.

Have a look at include/osg/CullSettings for all the details.

Robert.

On Fri, Mar 4, 2011 at 8:38 PM, Robert Kern rjk...@clemson.edu wrote:
 Hi,

 I'm trying to figure out how to move the near culling plane closer to the 
 camera for a VR application I'm working on. Currently, parts of my models are 
 being culled before they reach the viewing plane of the HMD. Can anyone help 
 me out with this?

 Thank you!

 Cheers,
 Robert

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





 ___
 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] Cannot find dlls during execution of program.

2011-03-04 Thread Joseph Louis
Hi Jean,

First of all, let me thank you very much for taking the time to answer my 
query. I apologize for not having read the earlier post - I will do so as soon 
as I can, and for my lack of the basic knowledge of windows programming- I am a 
noob and working on improving it. I have taken your advice and removed the dlls 
from the system32 folder.

You were right about me assuming that the OS would look at OSG_BIN_PATH just 
because it was specified as a system path. I was following the documentation on 
setting up OSG given at osghelp.com and I missed the part that says add 
OSG_BIN_PATH to Path as it did not appear to be a step to be taken. I have 
added the path now and it is working fine.

I did gain a lot of knowledge about paths from your reply and wish did learn 
not to post on here, before exhausting all options -  a lesson well learnt. 

Thanks once again for your reply!
Cheers,
Joseph

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





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


Re: [osg-users] Cannot find dlls during execution of program.

2011-03-04 Thread Jean-Sébastien Guay

Hi Joseph,


First of all, let me thank you very much for taking the time to answer my 
query. I apologize for not having read the earlier post - I will do so as soon 
as I can, and for my lack of the basic knowledge of windows programming- I am a 
noob and working on improving it. I have taken your advice and removed the dlls 
from the system32 folder.


Noob is such a negative term. It is fine being new to something, and in 
the process of learning. But you need to read a lot in that case, and 
try to find out the real reason why something works the way it does. 
Sometimes abstractions are good, but sometimes they make things harder 
to figure out when something goes wrong... :-)


When learning programming it's important to understand the general 
process that your code follows before being executed, and in this case, 
the fact that dynamic libraries are loaded at runtime from some specific 
places on your system is important knowledge.



You were right about me assuming that the OS would look at OSG_BIN_PATH just 
because it was specified as a system path. I was following the documentation on 
setting up OSG given at osghelp.com and I missed the part that says add 
OSG_BIN_PATH to Path as it did not appear to be a step to be taken. I have 
added the path now and it is working fine.


Yeah, that's one bad thing about following tutorials sometimes. They 
often don't explain why you need to do some things, and you could then 
assume that some step is not important and skip it. So another lesson to 
learn, to be a bit more critical of the information you read in 
tutorials on the web... (which is true about pretty much any information 
on the web, as you surely know :-) )



I did gain a lot of knowledge about paths from your reply and wish did learn 
not to post on here, before exhausting all options -  a lesson well learnt.


Hmm, I'm sorry if I made it sound that way. You don't have to exhaust 
all options, not at all. The community here is very friendly (I hope the 
tone of my reply didn't convince you otherwise) and we'll generally be 
open to answering pretty much any question. This particular problem has 
been asked a lot in the past few weeks though, as I said in my reply, 
and that's why I wished you had looked at some other messages (the 
archive or the forum).


In general I know that whenever I have a problem, what I'd like is to 
get it solved as quickly as possible. So if I can find the information 
quickly by searching the archives (searching is an art, but again it's 
something you can get better at) I get an answer quicker. But whenever I 
see conflicting information or don't find a clear answer, I will ask on 
the mailing list, and I hope you will continue to do so too.


In any case, glad I could help, and have fun coding great graphics 
programs with OSG!


J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Textures Problem!!! Urgent!!

2011-03-04 Thread Nectarios Pelekanos
Thanks Robert, I will give it a try

Thank you!

Cheers,
Nectarios

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





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


Re: [osg-users] Cannot find dlls during execution of program.

2011-03-04 Thread Paul Martz
Just FYI, osgWorks (osgworks.googlecode.com) contains a command line utility 
'osgwwhich' that is useful for, among other tasks, locating OSG libraries. It 
can come in handy if you have multiple versions of OSG installed on your system 
and want to know which one you're getting.


It can find OSG libraries, like osgUtil for example:

C:\Projectsosgwwhich -l osgUtil
C:\Program Files\OpenSceneGraph\bin\osg65-osgUtil.dll

...Or it can find OSG plugins, say, the FLT loader:

C:\Projectsosgwwhich -p FLT
Using plugin name: osgPlugins-2.8.3/osgdb_openflight.dll.
C:\Program Files\OpenSceneGraph\bin\osgPlugins-2.8.3\osgdb_openflight.dll

...And by default it locates model files:

C:\Projectsosgwwhich teapot.osg
C:\Projects\ISU\osgWorks\data\teapot.osg


I hope this is helpful.
   -Paul

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


Re: [osg-users] Retrieved Vertices for FLT Model Not Consistent

2011-03-04 Thread Paul Martz
What you're saying doesn't really make sense. You say you're loading the same 
model but getting different vertices each time you load it. What makes you think 
the vertices are different? Does the model render differently and appear 
visually different for each invocation of osgviewer?


Just for grins, I converted the dumptruck model to FLT, then examined its 
bounding volume with osgwbvv (from osgWorks.googlecode.com), and I got the same 
bounding volume (as you would expect) three times in a row...


C:\Projectsosgconv dumptruck.osg dumptruck.flt
Data written to 'dumptruck.flt'.

C:\Projectsosgwbvv --box dumptruck.flt
Box:
Center  -6.40033 1.96224 0.000794888
Radius  16.6002
Extents 29.5609 9.09289 12.072

C:\Projectsosgwbvv --box dumptruck.flt
Box:
Center  -6.40033 1.96224 0.000794888
Radius  16.6002
Extents 29.5609 9.09289 12.072

C:\Projectsosgwbvv --box dumptruck.flt
Box:
Center  -6.40033 1.96224 0.000794888
Radius  16.6002
Extents 29.5609 9.09289 12.072

I'd think if I were (for some reason) getting different vertices, then it would 
be likely that the bounding box would be different for one of those runs.


I suspect there is an issue in your code somewhere, or in your interpretation of 
the data.

   -Paul



On 3/4/2011 11:13 AM, Steven Sell wrote:

Hi,

I am currently using a NodeVisitor to traverse the osg::Node of a .flt model 
loaded in by osgDB::readNodeFile( ) to retrieve the vertices that belong to it. 
I am doing this because I need access to do volume calculations on the model.

I am successfully getting the vertices, but despite using the same model, 
loaded into the same position, they are not consistent from one program run to 
another (but they remain constant within the same run). What follows is the 
code used to retrieve the vertices:

MMTVolumeTestVisitor.h

Code:

//--

#ifndef __MMT_VOLUME_TEST_VISITOR_H__
#define __MMT_VOLUME_TEST_VISITOR_H__

//--

#include glue.h

//--

namespace MMT
{
 class VolumeVisitor : public osg::NodeVisitor
 {
 public:
 VolumeVisitor( );
 ~VolumeVisitor( );

 virtual void apply( osg::Nodenode );
 virtual void apply( osg::Geodegeode );

 std::list  osg::Geode*  getGeode( );

 private:
 std::list  osg::Geode*  m_Geodes;

 };
}

//--

#endif // __MMT_VOLUME_TEST_VISITOR_H__




MMTVolumeTestVisitor.cpp

Code:

//--

#include MMTVolumeTestVisitor.h

//--

namespace MMT
{
 VolumeVisitor::VolumeVisitor( )
 : osg::NodeVisitor( osg::NodeVisitor::TRAVERSE_ALL_CHILDREN )
 {

 }

 VolumeVisitor::~VolumeVisitor( )
 {

 }

 
//--

 void VolumeVisitor::apply( osg::Nodenode )
 {
 traverse( node );
 }

 
//--

 void VolumeVisitor::apply( osg::Geodegeode )
 {
 m_Geodes.push_back(geode );
 }

 
//--

 std::list  osg::Geode*  VolumeVisitor::getGeode( )
 {
 return m_Geodes;
 }
}




MMTVolumeTest.cpp

Code:

bool VolumeTester::calculateFLTVolume( )
 {
 std::vector  osg::Vec3  vertices;

 
//--
 //Get the list of geodes contained within the node

 MMT::VolumeVisitor visitor;

 m_FLT-head-accept( visitor );

 std::list  osg::Geode*  geodeList = visitor.getGeode( );

 
//--
 //With the geodes known, we can access their geometries and their 
vertices

 std::list  osg::Geode*::iterator geodeIter;

 for( geodeIter = geodeList.begin( ); geodeIter != geodeList.end( ); 
geodeIter++ )
 {
 for( int i = 0; i != ( *geodeIter )-getNumDrawables( ); i++ )
 {
 osg::Vec3Array* tempVerts = dynamic_cast  osg::Vec3Array*( ( 
*geodeIter )-getDrawable( i )-asGeometry( )-getVertexArray( ) );

 if( tempVerts )
 {
 for( int j = 0; j != tempVerts-size( ); j++ )
 {
 vertices.push_back( tempVerts-at( j ) );

Re: [osg-users] Move Default Near Culling Plane

2011-03-04 Thread Paul Martz
Try setting a smaller near/far ratio. The default it 0.0005. The quick way to 
try this is with the environment variable. Set it to 0.0001 for example:

  OSG_NEAR_FAR_RATIO=0.0001
You can also set it programmatically; see include\osg\CullSettings.
   -Paul


On 3/4/2011 1:38 PM, Robert Kern wrote:

Hi,

I'm trying to figure out how to move the near culling plane closer to the 
camera for a VR application I'm working on. Currently, parts of my models are 
being culled before they reach the viewing plane of the HMD. Can anyone help me 
out with this?

Thank you!

Cheers,
Robert

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





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





--
  -Paul Martz  Skew Matrix Software
   http://www.skew-matrix.com/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Show a model in the front of the texture background of a viewer

2011-03-04 Thread Tang Yu
Hi,

I want to put a IVE Model in the viewer which renders a Texture2D Image as the 
viewer's whole background. 
Now, I put the texture image into a camera and rendered as the background 
successfully. The code is below:

Code:

-(osg::Node *) create2DBGTexture 
{ 
   unsigned int w = 480; 
   unsigned int h = 320; 

   float vx = (float)w; 
   float vy = (float)h; 

   osg::ref_ptrosg::Geometry rectBG_geom = new osg::Geometry; 

   osg::Vec3Array * vertices = new osg::Vec3Array; 
   vertices-push_back(osg::Vec3(0.0, 0.0, -1.0)); 
vertices-push_back(osg::Vec3(0.0, vy, -1.0)); 
vertices-push_back(osg::Vec3(vx, vy, -1.0)); 
vertices-push_back(osg::Vec3(vx, 0.0, -1.0)); 
rectBG_geom-setVertexArray(vertices); 

osg::Vec2Array * texcoords = new osg::Vec2Array; 
texcoords-push_back(osg::Vec2(0.0, 0.0625)); 
texcoords-push_back(osg::Vec2(0.0, 0.9375)); 
texcoords-push_back(osg::Vec2(1.0, 0.9375)); 
texcoords-push_back(osg::Vec2(1.0, 0.0625)); 
rectBG_geom-setTexCoordArray(0,texcoords); 

osg::Vec3Array * normals = new osg::Vec3Array; 
normals-push_back(osg::Vec3(0.0f,0.0f,1.0f)); 
rectBG_geom-setNormalArray(normals); 
rectBG_geom-setNormalBinding(osg::Geometry::BIND_OVERALL); 

   rectBG_geom-addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,4)); 

   BG_image = new osg::Image; 
   BG_image-setImage(AVWidth, AVHeight, 1, GL_RGBA, GL_BGRA, GL_UNSIGNED_BYTE, 
pAVImage, osg::Image::NO_DELETE); 

BG_texture = new osg::Texture2D; 
BG_texture-setDataVariance(osg::Object::DYNAMIC); 
   BG_texture-setImage(BG_image); 
   BG_texture-setResizeNonPowerOfTwoHint(false); 
   BG_texture-setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::NEAREST); 
   BG_texture-setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::NEAREST); 

   osg::StateSet* stateset = rectBG_geom-getOrCreateStateSet(); 

stateset-setTextureAttributeAndModes(0,BG_texture,osg::StateAttribute::ON); 

   osg::Geode * BG_geode = new osg::Geode; 
BG_geode-addDrawable(rectBG_geom); 

   return BG_geode; 
} 

-(int)   initOsgTree 
{ 
   int dwError = 0; 

   osg::setNotifyLevel(osg::DEBUG_INFO); 

   // camera 
   unsigned int w = 480; 
   unsigned int h = 320; 

   //create and attach ortho camera for hud text 
   osg::ref_ptrosg::Camera hudCamera = new osg::Camera; 
   hudCamera-setProjectionMatrix(osg::Matrix::ortho2D(0,w,0,h)); 
   hudCamera-setReferenceFrame(osg::Transform::ABSOLUTE_RF); 
   hudCamera-setViewMatrix(osg::Matrix::identity()); 
   hudCamera-setClearMask(GL_DEPTH_BUFFER_BIT); 
   hudCamera-setRenderOrder(osg::Camera::POST_RENDER); 

   osg::ref_ptrosg::Group MARRoot = new osg::Group; 

MARRoot-getOrCreateStateSet()-setMode(GL_LIGHTING,osg::StateAttribute::OFF); 
   hudCamera-addChild([self create2DBGTexture]); 
   MARRoot-addChild(hudCamera.get()); 

   // viewer 
   MARViewer = new osgViewer::Viewer(); 
   MARViewer-setSceneData(MARRoot.get()); 
   MARViewer-realize(); 
   MARViewer-frame(); 

   return dwError; 
} 




My question is: 
How do i put the model in the viewer so that it can be showed in the front of 
the background? Use two cameras? Put the model in another camera, then add this 
camera as the slave camera into viewer? I ever tried it, but it did not work, 
maybe my code is wrong. Maybe my thought is not right.
I hope you can give me a hand to help me to solve this question. I will 
appreciate you  very much.

 
Thank you!

Cheers,
Tang

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





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


Re: [osg-users] Kinect

2011-03-04 Thread Wang Rui
Hi Chris,

At present I'm working on an open source project named osgXI
(http://osgxi.svn.sourceforge.net) with another Chinese engineer. He
has already made some progress on the kinect support and upload some
code to the osgInput namespace. The implementation initially depended
on libUSB and then changed to openNI as far as I know.

I myself have no idea of the kinect part (I worked out the Cg, CgFX
and post-processing functionalities), but can act as a go-between if
you have inerests and questions about the project and his work.
Believe or not, he can speak or write too little English by himself.
:-)

Cheers,

Wang Rui


2011/3/5 Chris 'Xenon' Hanson xe...@alphapixel.com:
  I recently published some info I've learned about Kinect on my web page.

 http://xenon.arcticus.com/kinect-z-buffer-noise-and-audio-beam-steering-precision

  I'd like to talk to other OSG people who are using, or plan to use Kinect, 
 and see what
 you're up to.

 --
 Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com 
 http://www.alphapixel.com/
  Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. 
 Contracting.
    There is no Truth. There is only Perception. To Perceive is to Exist. - 
 Xen
 ___
 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] 3D texture construction and fill it with magnitudes

2011-03-04 Thread Ulrich Hertlein
On 4/03/11 23:51 , Sajjadul Islam wrote:
 Thanks for the hint. I should have explained a little more.
 I am calculating a distance map and want to store it in the 3D texture for 
 pixel processing.
 
 Which function should i used inside Texture3D to store the 3D data.

No function inside osg::Texture3D, you modify the osg::Image data and it gets 
uploaded
into the 3D texture.

You can allocate a 3D osg::Image using
osg::Image::allocateImage(width, height, depth, pixelFormat, type);

where pixelFormat=GL_RED and type=GL_UNSIGNED_SHORT (based on your OpenGL call).

This allocates the pixel data and you can then get the pointer to the raw data 
using
unsigned short* imageData = (unsigned short*) osg::Image::data();

As mentioned, there is no direct access using a 3D coordinate, but you can do 
that
yourself based on the raw image data pointer:

void writeToImage(osg::Image* image, int x, int y, int z, unsigned short value)
{
unsigned short* imageData = (unsigned short*) image-data();
unsigned short* pixelData = imageData + (z * width * height) + (y * width) 
+ x;
*pixelData = value;
}

After that, mark your image as dirty by calling osg::Image::dirty() and it will 
be
uploaded to it's associated texture.

Hope this helps,
/ulrich
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org