Re: [osg-users] Screen not refreshing-overlapping content.
Hi Praveena, On 5/07/12 23:19 , Praveena Sara wrote: > Code: > osg::ref_ptr beam = new osg::Geometry; > > osg::ref_ptr points = new osg::Vec3Array; > points->push_back(StartPoint); > points->push_back(EndPoint); > > osg::ref_ptr color = new osg::Vec4Array; > color->push_back(osg::Vec4(0.0f,1.0f,0.0f,1.0f)); > > beam->setVertexArray(points.get()); > beam->setColorArray(color.get()); > beam->setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE); > beam->addPrimitiveSet(new osg::DrawArrays(GL_LINES,0,2)); > > osg::ref_ptr geode = new osg::Geode; > geode->addDrawable(beam.get() ); > > > osg::ref_ptr lineWidth = new osg::LineWidth; > lineWidth->setWidth(5.0f); > > osg::StateSet* stateset = geode->getOrCreateStateSet(); > stateset->setAttribute(lineWidth.get()); > stateset->setMode(GL_LIGHTING, osg::StateAttribute::OFF); > > pat->addChild(geode); //osg::PositionAttitudeTransform > > > > The lines are drawn precisely but the screen is not refreshed, thus it keeps > all the > previously drawn lines. (Screenshot attached) It's not really possible to tell what might be going wrong based on the code fragment you've provided. Is this setup code? Called every time for a new line? You're apparently creating a new osg::Geode with a new osg::Drawable every time and adding the geode to an existing osg::PositionAttitudeTransform, without removing previous objects. I guess the PAT is just gathering a new Geode every time. If you only need a single line it's better to just create a single Geode and modify the coordinates on its Geometry/VertexArray. Cheers, /ulrich ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Saving and restoring GL state with OpenSceneGraph
Hi, I'm trying to find out a bit more about how to get OpenSceneGraph to share an OpenGL context with another library... and to do that properly i'd like to isolate both by saving and restoring state as appropriate. I know this isn't the 'right' way to use OSG, and I know that this kills performance, especially since OSG is designed to use lazy state updating... but sometimes its a necessary evil. I'm targeting OpenGL ES2. Looking through some other posts, I've gathered: You can get/save the current stateset by calling something like: myViewer->getCamera()->getGraphicsContext()->getState()->captureCurrentState(myStateSet); You can reset the current state by calling reset: myViewer->getCamera()->getGraphicsContext()->getState()->reset(); You can apply a saved state by calling apply: myViewer->getCamera()->getGraphicsContext()->getState()->apply(myStateSet); But I'm not sure about a few things: When should the osg::State be first saved? So basically, when is the scene graph first traversed and the osg::State built up so that it's appropriate for OSG to go ahead and render something? Does the initial OpenGL state when OSG first builds up osg::State matter (I'm guessing no)? After saving this valid state, i'd do something like this to restore it and render my scene... // draw call myViewer->getCamera()->getGraphicsContext()->getState()->reset(); // is this line necessary? myViewer->getCamera()->getGraphicsContext()->getState()->apply(myStateSet); myViewer->frame(); // save state again if I modified the scene Does that seem reasonable? Any advice/input would be appreciated. Thanks Preet ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] constant size overlay
Alpha to coverage didn't have any visible effect, but using alpha testing instead seems to work: Code: osg::AlphaFunc *af = new osg::AlphaFunc(); af->setFunction(osg::AlphaFunc::GEQUAL, 0.75f); ss->setAttributeAndModes(af, osg::StateAttribute::ON); Cheers, Michael[/code] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48719#48719 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Animate Nathan
Hi , First you need to understand how bone animations works, else you will not be able to manipulate the character. http://en.wikipedia.org/wiki/Skeletal_animation then you can try to touch osgAnimation::Bone it's the node used to control part of the skeleton. Cedric Pinson Provide OpenGL, WebGL services +33 659 598 614 - http://cedricpinson.com - http://osgjs.org - http://sketchfab.com On Jul 5, 2012, at 15:01 , Héctor Martínez wrote: > Hi, > > I am starting to play with animation in OSG. I would like to animate > Nathan.osg model. The aim is to have control over the different parts of the > body and get, for example, a rotating arm. I don’t know where to start. I > have been trying to use DOFTransform, but I can’t convert any of the children > to DOFTransform (I am getting NULL casting). I have also tried to create a > child DOFTransform node and add the arm as a child but not working either. > > Could someone give me some hints on where to concentrate? Tutorial, example > or just the right classes to do it. Or maybe if it is not possible with that > model, some clues about the right models to do that. > > Thank you in advance. > ___ > 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] how to add progress bar to readerwriter?
> > I implement a readerwriter plugin to read .las file which > contains tremendous amount of points . so i want to use progressbar to > tell the user how much points i have read . > anybody can tell me how to do? > Counting points isn't feasible, but counting progress through the input file is (for some formats): http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/LoadingProgress -- Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com http://www.alphapixel.com/ Training • Consulting • Contracting 3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 • GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL Digital Imaging • GIS • GPS • Telemetry • Cryptography • Digital Audio • LIDAR • Kinect • Embedded • Mobile • iPhone/iPad/iOS • Android ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Tree Rendering system based on OpenSceneGraph
> > I looked and analysed some articles about generation procedural trees. > I prefer this article. This is easy to implement and gives more realistic > results. > About project this is personal and will be open source. For everyone who > uses OSG in their projects. > f you have some ideas or work together on it please contact me. > I think you left out a URL, perhaps? > > -- Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com http://www.alphapixel.com/ Training • Consulting • Contracting 3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 • GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL Digital Imaging • GIS • GPS • Telemetry • Cryptography • Digital Audio • LIDAR • Kinect • Embedded • Mobile • iPhone/iPad/iOS • Android ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Problem with deferred rendering
Hi Wang Thanks for the Link. This is a really simple example. Is there a more advanced example working with the depth buffer, multiple lights and applying shadows rendered in a separate shadow pass? This is the stuff i'm kind of stuck... Wang Rui wrote: > Hi Daniel, > > Why not first have a look at the osgRecipes project which is also the code > repo of the book OpenSceneGraph Cookbook. It does has a very simple deferred > shading example in chapter 6. The book may require you to buy it but the code > is totally free at: > https://github.com/xarray/osgRecipes/tree/master/cookbook/chapter6/ch06_12 > (https://github.com/xarray/osgRecipes/tree/master/cookbook/chapter6/ch06_12) > > > Wang Rui > > > > 2012/7/5 Daniel Schmid < ()> > > > Hi Sebastian > > > > You were talking about a deferred shading example. Do you have any example > > code you could provide? I'm just about to start with deferred shading and > > I'm very interested in having a look... > > > > Regards > > Daniel > > > > > > Sebastian Messerschmidt wrote: > > > > > Hi Micael, > > > > > > Feel free to ask If you encounter more problems. > > > I was just planning to provide a minimal deferred shading example to the > > > community, but unfortunately I'm busy with other stuff right now. > > > > > > > > > > > > > > > -- > > Read this topic online here: > > http://forum.openscenegraph.org/viewtopic.php?p=48709#48709 > > (http://forum.openscenegraph.org/viewtopic.php?p=48709#48709) > > > > > > > > > > > > ___ > > osg-users mailing list > > () > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org) > > > > > -- > Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48716#48716 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Ho to change slave cameras offset matrix later on?
Hmpf thanks for the tip! I must have been very tired to overlook this very simple access *shame* Thank you!! Cheers, Torben -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48715#48715 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Animate Nathan
Hi, I am starting to play with animation in OSG. I would like to animate Nathan.osg model. The aim is to have control over the different parts of the body and get, for example, a rotating arm. I dont know where to start. I have been trying to use DOFTransform, but I cant convert any of the children to DOFTransform (I am getting NULL casting). I have also tried to create a child DOFTransform node and add the arm as a child but not working either. Could someone give me some hints on where to concentrate? Tutorial, example or just the right classes to do it. Or maybe if it is not possible with that model, some clues about the right models to do that. Thank you in advance. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Problems with DotOsgWrapper in OSG 3.1.1 on OSX 10.7
Hi guys, On 5/07/12 17:38 , Stephan Huber wrote: > Am 04.07.12 16:49, schrieb Mike Krus: >> Any ideas on how to fix this? Or anybody know if I can safely build the rest >> with GCC 4.3 and OSG with the llvm-gcc 4.2 that comes with XCode? > > AFAIK you'll have to use the apple-compilers for compiling osg, as only > the apple-compilers know how to handle Objective-C which is used for the > cocoa backend. > > Don't know if you can mix both compilers, I had problems in the past > compiling parts of osg with llvm-gcc and other parts of my code with clang. I've switched to use clang/clang++ (3.1svn) to compile OSG and with MacPorts compiled with Xcode-gcc without issues so far (but not a production environment). Cheers, /ulrich ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Can we please remove static initializations in OSG?
Hi. I'm trying to build OSG into my application. I've started with OSG logging. I've attached sample code that depicts the problem. After you run the program and than stop it by pressing ESC, you can see the following output: $ ./test abc DatabasePager::RequestQueue::~RequestQueue() Destructing queue. DatabasePager::RequestQueue::~RequestQueue() Destructing queue. DatabasePager::RequestQueue::~RequestQueue() Destructing queue. DatabasePager::RequestQueue::~RequestQueue() Destructing queue. ~RegisterWindowingSystemInterfaceProxy() GraphicsContext::setWindowingSystemInterface() 00x7ffd0fd71470 abc is printed after all delete operators take place. Somehow Viewer is deleted after I actually delete it. ~RegisterWindowingSystemInterfaceProxy() comes from the destruction of this static variable: http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/src/osgViewer/GraphicsWindowX11.cpp?rev=12923#L2137 GraphicsContext::setWindowingSystemInterface() 00x7ffd0fd71470 comes from the destructor of the above variable: http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/src/osgViewer/GraphicsWindowX11.cpp?rev=12923#L2132 This means OSG uses static variables which initialization and deinitialization times are unknown, which results in: 1) I can't really control my OSG logger lifetime; 2) I miss RegisterWindowingSystemInterfaceProxy() initialization in logger (and possibly many others). The only option is to create Logger specifically for OSG and let it die at an unknown time (after all my cleanup procedures), possibly causing me problems later. Can we please make it non-static? osg_static.tar Description: Unix tar archive ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Problem with deferred rendering
Hi Daniel, Why not first have a look at the osgRecipes project which is also the code repo of the book OpenSceneGraph Cookbook. It does has a very simple deferred shading example in chapter 6. The book may require you to buy it but the code is totally free at: https://github.com/xarray/osgRecipes/tree/master/cookbook/chapter6/ch06_12 Wang Rui 2012/7/5 Daniel Schmid > Hi Sebastian > > You were talking about a deferred shading example. Do you have any example > code you could provide? I'm just about to start with deferred shading and > I'm very interested in having a look... > > Regards > Daniel > > > Sebastian Messerschmidt wrote: > > Hi Micael, > > > > Feel free to ask If you encounter more problems. > > I was just planning to provide a minimal deferred shading example to the > > community, but unfortunately I'm busy with other stuff right now. > > > > > > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=48709#48709 > > > > > > ___ > 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] Problem with deferred rendering
Hi Sebastian You were talking about a deferred shading example. Do you have any example code you could provide? I'm just about to start with deferred shading and I'm very interested in having a look... Regards Daniel Sebastian Messerschmidt wrote: > Hi Micael, > > Feel free to ask If you encounter more problems. > I was just planning to provide a minimal deferred shading example to the > community, but unfortunately I'm busy with other stuff right now. > > -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48709#48709 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Ho to change slave cameras offset matrix later on?
Slave is just a simple struct. You can access its member directly. So setter/getter are not necessary. On Thu, Jul 5, 2012 at 1:52 PM, Torben Dannhauer wrote: > Hi, > > If the slave is set to RELATIVE_RF (default), then the slaves view matrix > and projectionmatrix is overwritten each frame by multiplying the min > camera matrix with the slaves offset matrix. > > Therefor I do not want to change to slaves matrix but the slaves offset > matrix. > > It seems I have to write and submit a setter funcion which allows later > changes of the offset matrices.. > > Thanks, > Torben > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=48703#48703 > > > > > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > -- Bob ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] how to add progress bar to readerwriter?
HI. I implement a readerwriter plugin to read .las file which contains tremendous amount of points . so i want to use progressbar to tell the user how much points i have read . anybody can tell me how to do? thank you___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Using the notification API with multi-threading - heap corruption errors
Re: Using the notification API with multi-threading - heap corruption errors Hi, > What I have gone for with src/osg/Notify.cpp is to use a NotifySingleton > class that holds all the global notify variables and initializes these in > it's constructor, then a static getNotifySingleton() function returns a > reference to locally defined static NotifySingleton. Finally to force the > NotifySingleton to initialize automatically rather than on first invocation > of osg::Notify() I have used a static proxy class that simple calls the > getNotifySingleton() to make sure that it's called right after loading the > library. > > My hope that this combination will ensure that the threading problems > relating to the initialization of the global notify variables you've seen > will not occur. This doesn't make the noitfy() handlers themselves thread > safe, I'll defer this to your own custom implementation. > > I have checked in my changes to svn/trunk and also attached the modified > Notify.cpp. Could you please test this and let me know if this works. Again, thanks for the revised code, Robert. I think, the modified version handles initialization of the notification mechanism more clearly and the proxy prevents concurrent initialization of the global resources. Anyway, both my working project and my test program crash with heap corruption more or less frequently. For now, I tested it on Win 7 x64. Based on the svn trunk version of Notify.cpp, I experimented with another approach. The solution is prototype, however, here is what worked for me: I used a thread local storage to separate access to osg::NotifyStream for each thread. As discussed earlier in this thread, this assumes stream classes (including std::ostream and std::stringbuf) to be at least reentrant. According to http://msdn.microsoft.com/en-us/library/c9ceah3b%28v=vs.100%29.aspx this is true at least for my Visual compiler implementation. Currently, there are some other drawbacks with this solution: As I used QThreadStorage for now, it requires QtCore library to be linked in core osg. Maybe, another TLS implementation would be more suitable (does OpenThreads has one?). Although I could not recognize capital performance loss yet, this may be another critical issue. Nevertheless, I tried the modified version upon OSG 3.0.1 on all my Win 7 x64 machines and the heap corruption never showed up again. For further inspection and interest, I attached my modified version of Notify.cpp which has a preprocessor flag OSG_NOTIFY_STREAM_PER_THREAD to toggle the use of thread local storage. Cheers, Matthias Schütze, Germany /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include #include #include #include #include #include #include #include #include #ifdef _DEBUG #define OSG_NOTIFY_STREAM_PER_THREAD // enables or disables the workaround for debug builds #else #define OSG_NOTIFY_STREAM_PER_THREAD // enables or disables the workaround for release builds #endif #ifdef OSG_NOTIFY_STREAM_PER_THREAD #include #endif // OSG_NOTIFY_STREAM_PER_THREAD #define OSG_INIT_SINGLETON_PROXY(ProxyName, Func) static struct ProxyName{ ProxyName() { Func; } } s_##ProxyName; namespace osg { class NullStreamBuffer : public std::streambuf { private: std::streamsize xsputn(const std::streambuf::char_type *str, std::streamsize n) { return n; } }; struct NullStream : public std::ostream { public: NullStream(): std::ostream(new NullStreamBuffer) { _buffer = dynamic_cast(rdbuf()); } ~NullStream() { rdbuf(0); delete _buffer; } protected: NullStreamBuffer* _buffer; }; /** Stream buffer calling notify handler when buffer is synchronized (usually on std::endl). * Stream stores last notification severity to pass it to handler call. */ struct NotifyStreamBuffer : public std::stringbuf { NotifyStreamBuffer() : _severity(osg::NOTICE) { } void setNotifyHandler(osg::NotifyHandler *handler) { _handler = handler; } osg::NotifyHandler *getNotifyHandler() const { return _handler.get(); } /** Sets severity for next call of notify handler */ void setCurrentSeverity(osg::NotifySeverity severity) { _severity = severity; } osg::NotifySeverity getCurrentSeverity() const { return _severity; } private: int sync() { sputc(0); // string termination if (_handler.valid()) _handler-
Re: [osg-users] Tree Rendering system based on OpenSceneGraph
Hi, Sorry I did not understood that this document was a final choice. I'm interested in L-Systems more in than tree generation, so I don't think it will be interesting to work together. Good luck. Cheers, Vincent -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48705#48705 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Problems with DotOsgWrapper in OSG 3.1.1 on OSX 10.7
Hi Mike, Am 04.07.12 16:49, schrieb Mike Krus: > Any ideas on how to fix this? Or anybody know if I can safely build the rest > with GCC 4.3 and OSG with the llvm-gcc 4.2 that comes with XCode? AFAIK you'll have to use the apple-compilers for compiling osg, as only the apple-compilers know how to handle Objective-C which is used for the cocoa backend. Don't know if you can mix both compilers, I had problems in the past compiling parts of osg with llvm-gcc and other parts of my code with clang. cheers, Stephan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org