[osg-users] Get the top coordonates from screen of an object

2009-08-11 Thread Adrien Joly
Hi,

I'm trying to put a text on the top of a node, a sort of caption. This caption 
can be added for mutliple objects without being stacked with other captions. My 
idea is to add those caption to the global scene by getting the coordinates of 
the top of the followed node and project the text on the screen from the given 
coordinates.

Here are my questions:
Have you got a better idea?
How can I get the top of the Node directly (I thought to use the LineSegment 
and BoundingSphere)? Is there an easier (and better for performances) way to 
get them?

Thank you for your answers!

Cheers,
Adrien

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





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


[osg-users] Truncated Cone with spheric base

2009-07-30 Thread Adrien Joly
Hi,

I have to make a truncated cone with a spheric base, defined by a small radius 
and a large radius. I have been thinking about that and the best idea I thought 
to is to define a Geometry with a Shape with quads linking two circles.

I wanted to know if there were a lot of ressources lost if I do that, in order 
to have a proper cone wich is not seeing as a strange shape with quads. Is 
there a better way to do it?

Thank you!

Cheers,
Adrien

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





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


[osg-users] Geode blinking

2009-07-17 Thread Adrien Joly
Hi,

First of all, english is not my mother tongue, so excuse my faults.

I developped an icon with osg, which is an image, facing the camera whatever is 
placed the camera and has the same size on the screen whatever is the distance 
from the camera.

The problem is that the icon is sometimes blinking when I change the distance 
of the camera from the icon.

The icon is a MatrixTransform containing a geode which is a Billboard.
The billboard contains a quad which is textured with the image I want to 
display. The billboard make the image always facing the screen.

The matrixTransform has a method accept(osg::NodeVisitor nv) which change the 
size of the billboard by changing the bounds of the quad when the distance of 
the camera comparing to the icon change.

I think the problem is that I change the bounds of the quad at the same time 
the viewer read these bounds. I would like to lock the access to these bounds 
while I'm changing them but I don't know how to do that.

Thank you for your answers. If you need more informations, or a part of the 
code, I would be glad to tell you.

Cheers,
Adrien

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





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


[osg-users] Dynamic line make scene disappear

2009-06-19 Thread Adrien Joly
Hi,

I am currently trying to build a dynamic line. I mean the extremities of the 
segment can be attached to a node and change everytime the node position 
relativelly to the world change. Actually, I have a NodeCullback redefined 
class and a geode redefined class.

Here is the code : 


Code:

void Trail::_initBefore(){
  _drawable = new osg::Geometry;
  _bounds = new osg::Vec3Array(2);
  _color = new osg::Vec4Array(1);
  osg::Vec3Array* normals = new osg::Vec3Array;
  normals-push_back(osg::Vec3(0.0f,-1.0f,0.0f));
  ((osg::Geometry*)_drawable)-setNormalArray(normals);
  ((osg::Geometry*)_drawable)-setNormalBinding(osg::Geometry::BIND_OVERALL);
  ((osg::Geometry*)_drawable)-setVertexArray(_bounds);
  ((osg::Geometry*)_drawable)-setColorBinding(osg::Geometry::BIND_OVERALL);
  ((osg::Geometry*)_drawable)-setColorArray(_color);
  ((osg::Geometry*)_drawable)-addPrimitiveSet(new 
osg::DrawArrays(osg::PrimitiveSet::LINES,0,2));
  _width = new osg::LineWidth(DEF_WIDTH);

((osg::Geometry*)_drawable)-getOrCreateStateSet()-setAttribute(_width, 
osg::StateAttribute::ON);

((osg::Geometry*)_drawable)-getOrCreateStateSet()-setMode(GL_LIGHTING, 
osg::StateAttribute::OFF);

}

void Trail::updateNode(osg::Vec3 source, osg::Vec3 target, osg::Vec3 
sourceCenter, osg::Vec3 targetCenter){
  (*_bounds)[0].set(source);
  (*_bounds)[1].set(target);

  osg::PrimitiveSet* ps = ((osg::Geometry*)_drawable)-getPrimitiveSet(0);
  ((osg::Geometry*)_drawable)-setPrimitiveSet(0, ps);
}




The method updateNode is called everytime one of the extremity of the segment 
change of position.

My problem is that when the extremities of the segment are not on the view, the 
line color change to blue and the line sometimes disappear.
I don't understand wher the problem might be.

