Re: [osg-users] Deploy OSG application
Hi Stephan thanks a lot for the feedback, we will try this. If we get some problems, I will get back to this post. Regards Dominic Stephan Maximilian Huber schrieb: Dominic Stalder schrieb: we are trying to deploy an OSG application on Mac OS X to another system, where OSG is not installed. What is the best way to distribute the application, should we use static OSG linking (makes the file huge) or are there other / better ways? I haven't tried static builds on OS X, so I can't comment on them. If you are using the deprecated xcode-projects to build osg as frameworks you can embed them into your application bundle and distribute it. This gives you a double-clickable app qhich you can copy wherever you want, no installation-step necessary. You just add a new copy-phase into your xcode-project of your app, set it's target to Frameworks and add all osg-related frameworks to it. (and the plugins goes into a subfolder plugins of the bundle) You can use a similar technique with the dylibs created by the cmake-build, but you'll have to adjust the paths via install_name_tool. Or you create an installer package which copies the dylibs / frameworks to known places like /Library/Frameworks or /usr/lib HTH, Stephan ___ 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] Shadows on two-sided polygons
Hi Jean-Sébastien, I have turned off those things, and now it works good for me. Should I refactor that in a way that the application programmer can choose the behaviour and submit that? You could, but I think setting those things via overridden state is also acceptable, since if you need that you'll probably know what to set... You mean by setting the StateAttribute CullFaces to off and override for my shadowed scene? This would probably work (even though it is set with override in the ShadowMap? Which will override which?), but not for the polygon-offset, as this is not controlled with state. I mean this line: // negative polygonoffset - move the backface nearer to the eye point so that backfaces // shadow themselves float factor = _polyOffset[0]; float units = _polyOffset[1]; Another thing: I have written a vertex and a fragment shader that work together in a way that allows the shadows to be rendered exactly in the ambient color. This means that shadowed surfaces look the same as surfaces that face away from the light. This gives a much more natural feeling, and you don´t get false shadows on the backs of polygons. I needed the vertex shader to get the correct ambient color, I think it is not possible to do this with a fragment shader alone. I assume you're talking about osgShadow::ShadowMap? The shaders used for the ViewDependentShadow classes (LightSpacePerspectiveShadowMapDB, CB, VB) already do this. Note that osgShadow::StandardShadowMap is the equivalent of osgShadow::ShadowMap but under the ViewDependentShadow architecture, so you could have used that and you would have gotten the right shadow ambient color. It´s great to hear that, I haven´t used the new classes yet, as they are not (at least in 2.8.2) part of the shadow-Example and I could not easily play with them. However, I have made an option in my program to use the StandardShadowMap, and it does not work for me (yet). Here are the problems: - the side facing away from a light is not dark, example: http://raumgeometrie.de/NeueBilder/testbilder/IncorrectBack.png - the backside of a shadowed plane shows the shadow, too: http://raumgeometrie.de/NeueBilder/testbilder/IncorrectShadowOnBack.png The correct images (with my shaders) look like this: http://raumgeometrie.de/NeueBilder/testbilder/CorrectBack.png And this: http://raumgeometrie.de/NeueBilder/testbilder/NoShadowOnBackOfPlane.png Is it possible to render a more correct shadow for models like mine with StandardShadowMap? It seems a promising technology to me, I would like to use it, and the results (where they are correct) look really good. Regards, Andreas You can always submit those shaders (as part of modified ShadowMap.cpp files so that they work by default), I'm sure anyone still using osgShadow::ShadowMap will be glad you do. I think it´s nicer to have the shaders as separate files, one can easily load them and use them, no need to modify the source. J-S ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Rendering on two GPUs under linux
Hi Roman, Roman Grigoriev grigor...@gosniias.ru wrote: Hi, Thank you guys for your replies. You see, I have to setup 3 screens - one master screen with menues and two stereo screens for HMD (800*600) w/o menues. So SLI is not an option for me. Also I find some troubles using QT+osg on 3 screens under KDE. When I use only osg w/o QT all works fine across all three screens, but if I use QT like in osg examples viewers on separate X scrrens not drawing because I have to setup screen number to QT. I'm start thinking of separation QT part from osg and have two application. If someone already make such application please give me a hint how to make it. To avoid issues with Qt (mainly thread safety) and the need for 3+ screens, I am typically using two apps - one OSG-based, to render the simulation and another one with Qt, running on a separate machine to control it. They were talking to each other using CORBA (RPC). I am using OmniORB for that part, it is fairly easy to use. CORBA/networking may sound like an overkill, but it lets you have your control GUI on another machine while the main machine drives the simulation and may be inaccessible (e.g. back projected wall driven from some back room like in my case). The ability to keep the control GUI in front of the screen on a separate computer is great then. Regards, Jan signature.asc Description: This is a digitally signed message part. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Image update in ImageStream objects
HI Mourad, On Fri, Nov 20, 2009 at 5:51 PM, Mourad Boufarguine mourad.boufargu...@gmail.com wrote: When using an ImageStream object (using ffmpeg, gif, quicktime... plugins for instance), is there a way to catch the image uptade event without messing with the plugins source code ? I am willing to apply image processing algorithms on video streams and I want to intercept new images to do the processing only on new images. There is no callback mechanism for catching calls to dirty(); Perhaps you could use an update callback that checks on each new frame whether the modifiedCount has changed since the last frame and then do your image processing then. Or just move the image processing down onto the GPU, the GPU is far better for doing image processing than the CPU so you'd likely gain in performance. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] PagedLOD/ProxyNode pseudoloader suffix techniques
Hi Chris, Another possibility of how to tackle adding the proxy node would be to use the new support (in svn/trunk) in osgDB::Options for providing a custom ReadFileCallback. Using this you can override the way that objects are loaded. PagedLOD has now has a _databaseOptions field that you can use for this. So that's now five ways of tackling the problem without needing to modify anything in the core OSG... and all of this approaches are more flexible than your original submission. Robert. On Fri, Nov 20, 2009 at 6:04 PM, Chris 'Xenon' Hanson xe...@alphapixel.com wrote: [Moving to osg-users for discussion.] Robert Osfield wrote: Hi Chris, There are other better ways to add the alias. Ok, well, if I'm going to need to rewrite this, let's work out what the best engineering approach is first so it gets done right the (second) time. Paul's suggestion of utilising the OSG's use of the Chain of Responsibility pattern to check for ability to load files from plugin is another approach you could use, an approach that is similar to use a custom Registry::ReadFileCallback. This does avert the only-one-ReadfileCallback issue I raised earlier. But, I have to be honest, this approach seems fairly obscure and not-obvious. I personally was never aware that you could have one plugin 'intercept' loads directed towards another plugin, and the mechanism behind this seems cryptic at best to most users. I would personally like a solution where the typical user can actually easily tell what happened and why the pseudoloader got invoked to load the external file that had the extension for a different loader plugin. Another approach would be to use a custom CullCallback on the PagedLOD node, and override the way that the plugin chooses it's children and dispatches the file requests. To me, this seems the most attractive. However, as I recall, custom CullCallbacks are also singular -- if the pseudoloader uses this method, then it excludes the possibility that the user would want to use a Custom CullCallback themselves. I was trying to deploy the pseudoloader as a system that could seamlessly be used in any application without disrupting any existing (or future) use of scenegraph technologies. I'm not just trying to make a quick kludge that works for my current app, I want something that becomes part of the whole OSG technology suite so others can utilize and build on it. Another approach would be to use a custom DatabaseRequestHandler attached to the CullVisitor that intercepts all the file requests done by PagedLOD then passes these on to the DatabasePager with the filename appropriately modified. If I understand correctly, this one seems like it has the most code associated with it, and the least simplicity and obviousness. It means that to employ this method, a user needs to be concerned with messing with the DatabaseRequestHandler and the CullVisitor, which puts the action as it were, a long way from where the magic happens -- in the PagedLOD and ProxyNode. It also means the user has to modify their calling code, they can't just slap .modifyterrain onto the end of a file they're loading into osgViewer. All of these approaches are both more flexible and less intrusive than embedded the filename suffix into PagedLOD/ProxyNode. If you look at the scope of the submission I made, it is changes to a few concise lines of code, and it stores the necessary suffix-override state right where it is needed. It's self-contained in that no changes to user-code are required, and it's non-intrusive in that it doesn't interfere with any existing usage of the scene graph. Granted, it's not as flexible as some other approaches, but I thought the cleanliness and simplicity of it made up for it. I'm all in favor of using callbacks or functors to make enhancements extensible and not single-purpose (you'll see that in the .modifyterrain code which is highly customizable and extensible, especially if three of the utility APIs are put into core OSG somewhere). I felt the suffix member variable was isometric to the databaseprefix, and so the downside of it being special-purpose and not generalized was excusable. I have an idea for mitigating the generalization issues of a custom CullCallback. What if the external-reference node types (PagedLOD, ProxyNode and anything else in the future) supported a custom LoadCallback? This would allow interception of the load operation without having to take over the already-oft-utilized custom CullCallback. The modifyterrain pseudoloader could store the suffix information in an existing state variable, like using a Description string in the Node's DescriptionList. The LoadCallback could rely on searching for a KEY=VALUE description of the form of PSEUDOLOADER_LOAD_SUFFIX=.modifyterrain, and extract the suffix from there to employ it. Would this satisfy your
Re: [osg-users] OpenGL ES-2.0, OpenGL ES-1.1 and OpenGL 3.x support now ready for testing :-)
Hi Eric, Good to hear for you again, and thanks to really useful insight to the state of play under iPhone. Using SDL as a stop gap for getting the OSG up and running under OSX seems sensible. One could just comment out the compile of the Cocoa and Carbon components of osgViewer and just leave it as a naked viewer lib, and the compile the osgviewerSDL example. Robert. On Fri, Nov 20, 2009 at 8:23 PM, E. Wing ewmail...@gmail.com wrote: Hello, just passing through again. I thought I would clarify the questions being asked about iPhone. First congrats on the ES support! One thing you apparently need to be careful of is that Apple is now more careful in its screening of iPhone apps that are submitted for the App Store, they apparently got bitten by some apps harvesting phone numbers and such... I don't know personally, but I read it here: http://www.develop-online.net/news/33266/Unity-iPhone-games-rejected-by-Apple http://forum.unity3d.com/viewtopic.php?t=35744 Seems some of the calls they rejected apps for seems to be an equivalent of getenv(), which OSG uses, so it might be interesting to check the actual approval rules and see if we can disable things that would cause apps to be rejected with an iphone-specific define in CMake or something. According to the article, they admittedly used private APIs which is explicitly forbidden in Apple's license terms. I don't believe getenv or any ANSI C function is considered private. Private stuff is usually proprietary Apple APIs hidden away and undocumented which you have to go out of your way to use. I can't imagine OSG would hit any of these either by accident or on purpose. osgDB and static linking: Yes, iPhone license terms forbid dynamic linking and dynamic loading. Pain in the arse. However, I thought we already had a static linking option in the build options, primarily used by Windows users to make distribution easier. I would suggest trying that option to see if that works around the issue. CMake: Officially, I don't think there is CMake support for iPhone yet. However, the rumor mill has it that some large project may already have it working. It might have been Orge3D. BTW, on the iPhone what is the scheme for creating windows and graphics contexts? Is Cocoa based? Would it be possible to use any of the existing osgViewer support for OSX? Yes IPhone uses cocoa and Objective C which at the momnet I rather suck at (jump to c++ at first chance). It does use views and windows although at the mo my window is created in the interface editor. I think the cocoa viewer should be a pretty good start point for an iphoneViewer. iPhone also uses Cocoa, though the class View hierarchy on iPhone is different than on the desktop so there will need to be a new viewer implementation. The most similar APIs are Core Animation/CALayer which have very few differences, but I don't think the OSG viewer uses Core Animation. But the desktop OpenGL and ES versions of CALayer do have a few differences so there would have to be some #defines. And you would still need to encapsulate the layers in a view class which is where most of the differences really reside. (e.g. mouse input vs multi-touch, etc.) The code flow and design patterns should be almost mirrors of each other though. One other caveat though. The ImageIO backend I wrote for Mac does not work on iPhone because ImageIO wasn't ported to the iPhone, so you will likely want a UIImage backend. I implemented one for SDL_image which was derived from an ImageIO one I wrote for SDL_image, which was ultimately derived from the one I wrote for OSG. So you might look at SDL for inspiration for both the view and image loader in addition to the existing osg Cocoa viewer. (You might also experiment with just using the SDL/OSG viewer since SDL already has preliminary iPhone support.) -Eric ___ 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] Height fields implementation
Hi Janna, osgTerrain::TerrainTile will be a better base to work from when rendering a HeightField. There is a HeightFieldLayer class that allows you to attach your height field to the TerrainTile. There is a brute for GeometryTechnique that will just rendering the data by sending down a vertex array and all the triangle primitives as DrawElement - so will efficiently use indices. Using osgTerrain gives the ability to down sample the data, and also implement your own custom TerrainTechnique if and when you need it. Another approach is to to pre-process your data using VirtualPlanetBuilder. This will generated a paged database for you and happily allow you to scale up to handling terra bytes of data. Robert. On Fri, Nov 20, 2009 at 7:24 PM, Janna Terde brja...@gmail.com wrote: Hi, I am trying to create a height field with the decent framerate (using for example 2000 by 2000 height map). I read on this forum that using osg Height Field class in not recommended because I would have to use ShapeDrawable which will slow things down. I created a height field geometry myself (using triangular stripes). Basically for each column in the height map I created a triangular stripe. Unfortunately I got very bad performance (2 times slower than using osg HeightField class). I am wondering what can be a problem. Could it happen because I create too many osg nodes (I doubt it) or am I missing something else? I will appreciate any suggestions! Thank you very much! Cheers, Janna -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=20020#20020 ___ 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] Multiple cameras with setRenderOrder(PRE_RENDER, i)
Hi Ross -- Nesting cameras alone doesn't cause the output of the first Camera to be sent to the second Camera. The second Camera will need to bind the texture that the first Camera rendered into. Is it possible that you simply failed to do this? For a really simple example of RTT, see the attached example. It uses the Viewer Camera to render the scene to an FBO with a texture attached, then uses a post render Camera to draw a full-window quad with the texture applied. Take a look at how it wires up the texture between the two Cameras -- as an attachment to the first Camera, and as a Texture in the StateSet of the second Camera. For information on how Camera rendering is handled, take a look at CullVisitor::apply(Camera). During cull, a Camera node creates a RenderStage in the render graph. Each RenderStage has a list of pre children and post children. The Camera's render order determines whether the new RenderStage is added to the pre or post list of the current RenderStage. During draw, OSG traverses the graph of RenderStages by recursively processing first the pre list, then the RenderStage, then the post list. Paul Martz Skew Matrix Software LLC _http://www.skew-matrix.com_ http://www.skew-matrix.com/ +1 303 859 9466 Ross Bohner wrote: Hi, I am having difficulty setting the order of multiple pre render cameras for RTT. Specifically I wish to set 1. a camera for rendering a depth buffer to a texture which is sent as a uniform to 2. another camera which preforms some more calculations to a texture which is used on the general scene root. I set the first camera as a subnode to the second camera and sent both renderOrders to PRE_RENDER. However this structure does not correctly send output texture of the first camera to the second camera's shader. I have verified the shaders and first camera's output. How does the render sequence get handled? I have read in other posts that the render order was based on the camera hierarchy. Did I misinterpret this and not have added the first camera as a child to the second camera? Also how does the RenderOrderNum of a camera effect the order to processing? If the cameras are siblings my first interpretation was that the order is PRE_RENDER 0, PRE_RENDER 1, ..., PRE_RENDER n, NESTED_RENDER 0, NESTED_RENDER 1, ... NESTED_RENDER n, POST_RENDER 0, POST_RENDER 1, ... POST_RENDER n. However I did try setting the render order for the sequence above but the first camera's output texture was not available for processing by the second camera. Any help would be greatly appreciated Thank you! Cheers, Ross -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=20043#20043 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org // Copyright (c) 2008 Skew Matrix Software LLC. All rights reserved. #include osg/Node #include osg/Camera #include osg/Geode #include osg/Geometry #include osg/Texture2D #include osgDB/ReadFile #include osgViewer/Viewer #include string const int winW( 800 ), winH( 600 ); osg::Node* postRender( osgViewer::Viewer viewer ) { osg::Camera* rootCamera( viewer.getCamera() ); // Create the texture; we'll use this as our color buffer. // Note it has no image data; not required. osg::Texture2D* tex = new osg::Texture2D; tex-setTextureWidth( winW ); tex-setTextureHeight( winH ); tex-setInternalFormat( GL_RGBA ); tex-setBorderWidth( 0 ); tex-setFilter( osg::Texture::MIN_FILTER, osg::Texture::NEAREST ); tex-setFilter( osg::Texture::MAG_FILTER, osg::Texture::NEAREST ); // Attach the texture to the camera. Tell it to use multisampling. // Internally, OSG allocates a multisampled renderbuffer, renders to it, // and at the end of the frame performs a BlitFramebuffer into our texture. rootCamera-attach( osg::Camera::COLOR_BUFFER0, tex, 0, 0, false, 8, 8 ); rootCamera-setRenderTargetImplementation( osg::Camera::FRAME_BUFFER_OBJECT, osg::Camera::FRAME_BUFFER ); // Configure postRenderCamera to draw fullscreen textured quad osg::ref_ptr osg::Camera postRenderCamera( new osg::Camera ); postRenderCamera-setClearColor( osg::Vec4( 0., 1., 0., 1. ) ); // should never see this. postRenderCamera-setRenderTargetImplementation( osg::Camera::FRAME_BUFFER, osg::Camera::FRAME_BUFFER ); postRenderCamera-setReferenceFrame( osg::Camera::ABSOLUTE_RF ); postRenderCamera-setRenderOrder( osg::Camera::POST_RENDER ); postRenderCamera-setViewMatrix( osg::Matrixd::identity() ); postRenderCamera-setProjectionMatrix( osg::Matrixd::identity() ); osg::Geode* geode( new osg::Geode ); geode-addDrawable( osg::createTexturedQuadGeometry( osg::Vec3( -1,-1,0 ), osg::Vec3( 2,0,0 ), osg::Vec3( 0,2,0 ) ) ); geode-getOrCreateStateSet()-setTextureAttributeAndModes(
Re: [osg-users] Multiple cameras with setRenderOrder(PRE_RENDER, i)
Hi Ross, Nested RTT Camera's that use PRE_RENDER will always be rendered prior to the enclosing Camera's. W.r,t RenderOrder, camera's are always rendered from -ive to +ive values from within the same level of nesting. In you case it sounds like you should avoid putting the pre render camera above the one which you are trying to render, instead keep them as siblings and use the RenderOrder to draw the pre render camera first, nest the pre render camera inside the main camera. Robert. On Sat, Nov 21, 2009 at 4:12 AM, Ross Bohner rgboh...@iastate.edu wrote: Hi, I am having difficulty setting the order of multiple pre render cameras for RTT. Specifically I wish to set 1. a camera for rendering a depth buffer to a texture which is sent as a uniform to 2. another camera which preforms some more calculations to a texture which is used on the general scene root. I set the first camera as a subnode to the second camera and sent both renderOrders to PRE_RENDER. However this structure does not correctly send output texture of the first camera to the second camera's shader. I have verified the shaders and first camera's output. How does the render sequence get handled? I have read in other posts that the render order was based on the camera hierarchy. Did I misinterpret this and not have added the first camera as a child to the second camera? Also how does the RenderOrderNum of a camera effect the order to processing? If the cameras are siblings my first interpretation was that the order is PRE_RENDER 0, PRE_RENDER 1, ..., PRE_RENDER n, NESTED_RENDER 0, NESTED_RENDER 1, ... NESTED_RENDER n, POST_RENDER 0, POST_RENDER 1, ... POST_RENDER n. However I did try setting the render order for the sequence above but the first camera's output texture was not available for processing by the second camera. Any help would be greatly appreciated Thank you! Cheers, Ross -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=20043#20043 ___ 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] osgManipulator error bug? in removeTransformUpdating
Hi, ive checked the trunk, it works - thanks a lot Thank you! Cheers, Matthias -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=20064#20064 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgOcean] Wake effects?
Hi Buganini, Does same problem also occur for cliff straightly down to deep sea bed ? Possibly, I don't know. J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Shadows on two-sided polygons
Hi Andreas, However, I have made an option in my program to use the StandardShadowMap, and it does not work for me (yet). Here are the problems: I'll have to let Wojtek answer these questions - I don't normally use planes in my scenes, generally I use manifold objects... I think it´s nicer to have the shaders as separate files, one can easily load them and use them, no need to modify the source. People who want to load different shaders will of course want to have shader files. But the default shaders need to be in the source, that way the examples can work without needing OSG-Data. It's just more self-contained for people who just want to use the effect with the default shaders. It's a pattern that's been used in many effects in OSG, including most shadow techniques. J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Lazy textures/images
Hi all, According to you, what is the best way to make textures/images lazy ? I mean load textures from disk only when needed, that is to say when accessing pixel data. May I look at subload callbacks? Image pager(?)? Something else? Thanks. -- Sukender PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Loading files and ignore texture images
Hi, I have a problem with loading files without the assigned textures. osg is working perfect in loading the e.g. an .obj file with its assigned textures by: osg::ref_ptrosg::Node rootNode = osgDB::readNodeFile(filename); After that I'm able to parse the node and get all the vertex, normal, etc. information I need. Also the image data of textures is available, but that is the thing I don't want. I want to load image files with my own code. Is there a way to ignore loading image files in the readNodeFile part? When parsing the node i only need the info that there is a texture and its path and filename to load it in my code. Thank you! Cheers, Maik -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=20010#20010 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] [osgPlugins] osganimation plugin and static linking
Hi there, I am very new to OpenSceneGraph and I apologize in advance if this question already has an answer in this forum. I am using the static version of OpenSceneGraph, under windows. I recompiled the sources with the OSG_LIBRARY_STATIC flag. I compiled and tested the osgstaticviewer, and it works fine. Now, I recompiled the osganimationviewer example in a separate project. I added the following macros, as specified in the osgstaticviewer project : USE_OSGPLUGIN(ive); USE_OSGPLUGIN(freetype); USE_OSGPLUGIN(osg); //USE_OSGPLUGIN(osganimation); USE_OSGPLUGIN(rgb); USE_OSGPLUGIN(OpenFlight); // include the platform specific GraphicsWindow implementation. USE_GRAPHICSWINDOW(); It does compile if I comment USE_OSGPLUGIN(osganimation), but then the program tries to find the osgAnimationd.dll and osgdb_osganimationd.dll (I saw this thanks to OSG_NOTIFY_LEVEL set to DEBUG). It fails to link if I leave the USE_OSGPLUGIN(osganimation) macro on, and says : AnimtkViewer.obj : error LNK2001: unresolved external symbol _osgdb_osganimation I have osgdb_osganimationd.lib (static version) in my list of Additional Dependencies... Once again, I am sorry for that newbie question, but I thought that it could save me several hours and take only a couple of minutes to answer. So has anyone successfully compiled and run a osgstaticanimationviewer ? :-) Thank you in advance for your answers, Cheers, Stratboy61 -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=20056#20056 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] [build] createContextImplementation is undefined in GraphicsWindowWin32.cpp
Hi, Trying to build SVN 10813 update fails because osgViewer won't compile on Windows. GraphicsWindowWin32.cpp fails because createContextImplementation is undefined. I have the entire source tree indexed, and doing a full text search finds only one reference to createContextImplementation, and that is in GraphicsWindowWin32.cpp on line 1198. Thank you! Cheers, John -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=20068#20068 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Deploy OSG application
Hi Stephan here the answer of my workmate: I tried this without luck. After compiling the Frameworks and using them in my application, I get the following linking errors when building with Xcode: Undefined symbols: non-virtual thunk to osgViewer::Viewer::~Viewer() osgDB::readImageFile(std::basic_stringchar, std::char_traitschar, std::allocatorchar const, osgDB::Options const*) osgText::readFontFile(std::basic_stringchar, std::char_traitschar, std::allocatorchar const, osgDB::Options const*) osgViewer::Viewer::checkNeedToDoFrame() non-virtual thunk to osgViewer::Viewer::setStartTick(unsigned long long) non-virtual thunk to osgViewer::Viewer::setSceneData(osg::Node*) (See complete compiler output attached) The same also happens when using the pre-compiled binaries from http://www.cuboslocos.com You can use a similar technique with the dylibs created by the cmake-build, but you'll have to adjust the paths via install_name_tool. Also tried that. Compiled the dylibs with cmake and installed them in /usr/local/lib. Compiling and linking against them works fine. For packaging I copied them to the application bundle (to Contents/MacOS/) and changed all paths using install_name_tool. Starting the application does not show any linking errors but the following runtime error occurs: Exception Type: EXC_BAD_ACCESS (SIGBUS) Thread 0 Crashed: 0 libosg.61.dylib 0x0036bda5 osg::Node::getOrCreateStateSet() + 21 1 When starting the application with the default references to /usr/local/lib/libosg* there are no such runtime errors. Or you create an installer package which copies the dylibs / frameworks to known places like /Library/Frameworks or /usr/lib This is currently not an option :-( ~Thomas Stephan Maximilian Huber schrieb: Dominic Stalder schrieb: we are trying to deploy an OSG application on Mac OS X to another system, where OSG is not installed. What is the best way to distribute the application, should we use static OSG linking (makes the file huge) or are there other / better ways? I haven't tried static builds on OS X, so I can't comment on them. If you are using the deprecated xcode-projects to build osg as frameworks you can embed them into your application bundle and distribute it. This gives you a double-clickable app qhich you can copy wherever you want, no installation-step necessary. You just add a new copy-phase into your xcode-project of your app, set it's target to Frameworks and add all osg-related frameworks to it. (and the plugins goes into a subfolder plugins of the bundle) You can use a similar technique with the dylibs created by the cmake-build, but you'll have to adjust the paths via install_name_tool. Or you create an installer package which copies the dylibs / frameworks to known places like /Library/Frameworks or /usr/lib HTH, Stephan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org cd /Volumes/data/myosgproject /Developer/usr/bin/g++-4.0 -arch i386 -L/Volumes/data/myosgproject/build/Release -L/Library/Frameworks -L/System/Library/Frameworks -F/Volumes/data/myosgproject/build/Release -filelist /Volumes/data/myosgproject/tmp/obj/wiitetris.build/Release/wiitetris.build/Objects-normal/i386/wiitetris.LinkFileList -mmacosx-version-min=10.3 -headerpad_max_install_names -L/Library/Frameworks -F/Library/Frameworks -lz -lm -framework IOBluetooth -framework OpenThreads -framework osg -framework osgViewer -framework osgText -framework osgGA -framework osgDB -framework osgUtil -framework QtSvg -framework QtSql -framework QtOpenGL -framework QtGui -framework Carbon -framework AppKit -framework QtCore -framework ApplicationServices -framework OpenGL -framework AGL -o /Volumes/data/myosgproject/build/Release/wiitetris.app/Contents/MacOS/wiitetris Undefined symbols: non-virtual thunk to osgViewer::Viewer::~Viewer(), referenced from: construction vtable for osgViewer::Viewer-in-QwtGLWidgetin moc_qwtglwidget.o non-virtual thunk to osgViewer::Viewer::~Viewer(), referenced from: construction vtable for osgViewer::Viewer-in-QwtGLWidgetin moc_qwtglwidget.o osgDB::readImageFile(std::basic_stringchar, std::char_traitschar, std::allocatorchar const, osgDB::Options const*), referenced from: osgDB::readImageFile(std::basic_stringchar, std::char_traitschar, std::allocatorchar const)in gameview.o osgText::readFontFile(std::basic_stringchar, std::char_traitschar, std::allocatorchar const, osgDB::Options const*), referenced from: OsgOverlay::OsgOverlay()in osgoverlay.o osgViewer::Viewer::checkNeedToDoFrame(), referenced from: construction vtable for osgViewer::Viewer-in-QwtGLWidgetin moc_qwtglwidget.o vtable for QwtGLWidgetin moc_qwtglwidget.o non-virtual thunk to osgViewer::Viewer::setStartTick(unsigned long long), referenced from:
Re: [osg-users] Multiple cameras with setRenderOrder(PRE_RENDER, i)
Hi, Thank you for the code snippet. Looking it over I see two differences from my implementation which have been giving me a headache. These are not necessarily related to camera render orders so it might be appropriate to send these as separate threads. First difference from your code and mine is the lack of you needing to allocate an image to the render in order to place the texture within a stateset: Code: //... initializing texture, attached to camera'a color buffer, etc [b]osg::Image* image = new osg::Image; image-allocateImage(width, height, 1, GL_RGBA, GL_FLOAT); _texture-setImage(0, image);[/b] //... initializing geometry and stateset stateset-setTextureAttributeAndModes(0, _texture, osg::StateAttribute::ON); In my experience, this is required or else a seg fault occurs when the draw traversal references _texture. I am confused on how you are able to pass the texture without allocating an image inside the texture. I have included a code snippet below to fully clarify what I see occurring. The second difference is your code uses non power of 2 dimensions for your texture to be rendered by your camera. Whenever I have tried to do this I have run into the error : Warning: detected OpenGL error 'invalid value' after RenderBin::draw(,) during every draw call to the geometry containing the texture Here is my code snippet with the problematic line in bold Code: //Will need to set the texture size to the size of the viewport, it is not right now _texture = new osg::Texture2D(); { _texture-setTextureSize(width, height); _texture-setInternalFormat(GL_RGBA); _texture-setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::NEAREST); _texture-setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::NEAREST); } //set up the camera { // set up the render to camera attributes. setClearMask( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); setClearColor(osg::Vec4(0.0f,0.0f,0.0f,1.0f)); // set viewport setViewport(0,0, width, height); setRenderOrder(osg::Camera::PRE_RENDER); setRenderTargetImplementation(osg::Camera::FRAME_BUFFER, osg::Camera::FRAME_BUFFER); // attach the texture and use it as the color buffer. this will render the depth buffer to the texture. //this should not be needed //## Problem 1 ## osg::Image* image = new osg::Image; image-allocateImage(width, height, 1, GL_RGBA, GL_FLOAT); _texture-setImage(0, image); //## Problem 1 ## //render the depth buffer to the texture attach(osg::Camera::COLOR_BUFFER0, _texture, 0, 0, false, 8, 8); } osg::Geometry* polyGeom = new osg::Geometry(); polyGeom-setDataVariance( osg::Object::DYNAMIC ); polyGeom-setSupportsDisplayList(false); float x0 = -5; float y0 = 0; float w = 10; float h = 10; osg::Vec3Array* verts = new osg::Vec3Array; verts-push_back(osg::Vec3(x0, 0, y0)); verts-push_back(osg::Vec3(x0 + w, 0, y0)); verts-push_back(osg::Vec3(x0 + w, 0, y0 + h)); verts-push_back(osg::Vec3(x0, 0, y0 + h)); polyGeom-setVertexArray(verts); polyGeom-addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,verts-size())); osg::Vec2Array* texcoords = new osg::Vec2Array; texcoords-push_back(osg::Vec2(0, 0)); texcoords-push_back(osg::Vec2(1, 0)); texcoords-push_back(osg::Vec2(1, 1)); texcoords-push_back(osg::Vec2(0, 1)); polyGeom-setTexCoordArray(0,texcoords); osg::Vec4Array* colors = new osg::Vec4Array; colors-push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); polyGeom-setColorArray(colors); polyGeom-setColorBinding(osg::Geometry::BIND_OVERALL); osg::StateSet* stateset = new osg::StateSet; //### problem 2 //without allocating an image to the texture this line will cause a seg fault stateset-setTextureAttributeAndModes(0, _texture, osg::StateAttribute::ON); //### stateset-setMode(GL_LIGHTING,osg::StateAttribute::OFF); polyGeom-setStateSet(stateset); osg::Geode* geode = new osg::Geode(); geode-addDrawable(polyGeom); return geode; Thank you for taking time to go over the code and looking at this post Cheers, Ross -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=20071#20071 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] setUpViewerAsEmbeddedInWindow and wxPython glcanvas
On 2009-10-07, Randolph Fritz rfritz...@gmail.com wrote: Thank you, that helped a lot. My C++ code has now come up and run in a Python GLUT test bed program, though I'm still having problems with wxPython. And, this is why: It turns out that osgViewer::Viewer::setUpViewerAsEmbeddedInWindow() works much, much better when the window width and height are non-zero. However, on the Mac (but not on Windows or Linux), WxPython initially sets the width and height to zero, andthe window is then resized. I hacked the code to set them to (1,1) when either was reported as zero, and the code now works. I suppose I could now write osgviewerWxPy. Randolph ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Using a PRE_RENDER stage texture as uniform to a later render stage
Hi, I am using a pre_render stage camera to generate a texture for later use. However the texture is not accessable to a later stage shader when it is set as uniform, Since the texture functions fine when attached to geometry and the shaders handle non generated textures without problem, I am wondering whether is even possible to send an earlier render stage output to a later stage shader. Conceptually it makes sense that this is possible. If it is, I would appreciate possible examples of this working. The code below is a snippet of how I am currently try to implement this functionality. thank you for any help offered Code: //constructor for the render camera class, which prerenders to a texture RenderCamera::RenderCamera(int height, int width){ _texture = new osg::Texture2D(); _height = height; _width = width; //Will need to set the texture size to the size of the viewport, it is not right now _texture-setTextureSize(width, height); _texture-setInternalFormat(GL_RGBA); _texture-setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::NEAREST); _texture-setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::NEAREST); // set up the render to camera attributes. setClearMask( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); setClearColor(osg::Vec4(0.0f,0.0f,0.0f,1.0f)); // set viewport setViewport(0,0, _width, _height); setRenderOrder(osg::Camera::PRE_RENDER); //set the render target, the frame buffer object is required else the textures seg fault for some reason setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT, osg::Camera::FRAME_BUFFER); // attach the texture and use it as the color buffer. this will render the depth buffer to the texture. osg::ref_ptrosg::Image image = new osg::Image; image-allocateImage(_width, _height, 1, GL_RGBA, GL_FLOAT); _texture-setImage(0, image.get()); //render the color buffer to texture attach(osg::Camera::COLOR_BUFFER0, _texture.get(), 0, 0, false, 8, 8); } //send the texture generated from the prerender camera osg::Texture2D* RenderCamera::getTexture(){ return _texture.get(); } //initialize the prerender camera class osg::ref_ptrRenderCamera smokeCamera = new RenderCamera(1024, 1024); smokeCamera-setShader(shaders/depthPosition.vs, shaders/depthPosition.fs); smokeCamera-setRenderOrder(osg::Camera::PRE_RENDER, 0); smokeCamera-addChild(_cloud); root-addChild(smokeCamera.get()); //set the second stage stateset osg::ref_ptrosg::StateSet stateset = root-getOrCreateStateSet(); stateset-setRenderBinDetails(1,RenderBin); osg::ref_ptrosg::Program program(new osg::Program); program-addShader(osg::Shader::readShaderFile(osg::Shader::VERTEX, shaders/volumetricSmoke.vs)); program-addShader(osg::Shader::readShaderFile(osg::Shader::FRAGMENT, shaders/volumetricSmoke.fs)); //the texture does not get passed to the shader stateset-setTextureAttributeAndModes(0, smokeCamera-getTexture(), osg::StateAttribute::ON); stateset-addUniform(new osg::Uniform(smokeDepthTexture, 0), true); stateset-setAttribute(program.get()); Thank you! Cheers, Ross -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=20075#20075 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OpenGL ES-2.0, OpenGL ES-1.1 and OpenGL 3.x support now ready for testing :-)
Hi Robert, Eric Firstly thanks for the info about the IPhone port Eric, gave me a massive lead. I've had a bit of time and now have OpenSceneGraph rendering using osgUtil::SceneView on IPhone. So far there's been a very limited number of code changes, mainly defines. I've now started on the route of getting osgDB working so I can test something more substantial then a quad. Using Erics advise about the static linking I followed this infohttp://www.openscenegraph.org/projects/osg/wiki/Community/Tasks/Win32StaticLink. All seems to make sense, it basically says that if we static link to the plugin library then some how we still need to initialize the plugins RegisterReaderWriterProxy variable so that the plugin is added to the osgDB::Registry. So I picked osgdb_obj as a first test as it only depends on OSG libs. The lib has built fine and using the nm command in terminal I can see the mangled symbol name is __ZL23g_proxy_ReaderWriterOBJ But now I'm stuck, I need to force XCode to link this variable. In the windows tutorial they use a linker option /include:symbol, for XCode (gcc) I have found '-u symbol' which does cause it to try and link to 'symbol' but always returns undefined and causes an error. Does anybody know how to achieve this in XCode? Once this is working I think it is plain sailing. Cheers Tom ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OpenGL ES-2.0, OpenGL ES-1.1 and OpenGL 3.x support now ready for testing :-)
Hi Guys Found the solution in osgStatic viewer, just needed USE_OSGPLUGIN(name). very handy :) I'll try get osg/ive and an image plugin up and running and report the results Cheers Tom 2009/11/22 Thomas Hogarth thomas.hoga...@googlemail.com Hi Robert, Eric Firstly thanks for the info about the IPhone port Eric, gave me a massive lead. I've had a bit of time and now have OpenSceneGraph rendering using osgUtil::SceneView on IPhone. So far there's been a very limited number of code changes, mainly defines. I've now started on the route of getting osgDB working so I can test something more substantial then a quad. Using Erics advise about the static linking I followed this infohttp://www.openscenegraph.org/projects/osg/wiki/Community/Tasks/Win32StaticLink. All seems to make sense, it basically says that if we static link to the plugin library then some how we still need to initialize the plugins RegisterReaderWriterProxy variable so that the plugin is added to the osgDB::Registry. So I picked osgdb_obj as a first test as it only depends on OSG libs. The lib has built fine and using the nm command in terminal I can see the mangled symbol name is __ZL23g_proxy_ReaderWriterOBJ But now I'm stuck, I need to force XCode to link this variable. In the windows tutorial they use a linker option /include:symbol, for XCode (gcc) I have found '-u symbol' which does cause it to try and link to 'symbol' but always returns undefined and causes an error. Does anybody know how to achieve this in XCode? Once this is working I think it is plain sailing. Cheers Tom ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Loading files and ignore texture images
Maik Stange wrote: I have a problem with loading files without the assigned textures. osg is working perfect in loading the e.g. an .obj file with its assigned textures by: osg::ref_ptrosg::Node rootNode = osgDB::readNodeFile(filename); After that I'm able to parse the node and get all the vertex, normal, etc. information I need. Also the image data of textures is available, but that is the thing I don't want. I want to load image files with my own code. Is there a way to ignore loading image files in the readNodeFile part? When parsing the node i only need the info that there is a texture and its path and filename to load it in my code. I think you could install a Read File Callback and just ignore/fail the loading of the texture images. Cheers, Maik -- Chris 'Xenon' Hanson, omo sanza lettere Xenon AlphaPixel.com PixelSense Landsat processing now available! http://www.alphapixel.com/demos/ 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
[osg-users] Does anybody know how to include OSGViewer using MFC?
I`m trying to make a very simple CAD program but, all examples aren`t based on MFC... I`ve seen the example called OSGMFC, but,, I couldn`t find an OSGViewer. As u see, I don`t know even the first thing of OSG. I want to follow sb`s achievement. BUT NO EXAMPLES.. help me... -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=20045#20045 attachment: 1.JPG___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org