Re: [osg-users] Away for a week!
Hi All, I'm back from my family holiday, alas it rained everyday!! Today I'll be steadily working through my backlog of emails and then begin the task of tackling submissions. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] More than 8 lights
Hi Bart, You'll simply need to go through you scene graph and remove the osg::LightSource nodes and an places where GL_LIGHT0... etc. are enabled. Robert. On 26 June 2012 16:24, Bart K bart.knui...@gmail.com wrote: Hi, I am building a deferred rendering system in open scene graph and all work well, except for one part. There can be many more lights than the default of 8 and this causes OSG to post many warnings. gDebugger for instance halts on glEnable(GL_LIGHTX) as the X goes beyond 7. I tried turning of the lights by setting View-setLight(NULL); I also tried removing the entire lightsource from the scene as it is only used for obtainin the properties exported from 3DS max. Still no luck. So, my question is, how can i get rid of the FFP lights? Regards, Bk- -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48533#48533 ___ 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] Android: Problem with static intialization in osgViewer/Scene.cpp (from r13031)
Hi Rafa and James et. al, On 28 June 2012 18:35, James Athey james.at...@gmail.com wrote: It's working on my GLES 2 app as well. That's great to hear. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Problems using shader attributes
Hi Preet, The OSG provides more than just support for passing data to OpenGL, it does culling and this requires knowledge of the bounding volume of the object. I would recommend sticking with using the standard osg::Geometry::setVertexArray(..) for passing in the vertex positions of your data so that the OSG can compute the bounding volumes automatically for you. Robert. On 30 June 2012 08:02, Preet prismatic.proj...@gmail.com wrote: Hiya. I'm trying to pass attributes to my vertex shader, but have come across several issues.These issues only occur when I use OSG -- if I try to do the same thing with straight OpenGL calls, it works fine. I've set setUseModelViewAndProjectionUniforms(true) and setUseVertexAttributeAliasing(false). I add vertex attributes to my geometry by calling setVertexAttribArray. I don't explicitly specify any other arrays (I don't call setVertexArray or anything like that). * Assigning a position attribute to '0' works as expected and my geometry shows up. Moving that position attribute to another slot doesn't work. I explicitly call setCullingActive(false) on my geometry and set zNear zFar on my camera but when I try to render the scene I get what I think are scene culling related issues: cull_draw() 0x15cd420 _clampProjectionMatrix not applied, invalid depth range, znear = 3.40282e+38 zfar = -3.40282e+38 end cull_draw() 0x15cd420 * I also tried playing around with a normal attribute. I just take the normal and pass it as a varying to the fragment shader where it directly sets the fragment color to the value of the normal. I get a sane result when I set the normal attribute to slot 1,2 or 6 or 7. If I set the normal attribute slot to anything else I get random gray shapes obscuring the viewport: normal attribute set to slot 1: http://i.imgur.com/C5MQ7.png normal attribute set to slot 4: http://i.imgur.com/5tGoS.png same scene in app that uses straight opengl calls: http://i.imgur.com/C5MQ7.png (note that the normal values are different as well, I don't know why this is as I pass in the same values to both) So, does anyone know what's going on? Why can I arbitrarily set attributes to whatever slots I want in my 'raw' OpenGL program, but not with OpenSceneGraph? I'm using OpenSceneGraph 3.0.1 with an Nvidia card that supports OpenGL 4.2 on Linux. Preet ___ 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] [vpb] build VPB on VS 10
Hi Joseph, On 3 July 2012 06:52, Nav Joseph nk...@tatapowersed.com wrote: @Robert: I'm having the same problem with Virtual Planet Builder. I'm using gdal 1.7 already, and virtual planet builder version 0.9.7. OSG version 3.1.1. Which version of osg should I use? I've just tested VPB and OSG svn/trunk against GDAL 1.7 and it builds fine. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Segmentation fault -- resizeGLObjectBuffers
Hi Martin, There really isn't enough information about what you are doing to know what might be amiss, it's just far too open ended. The best thing you can do is use a debugger to track down what might be going on in your application. Robert. On 4 July 2012 08:10, Martin Großer grosser.mar...@gmx.de wrote: Hello, I want to render a Group in a pre render step and my camera is a child of this group. So I created a loop (maybe it is a little bit dirty). Group -- Camera (pre-render) -- ^| || When I want to run my application, I got this error: [Thread debugging using libthread_db enabled] Using host libthread_db library /lib64/libthread_db.so.1. Program received signal SIGSEGV, Segmentation fault. 0x0030215bcdd3 in osg::Node::resizeGLObjectBuffers(unsigned int) () from /usr/lib64/libosg.so.80 Is the loop the problem? Was that to be expected? Or is this maybe a untested situation? Thanks Martin ___ 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] [vpb] osgdem crashes because of large memory usage
Hi Sevket, For large paged database you'll need to use vpbmaster to create a set of tasks that sub-divide down the database generation so that each individual run of osgdem task will be small enough to avoid memory issues. vpbmaster will allow you to use multiple CPU's on one machine and a cluster of machines. Robert. On 3 July 2012 19:39, Sevket Caba sevketc...@gmail.com wrote: Hi, I've a problem with osgdem.exe, which was built with OSG 3.0.0 with visual studio 2008 32 bit. here are the arguments i use : osgdem --TERRAIN --geocentric -e -180 -90 360 180 -o layout.osgb -t c:\maps c:\maps folder includes app. 13.000 .tif files and every single .tif file is 2048x1024 px RGB GeoTIFF. first when i tried to use osgdem.exe, it crashed before even creating the layout_root_l0_x0_y0 folder, then i realized that it uses more than 2.00 GB of ram and crashes. So i made a trick and used editbin tool and changed the header of the osgdem.exe file with /LARGEADDRESSAWARE flag. Glad that now my osgdem.exe file can use up to 4.00 GB of RAM, but, unfortunately that's not enough as well, so it crashes again, but this time it could create some of layout_L13_Xx_Yx_subtile.osgb files. So, what do you suggest? Is it OK that osgdem.exe should use that much RAM? Do i have to build it in x64 platform to let it exploit all 8.00 GB of my RAM? Thank you! Cheers, sevketcaba -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48661#48661 ___ 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] RenderBin implementation not found
HI Matthias, If the fix works just post it to osg-submissions as a complete file and I can review it. Thanks, Robert. On 4 July 2012 09:55, Matthias Schütze matthi.schue...@googlemail.com wrote: Hi there, A customer is having trouble running our OSG-based application on his computer. I sent him osgviewer.exe and when he runs osgviewer.exe cow.osg it works, but this message is printed on the console: Warning: RenderBin RenderBin implementation not found, using default RenderBin as a fallback. It's just a warning and he does see the cow, but I'm wondering if this message is a symptom of some other problem? FWIW, his workstation-class laptop has a FirePro m8900 video card with up to date drivers. Some month ago, this post appeared on the forum and was not yet finally solved. I found that forum thread because I experienced very similar problems: - sporadical Warning: RenderBin RenderBin implementation not found, using default RenderBin as a fallback - even more sporadical Warning: RenderBin DepthSortedBin implementation not found, using default RenderBin as a fallback - the problem occurs, when setting up some scene data for several views on program start - most likely, the problem occurs only with multi-threaded threading models (furthermore, I could observe concurrent initialization of static RenderBinPrototypeList while debugging) Roberts suggestion was: This suggests a race condition on the static initialization inside the static RenderBinPrototypeList* renderBinPrototypeList() method. On technique we could employ is to use a local static initializer object that forces the static initialization: struct ForceRenderBinProtypeListInitializer { ForceRenderBinProtypeListInitializer() { OSG_NOTICEForcing initializationstd::endl; renderBinPrototypeList(); } }; static ForceRenderBinProtypeListInitializer s_ForceRenderBinProtypeListInitializer; This is a bit hacky, but it might work. The alternative would be to add a static mutex and use this with the renderBinPrototypeList() but this would have it's usage slower just because of initialization which isn't a good solution. I've attached a modified version of RenderBin.cpp from svn/trunk, could you try this out on your system to see if cures the warning? After recompiling my OSG 3.0.1 with this change, I tried it out on a couple of Win 7 x64 machines where the problem occurred from time to time. Well, the warnings did not show up in about 500 runs per system. As I stated in the web repository of svn trunk, this change was not committed yet. Maybe, one could submit it, now? Cheers, Matthias Schütze, Germany ___ 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] Using osgText with GraphicsWindowEmbedded and Qt causes problems
HI Preet, You'll need to rest OpenGL into consistent state when moving between Qt and the OSG. I don't know anything about QGLFrameBufferObject so can't comment on what state it'll be managing. What I can say is that the OSG has it's own native FBO support that will work just fine all by itself and normally there wouldn't be any need to get QT involved. Personally I'd try to keep Qt out for doing too much OpenGL work itself. Robert. On 5 July 2012 01:30, Preet prismatic.proj...@gmail.com wrote: Hi. I have a scene consisting of just an osgText object and its shaders. The scene works fine in a default application where OpenSceneGraph is the only library being used, but won't render correctly when I try to draw to a QGLFrameBufferObject. Drawing to the FBO works fine if I don't use osgText (other than text, I've just tried simple models so far). Using osgText 'messes' the Qt UI up, by changing the order of what (Qt items) are painted or changing their size or stretching them... nothing from OSG seems to be painted at all. I'm guessing there's a conflict with OpenGL calls between Qt and OSG. OSG is set up using GraphicsWindowEmbedded, and in Qt, I bind my framebuffer before calling osgViewer's frame(), and release it after. I'm lost as to why using osgText of all things would cause this issue. Just the inclusion of osgText in my scene tree causes the problem. Does anyone have any suggestions as to how I can force Qt and OSG to play nice? Preet ___ 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] Can we please remove static initializations in OSG?
HI Michael, There a range of reasons why the OSG uses static for different places, it won't be possible to remove these without breaking lots of functionality, OSG API's and end user application usage. So it's far from trival task with a dubious end value ended. Robert. On 5 July 2012 13:20, michael kapelko korn...@gmail.com wrote: 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-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] Multi LOD in Multi Camera
Hi Tolga, The OSG selects LOD children dynamically within the cull traversal, each independent traversal with have an independent result. This means one shouldn't expect problems with viewing the same scene graph from different camera views. Is there a chance that more is going on? Are they just LOD nodes? Could they be PagedLOD's? Robert. On 6 July 2012 09:18, Tolga Yilmaz osgfo...@tevs.eu wrote: Hi, I have a earth view loaded with map in my main scenegraph and have four widgets(windows) with each has their own camera. I mean this four window share one scenegraph. The problem is when i open this four widgets or three or two with different view distances (one is setted over zoom in one is setted over zoom out or zooming until to enable application loading different LODs) all views' maps are deteriorating and shaking just like changing between different LODs. (Is there a bug about in OSG?) Is there a way to overcome this issue without creating each views scenegraph seperately? (because of the memory status) ... Thank you! Cheers, Tolga -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48724#48724 ___ 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] StateSet UpdateCallback on a camera
Hi Christian, I have just checked the Viewer::updateTraversal() and associated UpdateVisitor::handle_callbacks() code and it looks to me like a StateSet with callbacks attached to a Viewer camera should have it's callbacks called. I haven't tested the code though, too many other tasks to get through I'm afraid. Perhaps the issue is related to using an older version of the OSG than the svn/trunk I've just looked at. Robert. On 6 July 2012 14:30, Christian Schulte christian.schu...@onera.fr wrote: Thanks Tim for your response, I will try your solution with an empty UpdateCallBack for the camera. Concerning multiples views in my application, I didn't post my whole code, but we are in a class derived from osgViewer::CompositeViewer. I understand that Fog and Light are not SceneGraphNodes, but in my case I associated my osg::Light to an osg::LightSource whihc is a node, and it is this lightSource that I tried to cull, in order to have a view without any light. Thanks, Christian Le 06/07/2012 11:46, Tim Moore a écrit : Salut, On Fri, Jul 6, 2012 at 10:13 AM, Christian Schulte christian.schu...@onera.fr wrote: Hi everyone, I'm facing a problem in our flight simulation environment, where we want to make the fog camera dependent ( in order to have cameras without fog for simulation control). I tried to follow the 2009 thread [osg-users] Set fog in the canera StateSet and succeded to implement a non variyng fog. But in our case we have a statesetcallback for changing the parameter of the fog and one for activating disactivating the fog. ... But, adding the fog to our different views, neither the vesaFogUpdateCallback nor the vesaFogEnableUpdateCallback are accessed anymore... This is the code I tryed to implement : BOOST_FOREACH(propTreeNode v, arbreUtile-getOptionalChildProperties(graphic.windows.views)) { propTreeHolder pView(v.second); if(pView.empty() || v.first.compare(msgFile)==0 || v.first.compare(activeView)==0) continue; std::string name = v.first; osgViewer::View* view = new osgViewer::View; I don't know if this is pseudo-code or not, but generally you don't create more than one Viewer per application; instead you use CompositeViewer or slave cameras in one Viewer. However, if this is working for you, who am I to say different :) view-setName(name); addView(view); view-setSceneData(root); view-getCamera()-setName(name); view-getCamera()-setClearColor(fog-getColor()); ... view-getCamera()-getOrCreateStateSet()-setAttributeAndModes(fog, osg::StateAttribute::ON); fog-setUpdateCallback(new vesaFogUpdateCallback); view-getCamera()-getOrCreateStateSet()-setUpdateCallback(new vesaFogEnableUpdateCallback); } } The solution I found is to create an UpdateCallback for each camera which implements the code present in both my old Fog callbacks. Does anyone have an idea of why the UpdateCallBack of the stateset does not work when associated to a camera ? What am I doing wrong ? Viewer only runs an UpdateVisitor on a camera if it has an update callback. This may be a small bug, as you have discovered, as it ignores the possibility that the camera's state set could have update callbacks. I believe you will find that your state set update callback will get run even if you install an empty callback on the camera node. Tim Moreover, I initially tried to activate desactivate the osf::Fog, the osg::Light and the osgParticle::PrecipitationEffect using a NodeMask/CullMask logic for each camera. It works for the PrecipitationEffect, but doesn't for the Fog and the Light. Is it a normal behaviour or is there something wrong in my code (in which case I would show you the code). I'm not sure what you mean, as Fog and Light aren't scene graph nodes. Be sure that any StateAttribute objects have their data variance set to DYNAMIC. Tim Thankyou for your help, SCHULTE Christian Research Engineer in charge of the Simulation Laboratory System Control and Flight Dynamics Department Simulation and Flight Testing Unit ONERA - The French Aerospace Lab Ecole de l'Air - BA 701 13661 SALON cedex AIR FRANCE ___ 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] Alternate display of text and Image
HI Maia, A osg::Switch node would be appropriate for toggling between subgraphs, while an update callback would be appropriate for the time based changes in state, and an event callback would be appropriate for handling the events. Robert. On 6 July 2012 20:40, Maia Randria veneree.randrianari...@crulrg.ulaval.ca wrote: Hi, I'd like to have some advice on the best way to do the following algorithm with OSG. I have two lists of objects (a first list of images and a second list of texts). My algorithm is: - display an image from the first list for a fixed time duration (suppose t seconds) - once t seconds is elapsed, display the first text of the second list and wait until the user clicks on the screen with a mouse - once the mouse event is detected, show a second image for a fixed t seconds. - after t seconds, display the second text of the second list and wait again until the user clicks on the screen with a mouse etc... I have looked at osg::Animation and osg::Sequence but I am not sure they are the way to go (in addition to GuiEventHandler). Sorry if this is obvious but I am a beginner in OSG. Best regards, Thank you! Cheers, Maia -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48736#48736 ___ 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] behavior of osg Tesselator with alpha transparency
Hi Christian, I have rather too many support emails to get through to look at compiling and testing end user applications so I'll have to defer to others to look at your app. One thing I can add right away is that the osgUtil::Tessellator will be just using vertex and primitive data when doing the tessellation, it won't doing anything with other per vertex data like colours other than copying them to the final geometry. Perhaps there is some issue here. Robert. On 6 July 2012 11:15, Christian Buchner christian.buch...@gmail.com wrote: Hi, I was trying to generate a textured halo around a flat (2D) geometric shape that is supposed to fade with distance without using any GLSL. The shape is a convex polygon. My approach is to create a polygon with a hole, where the vertices on the outer ring has alpha transparency 0 and those on the inner ring have alpha transparency 1. The hole is exactly centered and has half the size of the outer shape. The polygon is run through the osg tesselator and then displayed, but the result is unexpected and seems to hint at some weird behavior of the tesselator when alpha values are present. I am attaching a self contained example, maybe someone can point out whether I am doing something wrong, or whether the osg tesselator cannot really handle per-vertex colors. Is anyone aware of an approach that will produce the result I expect? Christian ___ 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] behavior of osg Tesselator with alpha transparency
Thank you for your input. I now understand that the tesselation does not take into account any vertex attributes, so I cannot really rely on the tesselator to produce a visually pleasing result when these vertex attributes differ from vertex to vertex. I worked around it by manually specifying the geometry I need. I now run a quad strip between the inner and outer polygon ring - even though that is less generic and cannot handle all shapes correctly. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Mac OS runtime problem
Hi, This problem is still present. It seems that under MacOS OpenSceneGraph can only be built with the llvm compilers due to the Objective C portions of code. I tried configuring gcc to compile Objective C but there appear to be some differences between the Apple compiler and gcc with respect to Objective C. What I would like to do is be able to compile my application using gcc and then link to OpenSceneGraph - I don't really care whether OpenSceneGraph is built with gcc or llvm. However, if I do build my application using gcc then it crashes. The code segment can be boiled down to the following: Code: int main( int argc, char **argv ) { fprintf(stderr, Creating\n); osg::ref_ptrosg::DrawElementsUShort p = new osg::DrawElementsUShort(); fprintf(stderr, Created\n); } Compiled as follows: Code: /opt/local/bin/gcc-mp-4.8 -o osgtest osgtest.cpp -L /usr/local/lib -losg -lOpenThreads -lstdc++ -I /usr/local/include/ And the crash is as follows: Code: Tobiass-retina-MacBook:trunk tobiasduckworth$ ./osgtest Creating Created osgtest(52671) malloc: *** error for object 0x10c7b87e0: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug Abort trap: 6 Tobiass-retina-MacBook:trunk tobiasduckworth$ This problem has been present for an age, and is forcing me to use the Apple compilers to build my application, whereas I wish to use gcc. Has anyone else out there experienced this problem? or have a solution to it please? I would really like to be able to build my application with gcc, but due to this problem cannot. ... Thank you! Cheers, Tobias[/code] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48768#48768 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Alternate display of text and Image
Hi Robert, Thank you very much for replying. I will do some tests and post here if any questions. Maia robertosfield wrote: HI Maia, A osg::Switch node would be appropriate for toggling between subgraphs, while an update callback would be appropriate for the time based changes in state, and an event callback would be appropriate for handling the events. Robert. On 6 July 2012 20:40, Maia Randria wrote: Hi, I'd like to have some advice on the best way to do the following algorithm with OSG. I have two lists of objects (a first list of images and a second list of texts). My algorithm is: - display an image from the first list for a fixed time duration (suppose t seconds) - once t seconds is elapsed, display the first text of the second list and wait until the user clicks on the screen with a mouse - once the mouse event is detected, show a second image for a fixed t seconds. - after t seconds, display the second text of the second list and wait again until the user clicks on the screen with a mouse etc... I have looked at osg::Animation and osg::Sequence but I am not sure they are the way to go (in addition to GuiEventHandler). Sorry if this is obvious but I am a beginner in OSG. Best regards, Thank you! Cheers, Maia -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48736#48736 ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list 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=48769#48769 ___ 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
HI Matthias, OpenThreads doesn't expose thread local storage but does use it internally to provide the Thread::CurrentThread() functionality. Might it be possible to use this in your implementation? Robert. On 5 July 2012 10:32, Matthias Schütze matthi.schue...@googlemail.com wrote: 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 ___ 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] [SOLVED] How to force reloading the texture in the shader
Hi, I've code something like the snippet you have posted...but i'me able to see just first frame...could you help me to solve this problem? Thank you! Cheers, Antonio -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48771#48771 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] [vpb] osgdem layers question
From the documentation, the --layer flag allows me to Specify the layer that the next source Texture will contribute to. 1. Does this indexing start at 0 or 1? 2. Can I access these layered textures in a GLSL vertex shader using Code: gl_TexCoord[n] = gl_MultiTexCoordn; and access that layer texture's color in the frag shader using Code: vec4 color = texture2D(baseTexture, gl_TexCoord[n].st); where n is the layer number?[/code] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48772#48772 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] camera manipulator proposal
Hi Riccardo, Sorry for the very long delay in getting to review your suggested changes, I've now done the review and the changes look good, the only amendment I made to rename the parameter name Camera* pCamera to Camera* camera as from the context it's obvious that camera is a Camera* one doesn't need to add extra short hand in the name to make this clear, rather the extra p just makes the code less human readable. Changes now merged and submitted to svn/trunk. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] camera manipulator proposal
Hi Riccardo, On review of the submission I've decided that passing in a Camera rather than a pointer would make it clear that a valid Camera object should be passed in rather than a pointer which could be NULL or pointing to a valid Camera object. This brings the method more into line with how this type of method is invoked elsewhere in the OSG. Cheers, Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgPlugins] [SOLVED] osgPlugins DAE (collada) ReaderWriterDAE.cpp, daeReader.h VS2010 compile errors
I used Collada dom 2.4. But in OSG WiKi: As of December 2011, testing indicates that the plugin still does not work with the COLLADA DOM version 2.3.x, but does work with the 2.2. With COLLADA DOM version 2.2. it works fine. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48636#48636 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [forum] All Forum Users, PLEASE READ IT!
Hi everyone, specifically forum managers! I am new in forum once I have been doing my baby steps with OSG. I have been trying to solve a problem I am facing within an application I'm developing but since I couldn't find any solution I though it might be a good opportunity to start my activity here, in forum. I have read the conditions of approval as a recognized member, concerning about real names, and I think I am fulfilling all the requirements though I'm still not seeing my posts and topics approved. I would really know what I am doing wrong so I can be able to have some activity in forum. Grateful for any clarification! Cheers, Jorge d'Alpuim -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48751#48751 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Using osgText with GraphicsWindowEmbedded and Qt causes problems
Hi Robert, On Mon, Jul 9, 2012 at 9:01 AM, Robert Osfield robert.osfi...@gmail.com wrote: HI Preet, You'll need to rest OpenGL into consistent state when moving between Qt and the OSG. I don't know anything about QGLFrameBufferObject so can't comment on what state it'll be managing. This was indeed the case. For anyone else that runs into issues integrating the two libs, I've found some OpenGL states that should be reset after drawing an OSG frame, before control is given back to Qt. More state settings might need to be changed depending on what exactly OpenSceneGraph is being used for, but the following seems to work with some basic textured geometry. // qpainter uses vertex attribs 3,4,5 so we need to explicitly disable them: glDisableVertexAttribArray(3); glDisableVertexAttribArray(4); glDisableVertexAttribArray(5); // qpainter requires depth testing to be off glDisable(GL_DEPTH_TEST) // not sure if this is required; osg changes this when using textures so I reset it to default glPixelStorei(GL_UNPACK_ALIGNMENT,4); What I can say is that the OSG has it's own native FBO support that will work just fine all by itself and normally there wouldn't be any need to get QT involved. Personally I'd try to keep Qt out for doing too much OpenGL work itself. Robert. On 5 July 2012 01:30, Preet prismatic.proj...@gmail.com wrote: ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to create osg::Texture2D from osg::Vec3Array...?
Hi Ulrich Hroach, I tried with your sample code and it is solution for my question. @ Hroach - Only thing to be added in your code is, after memcpy(), dataptr needs to be assigned to image-setImage(). Code: image1-setImage( 2,2, 1, GL_RGBA8, GL_RGBA, GL_FLOAT, (unsigned char *)dataptr, osg::Image::AllocationMode::NO_DELETE ); ... Thank you! Cheers, Kedar -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48727#48727 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Bug in revision 13092
Hi, I think that I have found a bug in revision 13092. I'm using osg as part of qt application, so i create an osgViewer::GraphicsWindowEmbedded like this: Code: _gw = new osgViewer::GraphicsWindowEmbedded(x,y,width,height); then later, i forward qt events to osg. Especially i forward the resize event and mouse move events like this: Code: void QGraphicsEventAdapter::resizeEvent( QResizeEvent* event ){ _gw-getEventQueue()-windowResize(0, 0, event-size().width(), event-size().height()); _gw-resized(0, 0, event-size().width(), event-size().height()); } void QGraphicsEventAdapter::mouseMoveEvent( QGraphicsSceneMouseEvent* event ){ QGraphicsScene::mouseMoveEvent(event); if( event-isAccepted() ) return; QPoint widgetPos(0,0); widgetPos = parentView-mapToGlobal(widgetPos); _gw-getEventQueue()-mouseMotion(event-screenPos().x()-widgetPos.x(), event-screenPos().y()-widgetPos.y()); } And now, i have an osg camera maniupulator derived from osgGA::StandardManipulator, with a method Code: virtual bool performMovementLeftMouseButton( const double eventTimeDelta, const double dx, const double dy ); my manipulator expects, that the dx and dy values are normalized. It used to work this way before revision 13092, but after this revision the values are not normalized anymore. I think it has something to do with the change made to the Viewer.cpp file, however it is to complicated for me to dig into osg event handling. ... Thank you! Cheers, Łukasz -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48733#48733 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Store rgb data into rgba image
Hi everyone, I am trying to dynamically convert several images from rgb to rgba however it has been very difficult to achieve my goal. I have a few rgb images with black background though what I want is to convert the black background into transparency. So far I haven't found any method that performs this automatically so I tried to create a blank image adding an alpha channel. To each pixel I stored the original image RGB data and set the value 255 to alpha channel, in order to have as output the original image but with an alpha channel. The code bellow was developed to have as output an image similar to the original but with alpha channel: Code: osg::Image * image_rgb = osgDB::readImageFile(texture_file); osg::Image * image_rgba = new osg::Image; int height = image_rgb-s(); int width = image_rgb-t(); int length = image_rgb-r(); const long size = width * height * length * 4; unsigned char* rgb_data = image_rgb-data(); unsigned char* rgba_data = (unsigned char*)calloc(size,sizeof(unsigned char)); for(long i = 0; i size; i+= 4) { rgba_data[i + 0] = rgb_data[i + 0]; //red rgba_data[i + 1] = rgb_data[i + 1]; //green rgba_data[i + 2] = rgb_data[i + 2]; //blue rgba_data[i + 3] = 255; //alpha } image_rgba-setImage(width, height, length, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, rgba_data, osg::Image::AllocationMode::NO_DELETE); The left image represent the original RGB image, the center image represents the output form the code above and the right image is the expected result. [Image: http://imageshack.us/photo/my-images/201/osgforum.png ] Any suggestion or correction about the code I developed will be well received! Thank you! Cheers, Jorge d'Alpuim -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48744#48744 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] The problem of loading a model in osg
It seems you are not linking with the correct dll. Please verify it to evade this issue. Good luck, Jorge d'Alpuim -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48743#48743 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Memory growth around cull/draw traversal
Hi, I encountered the problem of heavy memory growth when inserting and removing multiple MatrixTransforms with a common child. I am not very familiar with the cull / draw traversal, but i guess it is related to that. Some properties of the problem: - the application is a dynamic driving simulator - nodes are inserted in front of the camera and removed behind it after some time - the used object renders a tree (generated by a software I forgot the name of). It consists of a Geode for the trunk and one for the leafs. If I remove the leaf Geode, no memory is accumulated. If I remove the trunk Geode, the amount of accumulated memory remains unchanged. - the per-object accumulated memory corresponds to the memory needed for the leaf Geode (vertex + normal + texture coord. data) - if the object is inserted into the scene behind the camera, no memory is accumulated - I checked the destructors of the (inherited) MatrixTransforms, the nodes are removed from the scene I am on the problem since long, so any help would be deeply appreciated. Thank you! Cheers, Sebastian -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48747#48747 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [forum] How to implement ViewAll
Hi, Did you tried to call home() method of your camera manipulator? I though it fills your needs. Thank you! Cheers, Manuel -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48775#48775 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to acquire the current location information of a drawable object? And how to calculate the distance between an object and the viewpoint?
Thanks so much but the first problem still seems quite complicated Anyway I'll try the cull callback first. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48765#48765 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] [forum] malloc_error_break on Mac OS X Lion
Hi, I have a macbook pro and an iMac with Xcode 4.3.3. If i built OSG in the mbp using cmake i doesn't have any problems and all the examples and my own programs run correctly. But in the iMac, after repeating the same steps, every time a node if deleted in the same program, the program halts with a memory error indicating that the pointer has been freed. I had check every line of code. The graph is as simple as: Code: - (void) regenerateSceneAndRedraw { scene-removeChildren(0, escena-getNumChildren()); assert(scene-getNumChildren() == 0); { osg::ref_ptrosg::Geode geode; osg::ref_ptrosg::ShapeDrawable shape; shape = new osg::ShapeDrawable(); shape-setShape(new osg::Box(osg::Vec3(-3, 0., 0.), 2., 2., 1.)); shape-setColor(osg::Vec4(0., 0., 1., 1.)); geode = new osg::Geode; geode-addChild(shape.get()); } [self setNeedsDisplay: YES]; } I have my own Cocoa wrapper class based on ViewerCocoa.m which holds and osg::ref_ptrosg::Group pointer to the root node of the scene. Code: @interface xViewerOSG : ViewerCocoa { @private osg::ref_ptrosg::Group scene_root; idxViewerProtocol drawingDataDelegate; } The first time it works perfectly, the second one it crashes. Here is the callstack: frame #0: 0x7fff90cf96bc libsystem_c.dylib`malloc_error_break frame #1: 0x7fff90cf9805 libsystem_c.dylib`free + 318 frame #2: 0x7fff959ca702 libstdc++.6.dylib`std::string::_Rep::_M_dispose(std::allocatorchar const) + 60 frame #3: 0x7fff959ca740 libstdc++.6.dylib`std::basic_stringchar, std::char_traitschar, std::allocatorchar ::~basic_string() + 44 frame #4: 0x00010abec054 libosg.80.dylib`osg::Object::~Object() + 116 frame #5: 0x00010aa897e9 libosg.80.dylib`osg::BufferData::~BufferData() + 89 frame #6: 0x00010a72db75 libgeomcomp.dylib`osg::Array::~Array() + 21 at Array:125 frame #7: 0x00010a72e17d libgeomcomp.dylib`osg::TemplateArrayosg::Vec4f, (osg::Array::Type)11, 4, 5126::~TemplateArray() + 45 at Array:195 frame #8: 0x00010a72db95 libgeomcomp.dylib`osg::TemplateArrayosg::Vec4f, (osg::Array::Type)11, 4, 5126::~TemplateArray() + 21 at Array:195 frame #9: 0x00010a72dbb8 libgeomcomp.dylib`osg::TemplateArrayosg::Vec4f, (osg::Array::Type)11, 4, 5126::~TemplateArray() + 24 at Array:195 frame #10: 0x00010ac2a2ea libosg.80.dylib`osg::Referenced::signalObserversAndDelete(bool, bool) const + 298 frame #11: 0x00010aa4d4a4 libosg.80.dylib`osg::Referenced::unref() const + 84 frame #12: 0x00010ab2e980 libosg.80.dylib`osg::ref_ptrosg::Array::~ref_ptr() + 48 frame #13: 0x00010ab1dbc5 libosg.80.dylib`osg::ref_ptrosg::Array::~ref_ptr() + 21 frame #14: 0x00010ab5bb5a libosg.80.dylib`osg::Geometry::ArrayData::~ArrayData() + 42 frame #15: 0x00010ab1db05 libosg.80.dylib`osg::Geometry::ArrayData::~ArrayData() + 21 frame #16: 0x00010ab11c94 libosg.80.dylib`osg::Geometry::~Geometry() + 164 frame #17: 0x00010ab11be5 libosg.80.dylib`osg::Geometry::~Geometry() + 21 frame #18: 0x00010ab11b88 libosg.80.dylib`osg::Geometry::~Geometry() + 24 frame #19: 0x00010ac2a2ea libosg.80.dylib`osg::Referenced::signalObserversAndDelete(bool, bool) const + 298 frame #20: 0x00010aa4d4a4 libosg.80.dylib`osg::Referenced::unref() const + 84 frame #21: 0x00010ab0f5dd libosg.80.dylib`osg::ref_ptrosg::Drawable::operator=(osg::Drawable*) + 125 frame #22: 0x00010b60e3a7 libosgUtil.80.dylib`osgUtil::RenderLeaf::reset() + 55 frame #23: 0x00010b6097e4 libosgUtil.80.dylib`osgUtil::CullVisitor::reset() + 436 frame #24: 0x00010b7abe70 libosgUtil.80.dylib`osgUtil::SceneView::cullStage(osg::Matrixd const, osg::Matrixd const, osgUtil::CullVisitor*, osgUtil::StateGraph*, osgUtil::RenderStage*, osg::Viewport*) + 2096 frame #25: 0x00010b7ab545 libosgUtil.80.dylib`osgUtil::SceneView::cull() + 5557 frame #26: 0x00010ca8de0a libosgViewer.80.dylib`osgViewer::Renderer::cull_draw() + 1194 frame #27: 0x00010ca8eb4f libosgViewer.80.dylib`osgViewer::Renderer::operator()(osg::GraphicsContext*) + 47 frame #28: 0x00010ab7e025 libosg.80.dylib`osg::GraphicsContext::runOperations() + 549 frame #29: 0x00010cb031c0 libosgViewer.80.dylib`osgViewer::ViewerBase::renderingTraversals() + 9408 frame #30: 0x00010cb00cf2 libosgViewer.80.dylib`osgViewer::ViewerBase::frame(double) + 178 frame #31: 0x00010a7d7a73 xViewer`-[ViewerCocoa drawRect:] + 163 at ViewerCocoa.mm:902 frame #32: 0x7fff8c40d97a AppKit`-[NSView _drawRect:clip:] + 3758 frame #33: 0x7fff8c43ab4f AppKit`-[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1583 frame #34: 0x7fff8c40af55 AppKit`-[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 1032 frame
Re: [osg-users] Bug in revision 13092
Did you call realize() on your viewer? ie... myViewer-realize(); On Fri, Jul 6, 2012 at 7:40 AM, Łukasz Lucek lukasz.lu...@gmail.com wrote: Hi, I think that I have found a bug in revision 13092. I'm using osg as part of qt application, so i create an osgViewer::GraphicsWindowEmbedded like this: Code: _gw = new osgViewer::GraphicsWindowEmbedded(x,y,width,height); then later, i forward qt events to osg. Especially i forward the resize event and mouse move events like this: Code: void QGraphicsEventAdapter::resizeEvent( QResizeEvent* event ){ _gw-getEventQueue()-windowResize(0, 0, event-size().width(), event-size().height()); _gw-resized(0, 0, event-size().width(), event-size().height()); } void QGraphicsEventAdapter::mouseMoveEvent( QGraphicsSceneMouseEvent* event ){ QGraphicsScene::mouseMoveEvent(event); if( event-isAccepted() ) return; QPoint widgetPos(0,0); widgetPos = parentView-mapToGlobal(widgetPos); _gw-getEventQueue()-mouseMotion(event-screenPos().x()-widgetPos.x(), event-screenPos().y()-widgetPos.y()); } And now, i have an osg camera maniupulator derived from osgGA::StandardManipulator, with a method Code: virtual bool performMovementLeftMouseButton( const double eventTimeDelta, const double dx, const double dy ); my manipulator expects, that the dx and dy values are normalized. It used to work this way before revision 13092, but after this revision the values are not normalized anymore. I think it has something to do with the change made to the Viewer.cpp file, however it is to complicated for me to dig into osg event handling. ... Thank you! Cheers, Łukasz -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48733#48733 ___ 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] constant size overlay
It turns out that using point sprites is not an option for me as I now have a requirement that the objects must rotate with the world. I could use AutoTransform with setAutoScaleToScreen(true) and setAutoRotateMode(NO_ROTATION), but it's still not quite fast enough for my application. I am holding at around 19 fps, but I'd like to get it to at least 25 fps. My scene graph contains several thousand MatrixTransforms arranged like this: Root | ... MT ( x 2000) / \ MT MT / \ / \ MT MT MT MT \ | | / AutoTransform | Geode At my default zoom level, only about 32 objects are visible at a time. Is there anything else I try to improve performance while maintaining the constant screen size and rotate-with-world properties? ... Thank you! Cheers, Michael -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48779#48779 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Store rgb data into rgba image
On 8/07/12 3:16 , Jorge D'Alpuim wrote: int height = image_rgb-s(); int width = image_rgb-t(); int length = image_rgb-r(); const long size = width * height * length * 4; unsigned char* rgb_data = image_rgb-data(); unsigned char* rgba_data = (unsigned char*)calloc(size,sizeof(unsigned char)); for(long i = 0; i size; i+= 4) { rgba_data[i + 0] = rgb_data[i + 0]; //red rgba_data[i + 1] = rgb_data[i + 1]; //green rgba_data[i + 2] = rgb_data[i + 2]; //blue rgba_data[i + 3] = 255; //alpha } For one, you're skipping over every 4th byte of input data (rgb_data). Try something like: const int numPixels = width * height * length; for (int i = 0; i numPixels; ++i) { rgba_data[i * 4 + 0] = rgb_data[i * 3 + 0]; rgba_data[i * 4 + 1] = rgb_data[i * 3 + 1]; rgba_data[i * 4 + 2] = rgb_data[i * 3 + 2]; rgba_data[i * 4 + 3] = 0xff; } Cheers, /ulrich ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] River
Hi: Everyone, i have a question about osgRiver.The example osgOcean and osgRiver provide an example for simulate ocean and river,but i only want to simulate river,and change the terrain of my own.How to do i should?or what steps shall i do? ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org