I have the same problem with trace (a Line_Strip that follow an object). In 
this case, it is worst because the entire scene disappear under some points of 
view.

Here is the code (it's basically the same principle as above)


Code:


void Trace::_initBefore(){
_drawable = new osg::Geometry;
_bounds = new osg::Vec3Array;
_color = new osg::Vec4Array;
_color-push_back(osg::Vec4(1, 1, 1, 1));
((osg::Geometry*)_drawable)-setVertexArray(_bounds);
((osg::Geometry*)_drawable)-setColorArray(_color);

((osg::Geometry*)_drawable)-setColorBinding(osg::Geometry::BIND_OVERALL);
_width = new osg::LineWidth(DEF_WIDTH);

((osg::Geometry*)_drawable)-getOrCreateStateSet()-setAttribute(_width, 
osg::StateAttribute::ON);

((osg::Geometry*)_drawable)-getOrCreateStateSet()-setMode(GL_LIGHTING, 
osg::StateAttribute::OFF);
osg::Vec3Array* normals = new osg::Vec3Array;
normals-push_back(osg::Vec3(0.0f,-1.0f,0.0f));
((osg::Geometry*)_drawable)-setNormalArray(normals);

((osg::Geometry*)_drawable)-setNormalBinding(osg::Geometry::BIND_OVERALL);
((osg::Geometry*)_drawable)-addPrimitiveSet(new 
osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP,0,2));
}

void Trace::updateNode(osg::Vec3 source, osg::Vec3 target, osg::Vec3 
sourceCenter, osg::Vec3 targetCenter){
if(!(source == osg::Vec3()  target == osg::Vec3())){
if(source != target || firstCallUpdate){
if(!firstCallUpdate){
unsigned int count = _bounds-size();
if(count = 2){
(*_bounds)[count-1] = _oldPosition;
}
else{
_bounds-push_back(_oldPosition);
_bounds-push_back(target);
}

_bounds-push_back(target);
_oldPosition = targetCenter;
}
else{
_oldPosition = targetCenter;
firstCallUpdate = false;
}
setSource(targetCenter);
osg::DrawArrays* ps = 
((osg::DrawArrays*)((osg::Geometry*)_drawable)-getPrimitiveSet(0));
ps-setCount(ps-getCount() + 2);
((osg::Geometry*)_drawable)-setPrimitiveSet(0, ps);
}
}
}





I need some help !
Thank you!

Cheers,
Adrien

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





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


[osg-users] PositionAttitudeTransform - How do I make a rotation

2009-04-02 Thread Adrien Joly
Hi,

I'm kind of newbie in 3D developpment and in openSceneGraph.

I want to rotate a node using PositionAttitudeTransform::setAttitude but I 
don't know how to do that.

I've tried to make it rotate according ti the fact that x, y and z of the Quat 
is the coordinate of the vector from the origin (x, x, z) plus an angle (w).

But the node has a strange behavior.

Can anyone help me?

Thank you.

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





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


Re: [osg-users] PositionAttitudeTransform - How do I make a rotation

2009-04-02 Thread Adrien Joly
Thank you for the answers.

I finally found, thanks to you, how to make it work !

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





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


Re: [osg-users] Uniform scale dragger?

2009-03-30 Thread Adrien Joly
Same question here !

There is a bug with the scaling perform of MatrixTransform. So I would like to 
use a 3D scaling of osgManipulator.

Thank you !

Excuse the faults.

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





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


Re: [osg-users] [osgPlugins] plugin to load png and jpg images problem

2009-03-13 Thread Adrien Joly
Thank you for your answer.

I built the sources for the png plugin and it worked fine.

I just have to do the same with the jpg plugin now.

Problem solved

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





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


[osg-users] plugin to load png and jpg images problem

2009-03-12 Thread Adrien Joly
Hello !

I have installed Visual Studio 2005 and osg 2.8 in debug and release version.

The problem is that I can't load jpg and png images in debug mode (work in 
release mode).

The program is launched but no image appear where it should do.

I have this message : Warning: Could not find plugin to read objects from file 
C:/[...]/X.png

I don't understand because I have the libpng13d.lib file in the lib/ folder and 
I have the osgdb_pngd.dll in the bin/osgplugins-2.8.0/ folder

In my project properties, I have correctly configured the paths (the same as in 
release).

Some help here  [Wink] 

Thank you

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





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