[osg-users] Regarding autoTransform disappering while zooming in and out

2012-10-01 Thread Abhinav
I am facing the weird issue with the auto-transform. I have  two
auto-transforms one having  text and other having the

Icon. I put both the transforms  in the switch node and based on the mode
like

 

Icon

Text

Icon_text

 

I am switching the state of the switch node. But when I try to zoom in/zoom
out 5-6 times icon and the text 

Is getting disappeared. Sometimes when I go close to the node it comes and
sometimes it doesn't come at all

 

This is my code for getting the icon Transform

if(!_iconTransform.valid())

{

_iconTransform = new osg::AutoTransform();

 

_iconTransform-setAutoScaleToScreen(true);

 
_iconTransform-setAutoRotateMode(osg::AutoTransform::ROTATE_TO_SCREEN);

 

_iconCullCallback = new indiUtil::IconCullCallback();

_iconTransform-setCullCallback(_iconCullCallback.get());

  _iconTransform-setDataVariance(osg::Object::DYNAMIC);



if(_mode == ICON || _mode == ICON_AND_TEXT)

{

_switchNode-addChild(_iconTransform.get(), true);

}

else

{

_switchNode-addChild(_iconTransform.get(), false);

}

}

 

return _iconTransform.get();

 

This is my code for the text transform

if(!_textTransform.valid())

{

_textTransform = new osg::AutoTransform();

 

_textTransform-setAutoScaleToScreen(true);

 
_textTransform-setAutoRotateMode(osg::AutoTransform::ROTATE_TO_SCREEN);

 

_textTransform-setCullCallback(new
indiUtil::IconCullCallback());

 

_intializeText();

 

if(_textTransform.get()  _textGeode.get())

{

_textTransform-addChild(_textGeode);

if(_mode == IRepresentation::TEXT || _mode ==
IRepresentation::ICON_AND_TEXT)

_switchNode-addChild(_textTransform.get(), true);


else

_switchNode-addChild(_textTransform.get(), false);

 

_placeTextNode();

}

}

return _textTransform.get();

 

I tried a lot but not able to find out the reason. I thought it may be
bacause of the cullback that I installed but even when I am removing it, I
am getting the same issue.

 

Please help me out !!!

 

With Regards

Abhinav Goyal

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


Re: [osg-users] Regarding autoTransform disappering while zooming in and out

2012-10-01 Thread Robert Osfield
Hi Abhinav,

My guess is that the repeated rescaling is making the lower transform
smaller and smaller until it get culled by small feature culling.

Could you try disabling small feature culling, or alternatively avoid
nesting auto transforms which would be my preference.  Please note
that osgText::Text has it's own scaling and rotation to screen coords
functionality.

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


Re: [osg-users] Invert scene graph

2012-10-01 Thread Stéphane Bonardi

  
 Hi Stéphane,
 
 I think if you invert the matrices when you are doing backward kinematics, 
 you can keep the same scenegraph structure. For example, when the end 
 effector is attached, you have the transform from P3 to P2 but you have P2 
 ipo P2, so the inverse of the transform you have is what you should set the 
 PAT transform to.
 
 Hope this helps,
 
 Bryan Thrall
 
 


Hi Bryan,

Thanks a lot for your quick reply. In fact I wanted to keep the benefit of 
having a scene graph structure when applying a transform to the different 
nodes. That is, if I move one node the transform will be propagated 
automatically to its children. My goal would have been to have two kinematic 
chains (direct and inverse) automatically managed by the scene graph structure. 
 Otherwise I would have to manually propagate the transform for the inverse 
chain. For example if P1 ipo P2 ipo P3 (direct kinematic chain) and I would 
like to consider the inverse kinematic chain (P3 is fixed), applying a 
transform to P2 should only move P1. But in this case I would need to cancel 
the transform applied to P3 and propagate it to P1. That would definitely be an 
option but it seems to me a bit complicated considering the great opportunity 
given by the graph structure. I will still try to find a solution using dynamic 
parenting but I will consider your solution as a backup plan. 

Thanks again for your suggestion!  

Best,

Stéphane

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





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


Re: [osg-users] Video textures on iOS (and audio)

2012-10-01 Thread Bruno Ronzani
hi !

any results in using OSG to play videos on IOS ?

using ffmpeg is not an option ?

cheers,

bruno

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





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


Re: [osg-users] Video textures on iOS (and audio)

2012-10-01 Thread Stephan Maximilian Huber
Hi

I have some working code playing a video inside OSG, it's IOS 6 only and
needs some porting to the osg-plugin-mechanism and some other enhancements.

I am currently busy with other work, so this has to wait for some more time.

cheers,

Stephan
Am 01.10.12 15:58, schrieb Bruno Ronzani:
 hi !
 
 any results in using OSG to play videos on IOS ?
 
 using ffmpeg is not an option ?
 
 cheers,
 
 bruno
 
 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=50361#50361
 
 
 
 
 
 ___
 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] Video textures on iOS (and audio)

2012-10-01 Thread Bruno Ronzani
Steph,

