Re: [osg-users] [build] LNK1181 fatal error ONLY for libpng.lib
Hi, that is strange on my system the auto detection works as expected, I don't have to modify file entries.. Cheers, Torben -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40149#40149 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgPPU] Render lower Resolution with unitOut than wandow / fullscreen
Hi Art, Thx for your answer, that worked, kind of, but have now some new issues. I am using the Glow example, Blur and Original are out of Sync. Will try to figure out, and ask/answer later. Thank you! Cheers, ParticlePeter -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40150#40150 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgPPU] Render lower Resolution with unitOut than wandow / fullscreen
I Peter, I've experienced the same issue some time ago, but could not find the real cause. I've tried several combinations of pre-post render order of cameras, and renderbin order for processor, but none of them solved the issue. If you make any progress please post some news... =) Thanks you! Ricky On Tue, Jun 7, 2011 at 09:40, Peter Wrobel particlepe...@gmx.de wrote: Hi Art, Thx for your answer, that worked, kind of, but have now some new issues. I am using the Glow example, Blur and Original are out of Sync. Will try to figure out, and ask/answer later. Thank you! Cheers, ParticlePeter -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40150#40150 ___ 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] [osgPlugins] Problems in installing FBX plugin
Hi, I installed the FBX SDK , then I mentioned the path to the include and libraries. I build OSG-2.9.6, and Install it, everything worked well. -- Mohamed ALJI -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40153#40153 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] too much computation
Hi I have modified the createHUD function provided in the 'osgpick' example, for my application as below. Essentially i have to plot a matrix of values on the screen with each matrix entry represented by a square and its color represented by its value. The size of the matrix is 1615 x 1615. when i run the program, it takes a long time with a blank screen before giving a segmentation fault message. Can I get some help on this - the reason for the error and an efficient way to do this, because I may have to plot 6500 x 6500 sized matrices in the future. I have also posted the gdb output below. Thank you == modified createHUD function used in my application osg::Node* createHUD(osgText::Text* updateText, vectorvectordouble simmat, double max) { // create the hud. derived from osgHud.cpp // adds a set of quads, each in a separate Geode - which can be picked individually // eg to be used as a menuing/help system! // Can pick texts too! osg::Camera* hudCamera = new osg::Camera; hudCamera-setReferenceFrame(osg::Transform::ABSOLUTE_RF); hudCamera-setProjectionMatrixAsOrtho2D(0,3200,0,1600); hudCamera-setViewMatrix(osg::Matrix::identity()); hudCamera-setRenderOrder(osg::Camera::POST_RENDER); hudCamera-setClearMask(GL_DEPTH_BUFFER_BIT); std::string timesFont(fonts/times.ttf); // turn lighting off for the text and disable depth test to ensure its always ontop. osg::Vec3 position(100.0f,1550.0f,0.0f); osg::Vec3 delta(0.0f,-60.0f,0.0f); osg::Geode* geode = new osg::Geode(); osg::StateSet* stateset = geode-getOrCreateStateSet(); stateset-setMode(GL_LIGHTING,osg::StateAttribute::OFF); stateset-setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF); for(int i=0; isimmat.size(); i++) { for(int j=0; jsimmat[i].size(); j++) { osg::Geometry *quad=new osg::Geometry; osg::Vec3Array* vertices = new osg::Vec3Array(4); // 1 quad osg::Vec4Array* colors = new osg::Vec4Array; double colorval=simmat[i][j]/max; colors-push_back(osg::Vec4(colorval,colorval,colorval, 1.0)); quad-setColorArray(colors); quad-setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE); osg::Vec3 newpos=position+osg::Vec3(j,i,0); (*vertices)[0]=newpos; (*vertices)[1]=newpos+osg::Vec3(0.0f,-1.0f,0.0f); (*vertices)[2]=newpos+osg::Vec3(1.0f,-1.0f,0.0f); (*vertices)[3]=newpos+osg::Vec3(1.0f,0.0f,0.0f); quad-setVertexArray(vertices); quad-addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4)); geode-addDrawable(quad); } } hudCamera-addChild(geode); return hudCamera; } === GDB output: Starting program: /hemanth/Workspace/visualization/a.out /hemanth/Workspace/loop_closure/log_pavin25610_56_usurf128_delta4_tfidfm/matches [Thread debugging using libthread_db enabled] [New Thread 0xb7b48b70 (LWP 3756)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xb7b48b70 (LWP 3756)] 0x01276690 in ?? () from /usr/lib/dri/swrast_dri.so (gdb) bt #0 0x01276690 in ?? () from /usr/lib/dri/swrast_dri.so #1 0x012767d8 in _mesa_NewList () from /usr/lib/dri/swrast_dri.so #2 0x002c1944 in osg::Drawable::compileGLObjects(osg::RenderInfo) const () from /usr/local/lib/libosg.so.65 #3 0x005ac85b in osgUtil::GLObjectsVisitor::apply(osg::Drawable) () from /usr/local/lib/libosgUtil.so.65 #4 0x005ad461 in osgUtil::GLObjectsVisitor::apply(osg::Geode) () from /usr/local/lib/libosgUtil.so.65 #5 0x002d7079 in osg::Geode::accept(osg::NodeVisitor) () from /usr/local/lib/libosg.so.65 #6 0x0030e7d4 in osg::Group::traverse(osg::NodeVisitor) () from /usr/local/lib/libosg.so.65 #7 0x005ad3db in osgUtil::GLObjectsVisitor::apply(osg::Node) () from /usr/local/lib/libosgUtil.so.65 #8 0x0034ff18 in osg::NodeVisitor::apply(osg::Group) () from /usr/local/lib/libosg.so.65 #9 0x0034fff8 in osg::NodeVisitor::apply(osg::Transform) () from /usr/local/lib/libosg.so.65 #10 0x00350018 in osg::NodeVisitor::apply(osg::Camera) () from /usr/local/lib/libosg.so.65 #11 0x002932f9 in osg::Camera::accept(osg::NodeVisitor) () from /usr/local/lib/libosg.so.65 #12 0x0030e7d4 in osg::Group::traverse(osg::NodeVisitor) () from
Re: [osg-users] [build] LNK1181 fatal error ONLY for libpng.lib
Hi zook, I am using : CMake 2.8.4 - x86 Windows XP Professionnal - x64 maybe the 32-bit and 64-bit causes the problem ? Mohamed ALJI -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40155#40155 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] [build] xcode4 link error
Hi, I built the OSG libraries using cmake to generate an xcode project. I then used Xcode4 to compile the libraries. This all went fine. I created a new Xcode4 project using the code from the Simple example that had been provided as part of the Xcode project in the iphone branch (the app is named osgTerrain). When I include the osgPlugins.h header file, I get several linker error as shown below: Undefined symbols for architecture i386: _dotosgwrapper_AlphaFunc, referenced from: __static_initialization_and_destruction_0(int, int)in osgTerrainAppDelegate.o The link libraries were set up in Build Phases. All of the OSG static libraries generated have been included. Why am I getting these linker errors? Thank you! Cheers, Lanier -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40148#40148 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] too much computation
From the first look I'd advise to split up the geometries and put them into multiple nodes. Looking at the code I don't know which limit you're hitting here, but there are limits in the opengl implementations that might dissallow buffers beyond certain sizes. cheers Sebastian Hi I have modified the createHUD function provided in the 'osgpick' example, for my application as below. Essentially i have to plot a matrix of values on the screen with each matrix entry represented by a square and its color represented by its value. The size of the matrix is 1615 x 1615. when i run the program, it takes a long time with a blank screen before giving a segmentation fault message. Can I get some help on this - the reason for the error and an efficient way to do this, because I may have to plot 6500 x 6500 sized matrices in the future. I have also posted the gdb output below. Thank you == modified createHUD function used in my application osg::Node* createHUD(osgText::Text* updateText, vectorvectordouble simmat, double max) { // create the hud. derived from osgHud.cpp // adds a set of quads, each in a separate Geode - which can be picked individually // eg to be used as a menuing/help system! // Can pick texts too! osg::Camera* hudCamera = new osg::Camera; hudCamera-setReferenceFrame(osg::Transform::ABSOLUTE_RF); hudCamera-setProjectionMatrixAsOrtho2D(0,3200,0,1600); hudCamera-setViewMatrix(osg::Matrix::identity()); hudCamera-setRenderOrder(osg::Camera::POST_RENDER); hudCamera-setClearMask(GL_DEPTH_BUFFER_BIT); std::string timesFont(fonts/times.ttf); // turn lighting off for the text and disable depth test to ensure its always ontop. osg::Vec3 position(100.0f,1550.0f,0.0f); osg::Vec3 delta(0.0f,-60.0f,0.0f); osg::Geode* geode = new osg::Geode(); osg::StateSet* stateset = geode-getOrCreateStateSet(); stateset-setMode(GL_LIGHTING,osg::StateAttribute::OFF); stateset-setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF); for(int i=0; isimmat.size(); i++) { for(int j=0; jsimmat[i].size(); j++) { osg::Geometry *quad=new osg::Geometry; osg::Vec3Array* vertices = new osg::Vec3Array(4); // 1 quad osg::Vec4Array* colors = new osg::Vec4Array; double colorval=simmat[i][j]/max; colors-push_back(osg::Vec4(colorval,colorval,colorval, 1.0)); quad-setColorArray(colors); quad-setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE); osg::Vec3 newpos=position+osg::Vec3(j,i,0); (*vertices)[0]=newpos; (*vertices)[1]=newpos+osg::Vec3(0.0f,-1.0f,0.0f); (*vertices)[2]=newpos+osg::Vec3(1.0f,-1.0f,0.0f); (*vertices)[3]=newpos+osg::Vec3(1.0f,0.0f,0.0f); quad-setVertexArray(vertices); quad-addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4)); geode-addDrawable(quad); } } hudCamera-addChild(geode); return hudCamera; } === GDB output: Starting program: /hemanth/Workspace/visualization/a.out /hemanth/Workspace/loop_closure/log_pavin25610_56_usurf128_delta4_tfidfm/matches [Thread debugging using libthread_db enabled] [New Thread 0xb7b48b70 (LWP 3756)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xb7b48b70 (LWP 3756)] 0x01276690 in ?? () from /usr/lib/dri/swrast_dri.so (gdb) bt #0 0x01276690 in ?? () from /usr/lib/dri/swrast_dri.so #1 0x012767d8 in _mesa_NewList () from /usr/lib/dri/swrast_dri.so #2 0x002c1944 in osg::Drawable::compileGLObjects(osg::RenderInfo) const () from /usr/local/lib/libosg.so.65 #3 0x005ac85b in osgUtil::GLObjectsVisitor::apply(osg::Drawable) () from /usr/local/lib/libosgUtil.so.65 #4 0x005ad461 in osgUtil::GLObjectsVisitor::apply(osg::Geode) () from /usr/local/lib/libosgUtil.so.65 #5 0x002d7079 in osg::Geode::accept(osg::NodeVisitor) () from /usr/local/lib/libosg.so.65 #6 0x0030e7d4 in osg::Group::traverse(osg::NodeVisitor) () from /usr/local/lib/libosg.so.65 #7 0x005ad3db in osgUtil::GLObjectsVisitor::apply(osg::Node) () from /usr/local/lib/libosgUtil.so.65 #8 0x0034ff18 in osg::NodeVisitor::apply(osg::Group) () from /usr/local/lib/libosg.so.65 #9 0x0034fff8 in
Re: [osg-users] [osgPPU] Render lower Resolution with unitOut than wandow / fullscreen
Hi, I suppose they are not out of sync, but one is just one frame later than the other. In order to checkout the pipeline, you can run osgPPU in debug mode, I don't remember exactly (take a look into readme) you need to setup an environment variable. Then when unit pipeline is processed it will output to the console the units in the order they are rendered. This might help to debug the issue. Cheers, Art -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40157#40157 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] too much computation
Hi, another option instead of drawing geometry would be to put your data into a texture (image) and then just visualise that. Using nearest sampling would give you little squares too. jp On 07/06/11 12:38, Sebastian Messerschmidt wrote: From the first look I'd advise to split up the geometries and put them into multiple nodes. Looking at the code I don't know which limit you're hitting here, but there are limits in the opengl implementations that might dissallow buffers beyond certain sizes. cheers Sebastian Hi I have modified the createHUD function provided in the 'osgpick' example, for my application as below. Essentially i have to plot a matrix of values on the screen with each matrix entry represented by a square and its color represented by its value. The size of the matrix is 1615 x 1615. when i run the program, it takes a long time with a blank screen before giving a segmentation fault message. Can I get some help on this - the reason for the error and an efficient way to do this, because I may have to plot 6500 x 6500 sized matrices in the future. I have also posted the gdb output below. Thank you == modified createHUD function used in my application osg::Node* createHUD(osgText::Text* updateText, vectorvectordouble simmat, double max) { // create the hud. derived from osgHud.cpp // adds a set of quads, each in a separate Geode - which can be picked individually // eg to be used as a menuing/help system! // Can pick texts too! osg::Camera* hudCamera = new osg::Camera; hudCamera-setReferenceFrame(osg::Transform::ABSOLUTE_RF); hudCamera-setProjectionMatrixAsOrtho2D(0,3200,0,1600); hudCamera-setViewMatrix(osg::Matrix::identity()); hudCamera-setRenderOrder(osg::Camera::POST_RENDER); hudCamera-setClearMask(GL_DEPTH_BUFFER_BIT); std::string timesFont(fonts/times.ttf); // turn lighting off for the text and disable depth test to ensure its always ontop. osg::Vec3 position(100.0f,1550.0f,0.0f); osg::Vec3 delta(0.0f,-60.0f,0.0f); osg::Geode* geode = new osg::Geode(); osg::StateSet* stateset = geode-getOrCreateStateSet(); stateset-setMode(GL_LIGHTING,osg::StateAttribute::OFF); stateset-setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF); for(int i=0; isimmat.size(); i++) { for(int j=0; jsimmat[i].size(); j++) { osg::Geometry *quad=new osg::Geometry; osg::Vec3Array* vertices = new osg::Vec3Array(4); // 1 quad osg::Vec4Array* colors = new osg::Vec4Array; double colorval=simmat[i][j]/max; colors-push_back(osg::Vec4(colorval,colorval,colorval, 1.0)); quad-setColorArray(colors); quad-setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE); osg::Vec3 newpos=position+osg::Vec3(j,i,0); (*vertices)[0]=newpos; (*vertices)[1]=newpos+osg::Vec3(0.0f,-1.0f,0.0f); (*vertices)[2]=newpos+osg::Vec3(1.0f,-1.0f,0.0f); (*vertices)[3]=newpos+osg::Vec3(1.0f,0.0f,0.0f); quad-setVertexArray(vertices); quad-addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4)); geode-addDrawable(quad); } } hudCamera-addChild(geode); return hudCamera; } === GDB output: Starting program: /hemanth/Workspace/visualization/a.out /hemanth/Workspace/loop_closure/log_pavin25610_56_usurf128_delta4_tfidfm/matches [Thread debugging using libthread_db enabled] [New Thread 0xb7b48b70 (LWP 3756)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xb7b48b70 (LWP 3756)] 0x01276690 in ?? () from /usr/lib/dri/swrast_dri.so (gdb) bt #0 0x01276690 in ?? () from /usr/lib/dri/swrast_dri.so #1 0x012767d8 in _mesa_NewList () from /usr/lib/dri/swrast_dri.so #2 0x002c1944 in osg::Drawable::compileGLObjects(osg::RenderInfo) const () from /usr/local/lib/libosg.so.65 #3 0x005ac85b in osgUtil::GLObjectsVisitor::apply(osg::Drawable) () from /usr/local/lib/libosgUtil.so.65 #4 0x005ad461 in osgUtil::GLObjectsVisitor::apply(osg::Geode) () from /usr/local/lib/libosgUtil.so.65 #5 0x002d7079 in osg::Geode::accept(osg::NodeVisitor) () from /usr/local/lib/libosg.so.65 #6 0x0030e7d4 in osg::Group::traverse(osg::NodeVisitor) () from /usr/local/lib/libosg.so.65 #7 0x005ad3db in
Re: [osg-users] [build] xcode4 link error
Hi, Am 07.06.11 08:40, schrieb Lem Davis: Undefined symbols for architecture i386: _dotosgwrapper_AlphaFunc, referenced from: __static_initialization_and_destruction_0(int, int)in osgTerrainAppDelegate.o The link libraries were set up in Build Phases. All of the OSG static libraries generated have been included. Why am I getting these linker errors? Your code (namely osgPlugins.h) wants to link against the osg-plugin, remove the entry in osgPlugins.h or add the osgdb_osg.so and osgdb_deprecated_osg.so to your linking stage. cheers, Stephan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] General render debugging question
Hi Brad, I’m currently trying to track down a render-time application crash. What I’m wondering is how to trace from a crash in the rendergraph to the associated node(s) in the scene graph. Is there any straight forward way? Once you've captured a crash in the debugger, you'll generally be right at the point of the crash in the stack trace, so you can inspect any local variables or the this pointer's members for clues. Generally you might have access to a state or stateset pointer, and in that case you can go up to its _parent, which might be a drawable or a node, check to see if it has a name, if not go to _parent again until you find one that has a name. Also check if all state attributes in the state or stateset are valid (good pointers and not deleted), etc. If your app is crashing somewhere deep in the draw traversal that might be one thing that could happen. Finally you can generally check the stack trace of other threads running, one thing that might happen to make your app crash is if one thread is in the process of modifying or deleting some object that the draw traversal is currently using. All this info is easily available in the Visual Studio debugger, I personally think it's a very good debugger. Hope this helps, J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.dyndns-web.com/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [build] LNK1181 fatal error ONLY for libpng.lib
Hi Mohamed, I am using : * CMake 2.8.4 - x86 * Windows XP Professionnal - x64 maybe the 32-bit and 64-bit causes the problem ? CMake is only a tool to generate project files, its bitness doesn't matter. Also, your OS is 64 bit so it can run both 32 bit and 64 bit executables. So this is not an issue either. The important part is, are you generating for Visual Studio 32 or 64 bit, and do you have the 32 or 64 bit 3rdparty dependencies. These two must match. Hope this helps, J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.dyndns-web.com/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [build] LNK1181 fatal error ONLY for libpng.lib
Hi Jean, thank you for your answer it really helps but, I forgot about building OSG on 64-bit ( maybe later ), now on 32-bit : Cmake mention Visual Studio 9 2008 Win64 as Generator. the dependecies I'm using are 3rdParty_win32binaries_vs90sp1. what do you think ? Mohamed ALJI -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40163#40163 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [build] LNK1181 fatal error ONLY for libpng.lib
Hi Mohamed, Hi Jean, thank you for your answer it really helps but, I forgot about building OSG on 64-bit ( maybe later ), now on 32-bit : * Cmake mention Visual Studio 9 2008 Win64 as Generator. * the dependecies I'm using are 3rdParty_win32binaries_vs90sp1. what do you think ? Well obviously there's a mismatch... If you want to build for 32 bit, you need to generate for Visual Studio 32 bit (you're using 64 bit, so that's wrong), and use the 32 bit 3rdparty dependencies (you're using 32 bit, so that's ok). I suggest you delete your build directory and start over, selecting Visual Studio 32 bit as generator. Hope this helps, J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.dyndns-web.com/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [build] LNK1181 fatal error ONLY for libpng.lib
and that exactly what I'm doing ... it detects everything correctly ( assuming that the environments variables are set ) thank you Jean Have a nice day :) Mohamed ALJI -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40165#40165 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Meta-data in core OSG - project started
Hi All, After my first cut of the new osg::Object::UserData functionality I've been pondering on how best to provide the ability to customize the data storage container, if at all. Simplicity and performance are the key reasons for not providing the ability to customize the data storage container as it enevitablly requires use of virtual functions for data access, extra classes and public methods for these. I personally don't see performance when using user data as being that critical - it will only be an occassional node that will have user data and the data won't typically be accessed in such an intense manner as data strucutres like drawables and statesets. Given this assumption the issue of using virtual functions for data access won't be a critical issue. This left the issue of code simplicity. The orignal code I checked in was pretty well the simplicist I could come up with whilst still providing the basic user object functionality. Adding the ability to subclasses forces extra complexity into the implementation and interface as we have to make the interface for setting and getting the UserDataContainer public, as well as the provide the class interface to the user data access methods. If we are to add the subclassing feature than we can't avoid this extra complexity completly, the best we can do is minimize this complexity creep. This morning I set about seeing if I could do this. One of the constraints I set myself was the ability to add serialization support for the new user data functionality, I've already provided this for the ValueObject types, and to add this for a customizable UserDataContainer we then have to subclass this container from osg::Object. The conudrum with this is that the convinince methods for accessing the UserData, the UserObject list and the Descriptions list are all in osg::Object and my original implememtation just defered this to the UserDataContainer, but if UserDataContainer subclasses from osg::Object it will inherit all these access methods so there is potential for confusion and duplication. I couldn't find a way around this - we either move out the access methods out of osg::Object into a UserDataContainer class and have users do a object-getUserDataContainer()-get...(), or provide an new class ObjectWithUserDataContainerInterface that subclasses from osg::Object and provides the data access methods with StateSet,Node, Drawable etc. inheriting from this ObjectWithUserDataContainerInterface to get the functionality. I did originally try that later approach but inserting an extra node in the class inheritance of these core OSG classes just ended up being an unweildly mess and provided a knock on effect on all the serializers. Yuck. Another approach I original toyed with before I simplified things was to make all the key user data access methods in osg::Object virtual and have them defer to an agregated UserDataContainer for their implementation. The UserDataContainer being subclased from osg::Object would then override this default implementations of the access methods and rather than deferring to it's onw internal _userDataContainer for it's implementation would provide the data structures itself. This approach I felt was a bit awkward, so for my first pass implementation ended up going for non virtual methods and a simply UserDataContainer struct to store the required data. Having reviewed all the options again I came back to the virtual functions in osg::Object in the above a paragraph as being the most pratical way to provide the customizable UserDataContainer functionality. I have now gone ahead and implemented it to test out how much complexity creeps in and how easy it is to manage the implementation and serialization support. The implementation works fine, and I don't believe the extra complexity isn't so great that it will be hinderance to maintainability or a hinderance to users getting to grips with it. I still feel that the virtual functions being all embedded in osg::Object is a bit hacky, but I can't see an easy way around this whilst retaining backwards compatibility. If I were to write the OSG from scratch with this user data functionality I'd probably go for a different scheme, but we don't really have this luxury, but with a mature project sometimes you just have to find a workable compromise. So what does it look in practice? We'll I'm comfortable enough with the implementation that I've gone ahead and checked it into svn/trunk, so please do an svn update and let me know how you get on with build and runtime. In the osguserdata example I've added a very simple MyUserDataContainer subclass along with a very simple serializer for it, you can run the app and use this custom container by running the app with the --mydc (my data container) and if it works you'll get the usual output plus lines like MyUserDataContainer::getUserObject(9). The custom user data container in this example is kept very simply by just subclassing from
Re: [osg-users] too much computation
Thank you for your answer. can I find an example related to this idea ? On Tue, Jun 7, 2011 at 1:27 PM, J.P. Delport jpdelp...@csir.co.za wrote: Hi, another option instead of drawing geometry would be to put your data into a texture (image) and then just visualise that. Using nearest sampling would give you little squares too. jp On 07/06/11 12:38, Sebastian Messerschmidt wrote: From the first look I'd advise to split up the geometries and put them into multiple nodes. Looking at the code I don't know which limit you're hitting here, but there are limits in the opengl implementations that might dissallow buffers beyond certain sizes. cheers Sebastian Hi I have modified the createHUD function provided in the 'osgpick' example, for my application as below. Essentially i have to plot a matrix of values on the screen with each matrix entry represented by a square and its color represented by its value. The size of the matrix is 1615 x 1615. when i run the program, it takes a long time with a blank screen before giving a segmentation fault message. Can I get some help on this - the reason for the error and an efficient way to do this, because I may have to plot 6500 x 6500 sized matrices in the future. I have also posted the gdb output below. Thank you == modified createHUD function used in my application osg::Node* createHUD(osgText::Text* updateText, vectorvectordouble simmat, double max) { // create the hud. derived from osgHud.cpp // adds a set of quads, each in a separate Geode - which can be picked individually // eg to be used as a menuing/help system! // Can pick texts too! osg::Camera* hudCamera = new osg::Camera; hudCamera-setReferenceFrame(osg::Transform::ABSOLUTE_RF); hudCamera-setProjectionMatrixAsOrtho2D(0,3200,0,1600); hudCamera-setViewMatrix(osg::Matrix::identity()); hudCamera-setRenderOrder(osg::Camera::POST_RENDER); hudCamera-setClearMask(GL_DEPTH_BUFFER_BIT); std::string timesFont(fonts/times.ttf); // turn lighting off for the text and disable depth test to ensure its always ontop. osg::Vec3 position(100.0f,1550.0f,0.0f); osg::Vec3 delta(0.0f,-60.0f,0.0f); osg::Geode* geode = new osg::Geode(); osg::StateSet* stateset = geode-getOrCreateStateSet(); stateset-setMode(GL_LIGHTING,osg::StateAttribute::OFF); stateset-setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF); for(int i=0; isimmat.size(); i++) { for(int j=0; jsimmat[i].size(); j++) { osg::Geometry *quad=new osg::Geometry; osg::Vec3Array* vertices = new osg::Vec3Array(4); // 1 quad osg::Vec4Array* colors = new osg::Vec4Array; double colorval=simmat[i][j]/max; colors-push_back(osg::Vec4(colorval,colorval,colorval, 1.0)); quad-setColorArray(colors); quad-setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE); osg::Vec3 newpos=position+osg::Vec3(j,i,0); (*vertices)[0]=newpos; (*vertices)[1]=newpos+osg::Vec3(0.0f,-1.0f,0.0f); (*vertices)[2]=newpos+osg::Vec3(1.0f,-1.0f,0.0f); (*vertices)[3]=newpos+osg::Vec3(1.0f,0.0f,0.0f); quad-setVertexArray(vertices); quad-addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4)); geode-addDrawable(quad); } } hudCamera-addChild(geode); return hudCamera; } === GDB output: Starting program: /hemanth/Workspace/visualization/a.out /hemanth/Workspace/loop_closure/log_pavin25610_56_usurf128_delta4_tfidfm/matches [Thread debugging using libthread_db enabled] [New Thread 0xb7b48b70 (LWP 3756)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xb7b48b70 (LWP 3756)] 0x01276690 in ?? () from /usr/lib/dri/swrast_dri.so (gdb) bt #0 0x01276690 in ?? () from /usr/lib/dri/swrast_dri.so #1 0x012767d8 in _mesa_NewList () from /usr/lib/dri/swrast_dri.so #2 0x002c1944 in osg::Drawable::compileGLObjects(osg::RenderInfo) const () from /usr/local/lib/libosg.so.65 #3 0x005ac85b in osgUtil::GLObjectsVisitor::apply(osg::Drawable) () from /usr/local/lib/libosgUtil.so.65 #4 0x005ad461 in osgUtil::GLObjectsVisitor::apply(osg::Geode) () from /usr/local/lib/libosgUtil.so.65 #5 0x002d7079 in
Re: [osg-users] too much computation
On 6/7/2011 5:27 AM, J.P. Delport wrote: Hi, another option instead of drawing geometry would be to put your data into a texture (image) and then just visualise that. Using nearest sampling would give you little squares too. I think I suggested this tactic before. You're talking 2,608,225 -- over two and a half million objects, each made of some number of primitives. You've never really explained what you're trying to _do_ at a higher level, so it's hard to make recommendations for how TO do it. -- Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com http://www.alphapixel.com/ Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. Contracting. There is no Truth. There is only Perception. To Perceive is to Exist. - Xen ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Absolute beginner questions
Thanks for the post, very helpful. I just have some follow-up questions. Skylark wrote: Hello Basil, First piece of advice, take things one step at a time, it might seem like a lot but it's all easy once you get through it once. Also, you seem to be going at this blind. Do you know about OSG's main site? From there, you can follow the Documentation link on the right, and you can click Getting Started to get an intro with Linux/Unix-centric build instructions, or you can go to Platform Specifics and then Windows - Visual Studio to get Windows-specific build instructions. Here's the direct link: This is the CMake command-line tool. You seem to be building for Windows (from what you say below) so I recommend you use the CMake GUI because it will give you a list of the available settings you can modify. Until you know what settings you need to modify, the GUI will be a good tool to get your bearings. Next, about those libs it says you're missing. You can get a prebuilt dependencies package for Visual Studio 2008 here: This will take care of the most important dependencies (IMHO the most important are jpeg, png, gif, etc. to be able to load textures from images, and freetype to be able to load fonts to display text). But all in all, most dependencies are entirely optional. OpenAL, CURL, WxWidgets, Qt, etc fall into that category. If you want to use them, you can download binaries or build them from source, and then enter the relevant paths to includes and libraries in the CMake GUI, but until you know you need a specific dependency, you can assume you don't. I ran that and am now missing CURL_LIBRARY_DEBUG, FREETYPE_LIBRARY_DEBUG, GIFLIB_LIBRARY_DEBUG, GLUT_LIBRARY_DEBUG, JPEG_LIBRARY_DEBUG, TIFF_LIBRARY_DEBUG, and ZLIB_LIBRARY_DEBUG. Do you know where I can get these? A morning filled with googling and trying to build them myself proved fruitless... If you downloaded the OSG source, you need to compile the whole OSG, not just an example. Here you're trying to compile an example without having compiled OSG itself, so of course it won't find the libraries. This is what I mean when I say to take things one step at a time. You're skipping whole steps by opening one specific example's project file. So, one step at a time. 1. Open the CMake GUI 2. Drag and drop the root CMakeLists.txt (in the root of your OSG source tree) onto the CMake GUI window. This will fill the where is the source and where to build the binaries fields, though I recommend you change the where to build the binaries to some other directory so you don't pollute your source tree. I generally add /build_x86_vc9 or something like that to identify which platform/compiler combination I'm generating project files for. 3. Click Configure a first time. CMake will ask you whether you want to create the build directory if it doesn't yet exist, then it will ask you for which platform/compiler you want to generate. I assume you'll want to select Visual Studio 9 (2008) (x86) or something like that. 4. You'll notice the center part of the window will be full of red fields. First thing to change is to set ACTUAL_3RDPARTY_DIR to the directory where you've put the prebuilt dependencies I linked to above. Then you can click Configure again, CMake will try to find as many of the dependencies as it can by itself. this would just be /OpenSceneGraph/bin correct? 5. At this point you can change settings as you see fit. Make sure you show Advanced Settings at the top of the CMake window, otherwise some important settings may be hidden, it's an annoying quirk of CMake. If CMake didn't find some dependency you know you have, you can fill in its *_INCLUDE_DIR and *_LIBRARY fields so it will be used. You can check BUILD_EXAMPLES if you want it to generate project files for all the examples. Look over the other options you have, but in the end you can just click Configure until there are no red fields anymore. I highly recommend you set CMAKE_INSTALL_PREFIX to some directory in which you want to put your compiled binaries, again separate from your source and build trees. That way you're sure where the different things are, and you won't get files mixed up between the 3. The directory you specify in CMAKE_INSTALL_PREFIX is the one you'll eventually use when you want to develop an application that uses OSG - it will have an include, a lib, and a bin subdirectories containing the files you expect. 6. Click Generate. After a few seconds, it will have finished generating the project files, and you can close the CMake GUI. 7. Open the build directory you specified in where to build the binaries in CMake, and you'll see an OpenSceneGraph.sln file. Double-click that, and you'll see a solution file with a bunch of projects, first for the OSG libs themselves, and all the examples, applications,
Re: [osg-users] Absolute beginner questions
Hi Basil, I ran that and am now missing CURL_LIBRARY_DEBUG, FREETYPE_LIBRARY_DEBUG, GIFLIB_LIBRARY_DEBUG, GLUT_LIBRARY_DEBUG, JPEG_LIBRARY_DEBUG, TIFF_LIBRARY_DEBUG, and ZLIB_LIBRARY_DEBUG. Do you know where I can get these? A morning filled with googling and trying to build them myself proved fruitless... They should be part of the package you have, it's just that CMake didn't pick them up. They'll generally be the same as the *_RELEASE versions, but with a d or _D at the end. Look for them in your 3rdparty directory. 4. You'll notice the center part of the window will be full of red fields. First thing to change is to set ACTUAL_3RDPARTY_DIR to the directory where you've put the prebuilt dependencies I linked to above. Then you can click Configure again, CMake will try to find as many of the dependencies as it can by itself. this would just be /OpenSceneGraph/bin correct? No, it will be the directory where you unzipped the 3rd party dependencies package... It's the directory where you want CMake to look for 3rd party libraries. Thanks for the reply. I will take a look at the tutorials. I'm not trying to offend why my question on OSG. I'm not really doing anything super intensive. I wrote a C++ application to cluster 3d space trajectories, and I just want to output the generated clusters (from a plain text file). I don't wanna be doing overkill on this, I just want something quick and easy I suppose. Oh, you didn't offend me (or anyone else I bet) with your question, we all want to use the best tool for the job. I think in this respect OSG can scale nicely, letting you complete your simple project now and scaling up to more complex ones later if the need arises. Hope this helps, J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.dyndns-web.com/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Absolute beginner questions
On Tue, Jun 7, 2011 at 11:44 AM, Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com wrote: Hi Basil, I ran that and am now missing CURL_LIBRARY_DEBUG, FREETYPE_LIBRARY_DEBUG, GIFLIB_LIBRARY_DEBUG, GLUT_LIBRARY_DEBUG, JPEG_LIBRARY_DEBUG, TIFF_LIBRARY_DEBUG, and ZLIB_LIBRARY_DEBUG. Do you know where I can get these? A morning filled with googling and trying to build them myself proved fruitless... They should be part of the package you have, it's just that CMake didn't pick them up. They'll generally be the same as the *_RELEASE versions, but with a d or _D at the end. Look for them in your 3rdparty directory. In any case, as long as you can click the generate button, any packages listed as not found are optional. They are likely useful for loading files, building examples, etc. but if you're just plotting points you won't need anything special. -- Ryan Pavlik HCI Graduate Student Virtual Reality Applications Center Iowa State University rpav...@iastate.edu http://academic.cleardefinition.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Absolute beginner questions
If I were to look at one of the examples, which should I look at first? I do not see Visual studio solution/project files in a great deal of the examples in the OpenSceneGraph/examples/ directory though... -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40175#40175 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Absolute beginner questions
Hi Basil, If I were to look at one of the examples, which should I look at first? To learn how to generate geometry and points on screen, a good start would be osggeometry. I do not see Visual studio solution/project files in a great deal of the examples in the OpenSceneGraph/examples/ directory though... That's because they won't be there. As I said, open up the OpenSceneGraph.sln file which is in the directory you specified in where to build the binaries in CMake. All the examples and other projects will be there. The point of using CMake is that it can generate build files (VS project files, makefiles, XCode projects, etc.) for a variety of different build systems, so none of those will ever be in the source tree you download... They're generated by CMake, so they go in the directory you specified in where to build the binaries. Hope this helps, J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.dyndns-web.com/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Absolute beginner questions
Ahh ok, I see it now. When I open in Visual Studio, I am getting scores of compiler errors. Lots of undeclared identifiers. Perhaps its not finding the headers or something? I made sure that under tools-options-Projects and Solutions-VC++ DIrectories that I included OpenSceneGraph\lib, OpenSceneGraph\include, and OpenSceneGraph\bin I also made sure that I included the bin directory in my %PATH% variable and created %OSG_FILE_PATH% (containing d:\OpenSceneGraph\data;d:\OpenSceneGraph\data\Images;d:\OpenSceneGraph\data\fonts) and %OSGHOME% (contaning d:\OpenSceneGraph). -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40177#40177 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] [osgPlugins] Build OSG using DCMTK
Hi, I am a student, and am very interested in osg. This is the first time i am using it. I was trying to create a volume from a set of dicom files, using the osgvolume. I installed the dcmtk, and then configured the cmake for osg 2.8.4 to get those files.. for example : i set the include dir to /usr/local/include and the others to usr/local/include/dcmtk/ I did the make and the make install... and then when I try to use osgvolume to read even a single dicom file, it refuses... this is the error I get, Warning: dynamic library '/usr/local/lib/osgPlugins-2.8.4/osgdb_dicom.so' exists, but an error occurred while trying to open it: /usr/local/lib/osgPlugins-2.8.4/osgdb_dicom.so: undefined symbol: _ZNK9log4cplus6Logger12isEnabledForEi Warning: Could not find plugin to read objects from file /home/bin/1.2.392.200036.9116.2.2.dcm. Segmentation fault I do not understand how to fix this.. Can some one please explain what I am doing wrong? ... Thank you! Cheers, RC -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40169#40169 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Absolute beginner questions
Hi Basil, When I open in Visual Studio, I am getting scores of compiler errors. Lots of undeclared identifiers. Perhaps its not finding the headers or something? I made sure that under tools-options-Projects and Solutions-VC++ DIrectories that I included OpenSceneGraph\lib, OpenSceneGraph\include, and OpenSceneGraph\bin You don't need to do that, the project settings should include all the paths the projects need to compile. And in fact I'd advise against it, since if you ever need to compile multiple versions of OSG you'll need to go change that again... I don't use VC++ Directories at all, I keep all relevant include / lib paths in the project settings / build files. It's much easier to keep them in version control that way. What exactly are you opening in Visual Studio, and what are you trying to build? What are the errors you're getting? Perhaps paste the compile log in a text file and attach it to your reply. I also made sure that I included the bin directory in my %PATH% variable and created %OSG_FILE_PATH% (containing d:\OpenSceneGraph\data;d:\OpenSceneGraph\data\Images;d:\OpenSceneGraph\data\fonts) and %OSGHOME% (contaning d:\OpenSceneGraph). That's fine, though it won't influence compilation, only runtime. Also you generally only need the first path you put in OSG_FILE_PATH. J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.dyndns-web.com/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgPlugins] Build OSG using DCMTK
Hi Isha, Could it be that you are compiling against the latest rev of DCMTK? When I upgraded to use DCMTK 3.6.1 I found I needed to add extra libs to the link line of the DCMTK plugin. I have checked the changes into OSG svn/trunk, and they are also part of the 2.9.15 dev release made last week that fix the build against the latest rev of DCMTK. You could compare the src/osgPlugins/dicom/CMakeLists.txt and CmakeModiules/FindOurDCMTK.cmake from 2.8.4 and the equivilant files in svn/trunk to see what changes I had to make. Alternatively just move to the svn/trunk or 2.9.15 dev release of the OSG. Robert. On Tue, Jun 7, 2011 at 3:49 PM, Isha Kandaswamy isha.kandasw...@gmail.com wrote: Hi, I am a student, and am very interested in osg. This is the first time i am using it. I was trying to create a volume from a set of dicom files, using the osgvolume. I installed the dcmtk, and then configured the cmake for osg 2.8.4 to get those files.. for example : i set the include dir to /usr/local/include and the others to usr/local/include/dcmtk/ I did the make and the make install... and then when I try to use osgvolume to read even a single dicom file, it refuses... this is the error I get, Warning: dynamic library '/usr/local/lib/osgPlugins-2.8.4/osgdb_dicom.so' exists, but an error occurred while trying to open it: /usr/local/lib/osgPlugins-2.8.4/osgdb_dicom.so: undefined symbol: _ZNK9log4cplus6Logger12isEnabledForEi Warning: Could not find plugin to read objects from file /home/bin/1.2.392.200036.9116.2.2.dcm. Segmentation fault I do not understand how to fix this.. Can some one please explain what I am doing wrong? ... Thank you! Cheers, RC -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40169#40169 ___ 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] [osgPlugins] Build OSG using DCMTK
Hi, I checked, and added the links and it worked ,thanks :) .. but still the volume it seems to render is not correct.. It should look like a skull and it looks like random set of lines.. Is there a problem with the way im using the osgvolume?? I use it as osgvolume --images *.dcm to create the volume ... Thank you! Cheers, Isha -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40181#40181 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgPlugins] Build OSG using DCMTK
On 6/7/2011 2:01 PM, Isha Kandaswamy wrote: Hi, I checked, and added the links and it worked ,thanks :) .. but still the volume it seems to render is not correct.. It should look like a skull and it looks like random set of lines.. Is there a problem with the way im using the osgvolume?? I use it as osgvolume --images *.dcm to create the volume I had some obstacles getting osgvolume and DCM to work a few months ago, but eventually got it to compile ok and got some datasets to display without issue. Is it your own data or sample data? I got some samples from that giant online volume repository and converted them to a format osgvolume could read. -- Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com http://www.alphapixel.com/ Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. Contracting. There is no Truth. There is only Perception. To Perceive is to Exist. - Xen ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgPlugins] Build OSG using DCMTK
Hi, Its a professors dataset actually and it loads on the slicer but not using osg volume... Its a set of dcm images... I converted it into a volume.osg using osgvolume -o and then read that using osgviewerGLUT, but it still doesnt look write.. Im not sure where im going wrong... ... Thank you! Cheers, Isha -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40184#40184 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Meta-data in core OSG - project started
Hello Robert, Thank you for taking up this task. While not central to the mission of graphics rendering, this feature will certainly make writing applications around OSG a little bit easier for all of us. My proposal for putting get/setUserValue convenience methods directly osg::Object was based on the idea that the interface methods on osg::UserDataContainer would accept the parent object as a parameter, thus allowing a single container instance to be shared while providing different data to different callers. Without that aspect, having get/setUserValue on osg::Object still offers some convenience but also introduces confusion and redundancy. Also, the ability to set any osg::Object as the metadata container for any other osg::Object seems like an invitation for chaos. I think the pattern you describe as object-getUserDataContainer()-get...() is acceptable, and is perfectly consistent with the existing scene graph patterns in OSG (setting up StateSets in particular comes to mind -- indeed recently someone wanted to use StateSets as an ad-hoc metadata scheme). My preference looks like: class osg::Object { // access _userDataContainer osg::UserDataContainer* getUserDataContainer(); void setUserDataContainer(osg::UserDataContainer*); osg::UserDataContainer* getOrCreateUserDataContainer(); // for backwards compatibility, defer to _userDataContainer virtual get/setDescriptions(); virtual get/setUserData(); }; // abstract base class user data container class osg::UserDataContainer : public osg::Object { // returns self osg::UserDataContainer* getUserDataContainer(); osg::UserDataContainer* getOrCreateUserDataContainer(); // throws exception/assertion or otherwise fails void setUserDataContainer(osg::UserDataContainer*); // return data on this object virtual get/setDescriptions(); virtual get/setUserData(); // Abstract metadata interface virtual get/setUserValue() = 0; }; // Default implementation, used by osg::Object::getOrCreateUserDataContainer() class osg::StdUserDataContainer : public osg::UserDataContainer { virtual get/setUserValue() { ... } }; This seems very straightforward and avoids cluttering up osg::Object. Is there a reason this approach was rejected, aside from a desire to avoid the object-getUserDataContainer()-get...() pattern? If a single user data container instance is referenced by multiple nodes, will it be serialized once or multiple times? Can a user data container contain references to osg::Objects in the same scene graph? Can the serializers handle this? Again, your work is very much appreciated! Thanks, Peter On 6/7/2011 9:51 AM, Robert Osfield wrote: Hi All, After my first cut of the new osg::Object::UserData functionality I've been pondering on how best to provide the ability to customize the data storage container, if at all. Simplicity and performance are the key reasons for not providing the ability to customize the data storage container as it enevitablly requires use of virtual functions for data access, extra classes and public methods for these. -- Peter Amstutz Senior Software Engineer Technology Solutions Experts Natick, MA 02131 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] SwitchNode Animation with a specific time interval
Hi, I have a bunch of timesteps of data that I need to animate between. I set up my code so that each timestep corresponds to a switch node and I attempted to animate between each switchnode. Here is my switch node animation operator code: Code: void SwitchingCallback::operator() (osg::Node* node, osg::NodeVisitor* nv) { static int tstepNum = 0; static int sign = -1; int numtimesteps = 64; osg::Switch* switchNode = static_castosg::Switch*(node); if( !((++_count) % 30) switchNode) { if(tstepNum = numtimesteps-1) { tstepNum = numtimesteps-1; sign = -sign; } else if (tstepNum = 0) { tstepNum = 0; sign = -sign; } tstepNum += sign; switchNode-setSingleChildOn(tstepNum); } traverse(node, nv); } Currently, the speed at which the switch node is animating between timesteps is machine dependent. In other words, the animation speed is dependent on the machine that could count to 30 quick enough. I would ideally like the animation to happen at a specific time interval instead and hoping to avoid the Code: !((++_count) % 30) and be able to specify something like Code: if(timeElapsed 0.02 seconds) then do_something; I looked at osganimationmakepath example and attempted to use the following: Code: static int tstepNum = 0; static int sign = -1; int numtimesteps = 64; static int flagForFirstTime = 0; osg::Switch* switchNode = static_castosg::Switch*(node); _currentTime = osg::Timer::instance()-tick(); if(flagForFirstTime == 0) { _startTime = osg::Timer::instance()-tick(); flagForFirstTime = 1; } float t = osg::Timer::instance()-delta_s(_startTime, _currentTime); if( t 0.02f switchNode) { blah_blah_as_above; tstepNum += sign; switchNode-setSingleChildOn(tstepNum); flagForFirstTime = 0; } traverse(node, nv); This worked, except that the animation was inconsistent. It was slow at times and then it suddenly picked up speed. I am sure I am missing something, but I do not know what. Any suggestions? Thank you! Cheers, Vijay. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40186#40186 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] WWDC 2011
Hi all, If anybody is at WWDC this year, please drop me a line if you'd like to meet up. Thanks, Eric -- Beginning iPhone Games Development http://playcontrol.net/iphonegamebook/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org