[osg-users] Change color of node read from dxf file

2018-11-19 Thread Diego Mancilla
I'm a newbie on OpenSceneGraph and 3D development. I have a dxf file that contains a bunch of 3DPOLYLINES (with different colors). So far I have been able to read and display them on a viewer, but I haven been able to change the color of the rendered lines. I believe that I'm not understanding

Re: [osg-users] Change color of node read from dxf file

2018-11-20 Thread Diego Mancilla
Hello Chris, Thank you for your answer. My code, actually compiles, nevertheless I was expecting a conceptual error from my side. I will try what you suggest. Cheers, -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=75217#75217 __

Re: [osg-users] Change color of node read from dxf file

2018-11-20 Thread Diego Mancilla
Hi, The suggestion of Chris solve the problem. The actual code: Code: osg::Node* lines = osgDB::readNodeFile("lines.dxf"); osg::Geode* geode = new osg::Geode; ColorVisitor newColor; newColor.setColor( 1.0f, 0.0f, 0.0f ); topography->accept(newColor); geode->addChild(lines); _mViewer->setScen

[osg-users] Update node color on demand

2018-11-24 Thread Diego Mancilla
Hello, I'm trying to change a node color on demand from my application. The idea is that the user, once the initial rendering took place can change the color of a node by pressing a key (or something similar). I know already hoy to change the color using a NodeVisitor (previous to the rendering

Re: [osg-users] Update node color on demand

2018-11-24 Thread Diego Mancilla
Hello Eran, Thank you very much for your answer. I should have been more explicit, due to the fact than I'm a newbie on OSG (and 3D development). I have an OSG viewer embedded on a Qt5 application. So the idea is that the user can change the color of one node (some dxf lines) on demand though

Re: [osg-users] Update node color on demand

2018-11-26 Thread Diego Mancilla
Hello Eran, Thank you again. I will try what you suggest. Cheers, -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=75244#75244 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://

Re: [osg-users] Update node color on demand

2018-11-26 Thread Diego Mancilla
Hello, I have tried Eran's suggestion with no success. I have successfully created the handler, and it gets called but no color change... My current code: On main: Code: _lines = osgDB::readNodeFile("lines.dxf"); _topo->setDataVariance(osg::Object::DYNAMIC); osg::Geode* geode = new osg::Geode;

Re: [osg-users] Update node color on demand

2018-11-26 Thread Diego Mancilla
Hello Trajce, The visitor class implementation is on my previous post on this thread. I took that code from Gordon Tomlison's OSG Samples, and it works when is used previous to the rendering as you can see on my initial post (other thread: http://forum.openscenegraph.org/viewtopic.php?p=75209#

[osg-users] Speeding u/down animation smoothly

2018-12-05 Thread Diego Mancilla
Hello, I'm trying to sppeding up/down an animation using AnimationPathCallback. The idea is to pause/speed/up/down the animation using key strokes, for this I have a GuiEventHandler derived class and a NodeVisitor derived class. So far I've playing round with the base clases AnimationPath and A

Re: [osg-users] Speeding u/down animation smoothly

2018-12-06 Thread Diego Mancilla
Hi, Thank you for your answer mp3butcher. Regarding the math issue: actually the arithmethic is correct in my code, the problem, as I found, was that the _latestTime and _fisrtTime in the AnimationPathCallback won't match the ones provided in AnimationPath, so I subclassed AnimationPathCallba

[osg-users] Working with osg::Text on animation

2018-12-20 Thread Diego Mancilla
Hello, I have a couple of doubts regarding the proper way of handling osg::Text inside an animation. For the sake of simplicity lets say we are working on the osganimate example, and we have multiple cessna moving around. 1- What is the proper way of changing the text of osg::Text on runtime

Re: [osg-users] Working with osg::Text on animation

2018-12-20 Thread Diego Mancilla
setText("insert dynamically-generated string here"); > > > You can show/hide the text with its node mask: >     text->setNodeMask(0x0); // NodeMask = 0 to hide >     text->setNodeMask(~0x0); // NodeMask = 0x to show > > > Hope that helps,

Re: [osg-users] Working with osg::Text on animation

