Re: [osg-users] Change cursor with object under mouse
That's the way I'm going to :) Cheers, Romain -------- Romain Charbit -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12114#12114 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Change cursor with object under mouse
Hi, Thanks for the answer, that's what I was afraid of. But in fact, the graphic context of the app that I'am working on is made by Java, so I need this GraphicsWindowEmbedded. I'am gonna do it in another way :D Thank you! Cheers, Romain -------- Romain Charbit -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=11967#11967 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Change cursor with object under mouse
Okay, now I'm on the set cursor part . So, I made a patch, based on Frederic Bouvier submission on the cursor in Win32, in order to have the setCursor function to work in windows. And it works on a simple 3D view. My problem now, is that my app use a osgViewer::GraphicsWindowEmbedded, and when I use setCursor, it says that it is not implemented. I'm not understanding quite well how the GraphicsWindow works. Neither GraphicsWindowEmbedded. I saw on the source code that setCursor is a virtual function, and is not reimplemented on GraphicsWindowEmbedded. So there's no way to change the mouse cursor when using GraphicsWindowEmbedded? Thank you! Cheers, Romain Charbit -------- Romain Charbit -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=11628#11628 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Change cursor with object under mouse
Hi, Thanks for your answers. I've done some further tests on my 3D scene. So the Line intersections takes about 20ms in a 460k triangles scene for me. I tried to enable Kdtree. I just put : Code: osgDB::Registry::instance()->setBuildKdTreesHint(osgDB::ReaderWriter::Options::BUILD_KDTREES); And Magic! It now takes about 0.8 to 1 ms. Definitly what I want for a real time app :D Thank you! Cheers, Romain Charbit ---- Romain Charbit -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=11580#11580 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Change cursor with object under mouse
Hi, May I ask your guidance for a problem that I have. I want to change the cursor of the mouse in function of the object that is under of it. Example, when I'm passing the mouse over a dragger, I want to change the cursor to a Hand. I'm on the detection of the object for the moment. I'm using a handler which use a LineSegmentIntersector on every frame. It works but it's kind of slow. I've seen on the web about the GL_SELECT OpenGL renderMode which has been design for it. But I've also seen that it's not a good way to do that. Maybe someone has already done something like this or has an idea about it? Thank you! Cheers, Romain Charbit Romain Charbit -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=11520#11520 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] setCursor problem
Thanks for this answer, I followed some threads about the subject but I got lost with what is working and what is not. thanks again. Romain. Romain Charbit -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=10947#10947 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] setCursor problem
Hi, I've seen some discussions about the mouse cursor, but it doesn't answer my question. How can I set a cursor with the function setCursor. When I make a setCursor : Code: osgViewer::GraphicsWindow::MouseCursor mouseCursor; mouseCursor = osgViewer::GraphicsWindow::DestroyCursor; gw->setCursor(mouseCursor); it does absolutely nothing. The only way I can have a cursor, is to do : Code: while(!viewer.done()) { viewer.frame(); gw->setCursor(mouseCursor); } And it does not a proper set, it sets the new cursor only when the mouse is not moving. I watched the source code, and I find it a bit confusing : osgViewer/GraphicsWindowWin32.cpp GraphicsWindowWin32::setCursor( MouseCursor mouseCursor ) Code: if (mouseCursor != LeftRightCursor && mouseCursor != UpDownCursor && mouseCursor != TopLeftCorner && mouseCursor != TopRightCorner && mouseCursor != BottomLeftCorner && mouseCursor != BottomRightCorner) { _appMouseCursor = mouseCursor; } then : Code: case WM_NCHITTEST : ... ... default: if (_traits->useCursor && _appMouseCursor != InheritCursor) setCursor(LeftArrowCursor); break; so if I set a cursor, _appMouseCursor will be equal to the new cursor, but will be erased by the case WM_NCHITTEST; Is there something I'm missing? Thank you. Romain. Romain Charbit -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=10917#10917 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Problem with statesets usage
When I say shader, I mean Osg::Program. But a more precise explanation of my problem may be useful. So I have a node representing an industrial pipe, divided in two main parts: - a group with groups that contain the geometry of the Pipe cut into parts (generated with a spline) - a group that contains "graphic" handlers acting on the Pipe (Draggers, Sphere to delete part of Pipe when picked ...) My shader simulate a flow effect on the pipe. I have made a FlowShaderNode, which inherits from osg::Group. When the user of the application want to apply a flow effect on a pipe, the program just put the FlowShaderNode between the pipe node and his parent on the graph. But I want to apply the effect only on the geometry group, not the handler group. So I made this in the constructor of my pipe: _HandlersGeometries->getOrCreateStateSet()->setAttributeAndModes(new osg::Program(),osg::StateAttribute::OFF |osg::StateAttribute::PROTECTED | osg::StateAttribute::OVERRIDE); I got what I want, only the pipe geometry have the flow effect. But now I have another problem. My application have several visual effects, like a picking effect (using osgFx::Scribe). And they all work like the FlowShaderNode, it adds an 'Effect node' between the node and his parent. So if the effect is applied after the flow effect, the effect node get the program from the FlowShaderNode,because it is below the FlowShaderNode on the graph, and make some weird visual results. The Flow effect was mainly design to be put on pipes. So what a wanted to do is to put my FlowShaderNode osg::Program statset to osg::StateAttribute::OFF, and then putting : _PipeGeometries->getOrCreateStateSet()->setAttributeAndModes(new osg::Program(),osg::StateAttribute::ON|osg::StateAttribute::INHERITS| osg::StateAttribute::OVERRIDE); So only my pipe geometries gets modified by the flow effects. But as you said before, osg::Program cannot be enabled/disabled at will, so I think I will have to put an empty osg::Program in all my visual effects. ---- Romain Charbit -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=10059#10059 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osg::Manipulator::CommandManager DraggerSelectionMap
Hi, I have a little problem with the design of the command manager. I need to get the selection which is connected to a dragger. I've seen that the command manager connects the dragger and the selection, and stores this into the DraggerSelectionMap , but this is a protected attribute and there's no member functions that returns this map. Do I have to create my own map storing exactly the same datas, or is there a way to get this node? Thank you. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org