Re: [osg-users] 2D orthographic view with panning and zooming
Hi Radu, osgViewer::CompositeViewer is the appropriate tool to use when you want multiple VIew on to one or more scenes. Have a look at the osgcompositeviewer and osghud examples. Robert. On 17 June 2014 21:43, Radu Marin Butoi wrote: > Hello everyone, > > I am writing an application to display and select elements from 2D > triangular meshes and 3D tetrahedral meshes. Displaying the 3D mesh works > fine (thanks Robert for the previous help!). With the 2D I'd like to have > the display show the XY (or XZ, or YZ, depending on the input; the bounding > of the geometry can be used to determine this) plane directly and enable > panning and zooming with the mouse. I have a single osgViewer and I have > tried using the various getCamera()->set{View,Projection}* functions, but as > I understand the camera manipulator will overwrite the view matrix. So, what > is the simplest way to display an orthographic 2D scene with mouse panning > and zooming in a similar way that a perspective 3D scene is displayed by > default? > > Thank you, > Radu > ___ > 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] 2D orthographic view with panning and zooming
Hello everyone, I am writing an application to display and select elements from 2D triangular meshes and 3D tetrahedral meshes. Displaying the 3D mesh works fine (thanks Robert for the previous help!). With the 2D I'd like to have the display show the XY (or XZ, or YZ, depending on the input; the bounding of the geometry can be used to determine this) plane directly and enable panning and zooming with the mouse. I have a single osgViewer and I have tried using the various getCamera()->set{View,Projection}* functions, but as I understand the camera manipulator will overwrite the view matrix. So, what is the simplest way to display an orthographic 2D scene with mouse panning and zooming in a similar way that a perspective 3D scene is displayed by default? Thank you, Radu ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Synchronize animations between different computers
Hi Harald, have a look at the osgcluster example. You can see there syncing of viewers across machines based on the simulation time Nick On Tue, Jun 17, 2014 at 9:22 PM, Harald Müller wrote: > Hi Robert, > > of course you're right, but the problem is the SimulationTime has nothing > to do with the progress of the animation ... :O > So if I start a Client 5 Seconds later, and it gets Server-Time 5000 the > animation doesn't start at time 5 Sec, it starts from the beginning ... > > To take your example, this gives exactly the same result: > > Code: > mySimulationTime= 0; > while(!viewer.done()) > { > viewer.frame(mySimulationTime); > mySimulationTime+=0.01f; > } > > > as this: > > Code: > mySimulationTime= 100; > while(!viewer.done()) > { > viewer.frame(mySimulationTime); > mySimulationTime+=0.01f; > } > > > > both start from the beginning. > > Thank you! > > Cheers, > Harald > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=59793#59793 > > > > > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Synchronize animations between different computers
Hi Robert, of course you're right, but the problem is the SimulationTime has nothing to do with the progress of the animation ... :O So if I start a Client 5 Seconds later, and it gets Server-Time 5000 the animation doesn't start at time 5 Sec, it starts from the beginning ... To take your example, this gives exactly the same result: Code: mySimulationTime= 0; while(!viewer.done()) { viewer.frame(mySimulationTime); mySimulationTime+=0.01f; } as this: Code: mySimulationTime= 100; while(!viewer.done()) { viewer.frame(mySimulationTime); mySimulationTime+=0.01f; } both start from the beginning. Thank you! Cheers, Harald -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59793#59793 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Synchronize animations between different computers
Hi Harald, With a cluster you would dispatch the SimulationTime from the master to all the slaves so that they use the master's SimulationTime, so if it's simulation time jumps then so till will the slaves. Robert. On 17 June 2014 18:32, Harald Müller wrote: > Thanks! > > Hmmm I think the SimulationTime and the ReferenceTime doesn't help me do > solve this problem ... > > What I am searching for is function to jump e.g. to the middle of the > animation. > > > Example: > - Client A starts animation X > - Client A hast 40% finished of animation X > - Server sends control message that the X should be at 50% > - Client A sets animation X to 50% > > "compyler" had an similar problem: > http://forum.openscenegraph.org/viewtopic.php?t=10012 > > But I don't know which class provides this methods and how to use it: > > Code: > animationManager->playAnimation( myAnimation ); > myAnimation->setStartTime(myAnimation->getStartTime() -3.0); > > > > I'm building an osg::AnimationPath and simply add it to the addUpdateCallback: > > > Code: > > transform->addUpdateCallback(new MyCallback(this, buildAnimationPath(), 0.0, > 1)); > > > > > > Thank you! > > Cheers, > Harald > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=59789#59789 > > > > > > ___ > 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] Shader Problems, AMD is Fine, NVIDIA is not
Hi SMesserschmidt, many thanks for your answer! It really helps for a newbie like me if he reads the confirmation, that it is not related to his OSG Code but to Shader. I was struggling with this a whole week and did not know where to look. I did not initialized the vec4 color var in my method, which could be part of the problem. After I did this, it still did not work on every maschine, but in some more. What finally was the answer was a piece of false code in the shader, which existed there since the beginning and which I overlooked for a whole week. Shame on me, I dunno how i did that Anyway, these two lines were faulty: color += gl_FrontMaterial.ambient * gl_LightSource[lightIndex].ambient[lightIndex]; color += gl_BackMaterial.ambient * gl_LightSource[lightIndex].ambient[lightIndex]; ambient is of course not an array! I really dunno why my AMD drivers did let that error pass... Again, many thanks for taking your time to answer me! Thank you! Cheers, Fitz -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59790#59790 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Synchronize animations between different computers
Thanks! Hmmm I think the SimulationTime and the ReferenceTime doesn't help me do solve this problem ... What I am searching for is function to jump e.g. to the middle of the animation. Example: - Client A starts animation X - Client A hast 40% finished of animation X - Server sends control message that the X should be at 50% - Client A sets animation X to 50% "compyler" had an similar problem: http://forum.openscenegraph.org/viewtopic.php?t=10012 But I don't know which class provides this methods and how to use it: Code: animationManager->playAnimation( myAnimation ); myAnimation->setStartTime(myAnimation->getStartTime() -3.0); I'm building an osg::AnimationPath and simply add it to the addUpdateCallback: Code: transform->addUpdateCallback(new MyCallback(this, buildAnimationPath(), 0.0, 1)); Thank you! Cheers, Harald -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59789#59789 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] hello all, find osg is very powerful after learned five months
Yeah,Have the possibility,if you get the template,then you can also make such a demo,without write one line osg code,are you familiar with LUA?this demo is writen using LUA JIT. only a few keyboard click,then the osg demo comes out,this is the reason i consider osg is very very powerfull! cheers LearningOSG 2014-06-17 23:36 GMT+08:00 Jaime : > Yeah, I mean sharing the source code of your demo. > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=59786#59786 > > > > > > ___ > 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] hello all, find osg is very powerful after learned five months
Hi Jaime, Thanks,currently i only know how to make a cool and beautiful osg demo,and have many questions about osg mechanism,because only learned osg five months. cheers LearningOSG 2014-06-17 23:21 GMT+08:00 Jaime : > Good example! Congratulations! > > Are you going to share the code? It would be great! > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=59784#59784 > > > > > > ___ > 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] hello all, find osg is very powerful after learned five months
Yeah, I mean sharing the source code of your demo. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59786#59786 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] hello all, find osg is very powerful after learned five months
Good example! Congratulations! Are you going to share the code? It would be great! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59784#59784 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Changing image in texture2d
Hi, I have a texture2D, and I want to change its image dynamically. How can I do it? I tried: > > Create()===> > osg::ref_ptr geode = new osg::Geode; > geode->addDrawable( osg::createTexturedQuadGeometry(osg::Vec3(), > osg::Vec3(40.0,0.0,0.0), osg::Vec3(0.0,0.0,40.0)) ); > geode->setDataVariance(osg::Object::DYNAMIC); > textureLensFlare = new osg::Texture2D; > textureLensFlare->setImage( im ); > textureLensFlare->setDataVariance(osg::Object::DYNAMIC); > textureLensFlare->setFilter(osg::Texture::MIN_FILTER, > osg::Texture::LINEAR_MIPMAP_LINEAR); > textureLensFlare->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR); > textureLensFlare->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP); > textureLensFlare->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP); > geode->getOrCreateStateSet()->setTextureAttributeAndModes(0, > textureLensFlare, osg::StateAttribute::ON ); > geode->getOrCreateStateSet()->setDataVariance(osg::Object::DYNAMIC); > geode->getOrCreateStateSet()->setMode(GL_BLEND, osg::StateAttribute::ON); > geode->getOrCreateStateSet()->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); > > Change==> > switch (_iCurrentTexture) > { > case 1: > textureLensFlare->setImage(_im1); > _im1->dirty(); > break; > > case 2: > textureLensFlare->setImage(_im2); > _im2->dirty(); > break; > > case 3: > textureLensFlare->setImage(_im3); > _im3->dirty(); > break; > } > textureLensFlare->dirtyTextureObject(); > But it didn't work. I try with ->dirty() , dirtyTextextureObject(), ->setDaraVariance(osg::Object::DYNAMIC), etc... but no success :( And another question...What about performance of this method? Approximately, I will change texture twice each second. Is this a good solution, Or is there any other better? Thanks! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59783#59783 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] hello all, find osg is very powerful after learned five months
And more osg demos are coming,welcome vist OSG DEMOS SITE www.osg3d.org my email:learning...@gmail.com skype:learning...@hotmail.com Thanks all. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Incremental GL compile
Good to know then - my tests so far show a correct and solid behavior. Thanks Robert, ricky On Tue, Jun 17, 2014 at 12:15 PM, Robert Osfield wrote: > HI Ricky, > > Your approach sounds correct. You are correct in that the user > doesn't need to explicitly for the release of GL objects as the OSG > will pass the GL objects across to the OSG's internal object cache to > be release by automatically by the draw thread. Reuse of GL objects > will also happen automatically for you. > > Robert. > > On 17 June 2014 11:07, Riccardo Corsi wrote: > > Hi all, > > > > for a project I'm loading a scene which fits into system memory but most > > likely not in video memory. > > I prefer to load the whole scene at startup to run some pre-processing on > > the scene elements. > > > > What I'm after is then to dynamically precompile/release GL objects at > > runtime for different elements of the scene - I want them precompiled > before > > merging into the visible scene to avoid frame drops. > > > > The way I'm doing it right now is: > > - when adding element, I push them into an > > osgUtil::IncrementalCompileOperation. When compiled I merge them into the > > visible scenegraph > > - when removing, I simply detach the nodes > > > > Is this a correct approach? > > > > In particular, is it correct NOT to release explicitly the GL objects > when > > removing the nodes? > > From what I've read in the archives, osg should do it automatically at an > > appropriate time... > > > > Other hints are welcome :) > > Thanks, > > ricky > > > > ___ > > 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 mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Incremental GL compile
HI Ricky, Your approach sounds correct. You are correct in that the user doesn't need to explicitly for the release of GL objects as the OSG will pass the GL objects across to the OSG's internal object cache to be release by automatically by the draw thread. Reuse of GL objects will also happen automatically for you. Robert. On 17 June 2014 11:07, Riccardo Corsi wrote: > Hi all, > > for a project I'm loading a scene which fits into system memory but most > likely not in video memory. > I prefer to load the whole scene at startup to run some pre-processing on > the scene elements. > > What I'm after is then to dynamically precompile/release GL objects at > runtime for different elements of the scene - I want them precompiled before > merging into the visible scene to avoid frame drops. > > The way I'm doing it right now is: > - when adding element, I push them into an > osgUtil::IncrementalCompileOperation. When compiled I merge them into the > visible scenegraph > - when removing, I simply detach the nodes > > Is this a correct approach? > > In particular, is it correct NOT to release explicitly the GL objects when > removing the nodes? > From what I've read in the archives, osg should do it automatically at an > appropriate time... > > Other hints are welcome :) > Thanks, > ricky > > ___ > 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] Incremental GL compile
Hi all, for a project I'm loading a scene which fits into system memory but most likely not in video memory. I prefer to load the whole scene at startup to run some pre-processing on the scene elements. What I'm after is then to dynamically precompile/release GL objects at runtime for different elements of the scene - I want them precompiled before merging into the visible scene to avoid frame drops. The way I'm doing it right now is: - when adding element, I push them into an osgUtil::IncrementalCompileOperation. When compiled I merge them into the visible scenegraph - when removing, I simply detach the nodes Is this a correct approach? In particular, is it correct NOT to release explicitly the GL objects when removing the nodes? >From what I've read in the archives, osg should do it automatically at an appropriate time... Other hints are welcome :) Thanks, ricky ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgPlugins] A problem in rendering the exported file?
"Jaeha Kim" writes: > By the way, I still do not understand why fixing normals in Blender > did no help with *.STL format, but successfully worked with *.3ds... Glad I could help. I guess that the STL file did not store normal information inside, so if the triangles are defined in an inconsistent manner, later the normals might be computed either facing inside or outside. -- Alberto ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgPlugins] A problem in rendering the exported file?
Alberto Luaces wrote: > > Hi Jaeha, > > I'd say that the normals are wrong. You can fix that easily in Blender. > > -- > Alberto > > Dear Alberto: Thank you for your quick reply. Your advice did perfectly work for me. By the way, I still do not understand why fixing normals in Blender did no help with *.STL format, but successfully worked with *.3ds... Anyway, thank you very much! :D -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59774#59774 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Synchronize animations between different computers
Hi Harald, The OSG uses an osg::FrameStamp object to provide control over timing related features, this object has a SimulationTime and ReferenceTime parameters. The SimulationTime is the time used by animation codes, while the ReferenceTime is actual time since the start of viewer's time stamp was initialized - basically when you started rendering. By default the osgViewer::Viewer/CompositeViewer will set the FrameStamp on each new frame and the SimulationTIme and ReferenceTime will be consistent, but you can provide the viewer.frame() call with your own time to use for the SimulationTime by unrolling the viewer main loop to something like: while(!viewer.done()) { double mySimulationTime = myGetSimulationTimeFunction(); viewer.frame(mySimulationTime); } Robert. On 15 June 2014 17:59, Harald Müller wrote: > Hi, > Currently I am playing around with distributed rendering, for that I need to > synchronize Animations between 2 or more computers. > So the easiest way to achieve that is to synchronize animations with a server > time. E.g. if the servers says it is time X, I set the animation on each > computer to time X. > My first thought was to use the addUpdateCallback and set in the > operator()(osg::Node* node, osg::NodeVisitor* nv) method the animation time, > but there is no setAnimationTime(...) > After that I was trying with setTimeOffset(...) but this didn't work too. > Now I am out of guesses > Thank you for any help! > > Cheers, > Harald > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=59747#59747 > > > > > > ___ > 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: osgGA::GUIEventAdapter returns wrong mouse ranges on android
Hi Paul, The osgGA::GUIEventAdapter has an MouseYOrientation value that provides information on which way up the Y axis is. OpenGL has Y going up, while most UI toolkits have Y going down, to handle this discrepency osgGA::GUIEventAdapter provides the MouseYOrigentation and other utilities adapt it to make sure it's in the correct default OSG orientation which is Y up - consistent with OpenGL. Robert. On 17 June 2014 01:48, Paul wrote: > I can confirm this issue. > > For android I use setUpViewerAsEmbeddedInWindow(0, 0, width, height) > and then setMouseInputRange(0, 0, width, height). I then send the input via > getEventQueue()->mouseButtonPress(x, y, button); The input coordinates from > android seem to be correct at this point, although it's flipped on the y > axis. Now, when I catch and use the events to use in OSG, the coordinates are > off. Is there an easy fix? > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=59764#59764 > > > > > > ___ > 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] Synchronize animations between different computers
I also tried to set a FramStamp: Code: void MyCallback::operator()(osg::Node* node, osg::NodeVisitor* nv) { ... osg::FrameStamp* fsMod = new osg::FrameStamp(); fsMod->setFrameNumber(10); fsMod->setReferenceTime(10); fsMod->setSimulationTime(10); nv->setFrameStamp(fsMod); ... } but this doesn't work, the animation is stuck at the first frame ... only if I use a varible instead of the constant 10 something happens: Code: void MyCallback::operator()(osg::Node* node, osg::NodeVisitor* nv) { ... osg::FrameStamp* fsMod = new osg::FrameStamp(); fsMod->setFrameNumber(i); fsMod->setReferenceTime(i); fsMod->setSimulationTime(i); i++; nv->setFrameStamp(fsMod); ... } this doesn't make sence to me, why does a special "SimulationTime" not refer a spezial frame at the animation? Thanks! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59771#59771 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgPlugins] A problem in rendering the exported file?
"Jaeha Kim" writes: > Hi, > > I'm a newbie in OpenSceneGraph, I'm glad to meet you :D > > I made some mechanical parts by using SolidWorks and exported the > parts with *.STL format, and then, I converted them to *.OSG (or > *.OBJ, *.DXF whatever) by using osgConv command. > > When trying to display the exported and converted files by using > osgViewer, I have a problem in rendering them; although they are > successfully rendered in other programs such as Blender and MeshLab, > the displayed result looks somewhat strange in osgViewer. > > (I attached three screen captures) > > Could you explain why this happens and how to solve this problem, > please? Hi Jaeha, I'd say that the normals are wrong. You can fix that easily in Blender. -- Alberto ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org