2018-12-20 Thread Diego Mancilla
setText("insert dynamically-generated string here"); > > > You can show/hide the text with its node mask: >     text->setNodeMask(0x0); // NodeMask = 0 to hide >     text->setNodeMask(~0x0); // NodeMask = 0x to show > > > Hope that helps,

[osg-users] Colors on GL_LINES

2018-12-23 Thread Diego Mancilla
Hello, I'm drawing some simple lines on osg. So far I have successfully draw the lines and set a single color for each of them... but when I rotate the view the color is shown only on one direction of the camera, for instance, if rotate on 180 degrees the view, all lines are shown in black (lo

Re: [osg-users] Colors on GL_LINES

2018-12-24 Thread Diego Mancilla
Hello ravidavi, Thank you for your answer. Your suuggestion solved my problem. Cheers, -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=75348#75348 ___ osg-users mailing list osg-users@lists.opensce

[osg-users] Get Animation current time

2018-12-27 Thread Diego Mancilla
Hello, I have several AnimationPath intances for a number of moving objects. Each object has the same number of ControlPoints on their path. I need to know if there is a proper way to retrieve the current time of the animation (using a callback, for instance). I need this number in order to d

Re: [osg-users] Get Animation current time

2018-12-28 Thread Diego Mancilla
Hello Robert, First of all, thank you for your answer. I'm just starting to use OSG so I'm learning as I go. So, my issue is a little more complicated (I think). I have serveral AnimationPath instances. Each one with a AnimationPathCallback derived class attached to it. So, the thing is that

Re: [osg-users] Get Animation current time

2019-01-04 Thread Diego Mancilla
Hello Robert, Thank you again for your answer. Regarding your question "the AnimationPathCallback::update method)?": yes, from the source: Code: void AnimationPathCallback::update(osg::Node& node) { AnimationPath::ControlPoint cp; if (_animationPath->getInterpolatedControlPoint(getAnim

Re: [osg-users] Get Animation current time

2019-01-07 Thread Diego Mancilla
Hello Robert, Thank you very much for you complete response. I'm trying to do what you suggest and have my on AnimationPath/AnimationPathCallback classes that handle my data. But I stumble into a problem. When I subclass AnimationPath and AnimationPathCallback I have no problems. But when I

Re: [osg-users] Get Animation current time

2019-01-08 Thread Diego Mancilla
Hello Robert, Thank you again. It turns out that I forgot to initialize the _timeMultiplier variable on the constructor of my AnimationPath class. Also I had a problem with some crazy references retrieved wrongly: for some reason on a "for (auto e: stl_map)..." loop, &e.second, was not gettin

[osg-users] osgText::Text dissapears when reparent container window on qt

2019-03-27 Thread Diego Mancilla
Hello, This is a mixed OSG/Qt question. I asked first here due to previous experiences with the community. I'm following a minimal example of embedding OSG into a Qt5 application from https://gist.github.com/vicrucann/874ec3c0a7ba4a814bd84756447bc798. When I modify that example, and add a s

[osg-users] Colored Bounding Box over osgText::Text

2019-04-05 Thread Diego Mancilla
Hello, I'm trying to draw a bounding box around a osgText::Text instance. Setting the draw mode to 'osgText::Text::TEXT|osgText::Text::BOUNDINGBOX' draws a white box around the text. Does anyone knows a simple way to get this box color match the text color? Or, better yet, a way to draw the box

Re: [osg-users] Colored Bounding Box over osgText::Text

2019-04-06 Thread Diego Mancilla
Hello, I've found a workaround my problem. I had to inherit a class from osgText::Text and override the drawImplementation method like so: Code: void MyTextNode::drawImplementation(osg::RenderInfo& renderInfo) const { osg::Vec4 color = getColor(); # stored custom color osgText:

[osg-users] Really basic question light/material on surface

2019-04-09 Thread Diego Mancilla
Hello, I've playing aorund with some examples on the "OpenSceneGraph 3 Cookbook" by Wang and Quian. Specifically, with Chapter 10's "Playing with delaunay triangulator". Here is the official repository code (with one small modification -commented-) Code: int main(int argc, char** argv) {