Thank you ! Can't wait to see that :)

Please keep us informed !

Cheers,

Bruno

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





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


Re: [osg-users] How to select or pick an object in OSG, in file .osg using osgviewer pick.osg?

2012-10-01 Thread Kleber Jacome
Hi,

I am using this example OpenSceneGraph/examples/osgpick/osgpick.cpp, I 
changed and I added new keys and mouse actions, to test the program osgpick.cpp 
in Osgviewer and the program improved. Then I wrote a file .osg to use it on 
Osgviewer, but I can't run my new actions because Osgviewer blocks all keyboard 
and my new keys to use your own keyboard and mouse actions.

But I see that I can't make this with the .osgfile because it isn't an 
application and can't be used in Osgviewer my own actions, right?. This means 
that my problem has no solution?


Thank you!

Cheers,
Kleber

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





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


[osg-users] getting RGB of texture in *.ive file

2012-10-01 Thread Joe Doob
Hello,

I have a large terrain map which I load from an *.osg file containing a list of 
ProxyNode objects containing *.ive files, using osgDB::readNodeFile.

My end goal is to get RGB of points on the texture map found through a line 
segment intersection.

I have read through the mousePosition function in the InteractiveImageHandler 
class which shows how I would get the texture coordinates of the point 
intersected. 

From there, I attempted to get the RGB value this way:


Code:

osg::Drawable * drawable = intersection.drawable.get();
if(drawable-getStateSet())
{
state_set = drawable-getStateSet();
osg::Texture * texture =
dynamic_castosg::Texture*(state_set-getTextureAttribute
(0, osg::StateAttribute::TEXTURE));

if(texture)
{
textureImage = texture-getImage(osg::Material::FRONT);
return textureImage-getColor(textureCoordinates);
}
}




This snippet produces a valid drawable, however the drawable returns a NULL 
stateset and so I can't obtain the texture object.

How can I obtain the osg::Image to get RGB in this case? Or, is there a better 
method?

Thanks-

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





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


Re: [osg-users] getting RGB of texture in *.ive file

2012-10-01 Thread Thrall, Bryan
Joe Doob wrote on 2012-10-01: 
 This snippet produces a valid drawable, however the drawable returns a
 NULL stateset and so I can't obtain the texture object.
 
 How can I obtain the osg::Image to get RGB in this case? Or, is there
a
 better method?

The texture for the Drawable must be set in a parent node (the Geode
that contains it, or possibly some Node higher in the scene graph).

You can use osg::Drawable::getParents() to work your way up the scene
graph until you find the StateSet that sets the texture. Note that OSG
combines StateSets, so even if you find a StateSet it might not specify
the texture; it all depends on how the model is structured. Also, that
part of the scene graph could occur multiple times in the scene graph if
it is instanced (which is why getParents() returns a list: there  could
be more than one parent).

Hope this helps,
--
Bryan Thrall
Principal Software Engineer
FlightSafety International
bryan.thr...@flightsafety.com


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


[osg-users] Problem with picking and AutoTransforms

2012-10-01 Thread Ron Mayer
Hi,

I am having difficulties picking an object that is attached to an AutoTransform.

My object is made out of two lines, in a shape of an 'x' with 
AutoScaleToScreen = true
AutoRotateMode = NO_ROTATION

I am using a polytope intersector (LIMIT_ONE_PER_DRAWABLE) to intersect with 
the lines of my object.
The intersector reports an intersection only if I click on the center of my 
object. If I click on the object's lines away from the center, no intersection 
is reported for the object.

Can anyone think of a reason why this can happen?

Thank you!
Ron

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





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


Re: [osg-users] Problem with picking and AutoTransforms

2012-10-01 Thread Ron Mayer
by the way, I just noticed that if I set the AutoTransform to ROTATE_TO_SCREEN 
the problem goes away :O.
But I need it with NO_ROTATION ...

Cheers,
Ron

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





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


Re: [osg-users] Manually updating a camera instead of using a manipulator

2012-10-01 Thread Preet
Figured this out; I was unprojecting coordinates but not updating them
in the right order. So that this thread isn't completely useless, here's my
correct code for converting screen coordinates to world coordinates.

void calcNormDeviceCoords(int xScreen, int yScreen, double xNorm,
double yNorm)
{
xNorm = 2*double(xScreen)/double(MY_SCREEN_WIDTH) - 1;
yNorm = 1 - 2*double(yScreen)/double(MY_SCREEN_HEIGHT);
}

// dNorm = 0.0 for near plane on view frustum, dNorm = 1.0 for far plane
void convCoordScreenToWorld(double xNorm,double yNorm,
   double dNorm,osg::Vec3d worldPt)
{
osg::Camera * viewCam = MY_VIEWER-getCamera();
osg::Matrixd xfMVP(viewCam-getViewMatrix()*
   viewCam-getProjectionMatrix());

osg::Matrixd xfInvMVP = osg::Matrixd::inverse(xfMVP);
worldPt = osg::Vec3d(xNorm,yNorm,dNorm) * xfInvMVP;
}


Sorry for the spam

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