Re: [osg-users] OSG + QT and QTabWidget: Disappearing scene graph
You might need to change how and when the osg viewer frame() is called. You migh also need to apply new osgQt patch waiting at submissions. I'am pasting modified osg Qt viewer example with more general frame update solution: #include QtCore/QTimer #include QtGui/QApplication #include QtGui/QGridLayout #include osgViewer/CompositeViewer #include osgViewer/ViewerEventHandlers #include osgGA/TrackballManipulator #include osgDB/ReadFile #include osgQt/GraphicsWindowQt #include iostream class ViewerWidget : public QWidget, public osgViewer::CompositeViewer { public: ViewerWidget(osgViewer::ViewerBase::ThreadingModel threadingModel=osgViewer::CompositeViewer::SingleThreaded) : QWidget() { setThreadingModel(threadingModel); QWidget* widget1 = addViewWidget( createCamera(0,0,100,100), osgDB::readNodeFile(cow.osgt) ); QWidget* widget2 = addViewWidget( createCamera(0,0,100,100), osgDB::readNodeFile(glider.osgt) ); QWidget* widget3 = addViewWidget( createCamera(0,0,100,100), osgDB::readNodeFile(axes.osgt) ); QWidget* widget4 = addViewWidget( createCamera(0,0,100,100), osgDB::readNodeFile(fountain.osgt) ); QWidget* popupWidget = addViewWidget( createCamera(900,100,320,240,Popup window,true), osgDB::readNodeFile(dumptruck.osgt) ); popupWidget-show(); QGridLayout* grid = new QGridLayout; grid-addWidget( widget1, 0, 0 ); grid-addWidget( widget2, 0, 1 ); grid-addWidget( widget3, 1, 0 ); grid-addWidget( widget4, 1, 1 ); setLayout( grid ); //connect( _timer, SIGNAL(timeout()), this, SLOT(repaint ()) ); //_timer.start( 10 ); setRunFrameScheme(osgViewer::ViewerBase::ON_DEMAND); _timerId = startTimer(0); } virtual ~ViewerWidget() { if (_timerId != 0) killTimer(_timerId); } QWidget* addViewWidget( osg::Camera* camera, osg::Node* scene ) { osgViewer::View* view = new osgViewer::View; view-setCamera( camera ); addView( view ); view-setSceneData( scene ); view-addEventHandler( new osgViewer::StatsHandler ); view-setCameraManipulator( new osgGA::TrackballManipulator ); osgQt::GraphicsWindowQt* gw = dynamic_castosgQt::GraphicsWindowQt*( camera-getGraphicsContext() ); return gw ? gw-getGLWidget() : NULL; } osg::Camera* createCamera( int x, int y, int w, int h, const std::string name=, bool windowDecoration=false ) { osg::DisplaySettings* ds = osg::DisplaySettings::instance().get(); osg::ref_ptrosg::GraphicsContext::Traits traits = new osg::GraphicsContext::Traits; traits-windowName = name; traits-windowDecoration = windowDecoration; traits-x = x; traits-y = y; traits-width = w; traits-height = h; traits-doubleBuffer = true; traits-alpha = ds-getMinimumNumAlphaBits(); traits-stencil = ds-getMinimumNumStencilBits(); traits-sampleBuffers = ds-getMultiSamples(); traits-samples = ds-getNumMultiSamples(); osg::ref_ptrosg::Camera camera = new osg::Camera; camera-setGraphicsContext( new osgQt::GraphicsWindowQt(traits.get()) ); camera-setClearColor( osg::Vec4(0.2, 0.2, 0.6, 1.0) ); camera-setViewport( new osg::Viewport(0, 0, traits-width, traits-height) ); camera-setProjectionMatrixAsPerspective( 30.0f, static_castdouble(traits-width)/static_castdouble(traits-height), 1.0f, 1.0f ); return camera.release(); } virtual bool event( QEvent* event ) { if (event-type() == QEvent::Timer) { if (static_castQTimerEvent*(event)-timerId() == _timerId) { frame(); return true; } } return QWidget::event(event); } //virtual void paintEvent( QPaintEvent* event ) //{ // frame(); //} protected: int _timerId; }; int main( int argc, char** argv ) { osg::ArgumentParser arguments(argc, argv); osgViewer::ViewerBase::ThreadingModel threadingModel = osgViewer::ViewerBase::CullThreadPerCameraDrawThreadPerContext; while (arguments.read(--SingleThreaded)) threadingModel = osgViewer::ViewerBase::SingleThreaded; while (arguments.read(--CullDrawThreadPerContext)) threadingModel = osgViewer::ViewerBase::CullDrawThreadPerContext; while (arguments.read(--DrawThreadPerContext)) threadingModel = osgViewer::ViewerBase::DrawThreadPerContext; while (arguments.read(--CullThreadPerCameraDrawThreadPerContext)) threadingModel = osgViewer::ViewerBase::CullThreadPerCameraDrawThreadPerContext; QApplication app(argc, argv); ViewerWidget* viewWidget = new ViewerWidget(threadingModel); viewWidget-setGeometry( 100, 100, 800, 600 ); viewWidget-show();
Re: [osg-users] Multipass RTT stage setup?
Hi Conan, You can either use the Camera's RenderOrderNum to determine which order the cameras are rendered in, or simply nest the Camera that you want to drawn first. You should still use PRE_RENDER RenderOrder in both approaches. Robert. On Mon, Sep 5, 2011 at 10:03 PM, Conan Doyle o...@celticblues.com wrote: I have not been able to determine how to set up the following scenario. I want to set up my app to hve 3 cameras. Basically, I want to have two RTT pre-render stages. Camera 0 Render -Camera 1 Render-Main Camera Render. Each RTT node would have it's own shader to render the scene, and then render the target texture to a quad for display for the next render stage. My problem is that I am not sure how to set this up... For example, where do I attach the RTT nodes? Currently, I create a group node and add each child as children of this group node, and add the scene to each camera node. If I only add one camera or the other, I see what I expect, but if I add both, I only see the first camera added. When I create the RTT cameras I do specify PRE_RENDER and render # 0 for the first pre-render camera and render # 1 for the other, which I thought was correct. Any help is greatly appreciated. Thanks, CD -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42430#42430 ___ 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] osgShadow compile problem with OSG 2.7.8
On Tue, Sep 6, 2011 at 12:48 AM, Patrick J Neary patrick.ne...@ngc.com wrote: Do you have an issue with adding the friend declaration to support the older compilers? It all depends upon whether there is any risk of such a change breaking the build on other compilers. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] QT code
Hi Michael, I'm afraid I can't help on this, I can point you in the direction of the existing OSG Qt examples, but have very little Qt expertise myself. Robert. On Mon, Sep 5, 2011 at 8:03 PM, Michael W. Hall hal...@att.net wrote: Robert, Trying to use your example you mentioned to get a GUI going. I am getting an error about: /home/mwhall/Projects/osgMap/src/osgmap/MainWindow.cpp: In function ‘QWidget* addViewWidget(osg::Camera*, osg::Node*)’: /home/mwhall/Projects/osgMap/src/osgmap/MainWindow.cpp:48: error: ‘addView’ was not declared in this scope I am basically trying to get the example to run, but I am trying to restructure it a little. Thought you could take a quick look. Probably something easy that I am just missing. Thanks, Michael On Sun, 2011-08-14 at 11:07 +0100, Robert Osfield wrote: HI Michael, OSG-3.0.x has an osgQt library that provides a class for adapting Qt window to work with the osgViewer classes. The osgviewerQt example illustrates this in action. Robert. On Sat, Aug 13, 2011 at 10:25 PM, Michael W. Hall hal...@att.net wrote: Would someone mind sharing their code for creating a QT application? I have spend numerous hours trying to create a QT window and have a window to render in. I have looked at the example code and it looks very different from the QT books I have. I would like to be able to create the menus using the QT. The progress I have made so far uses CMake to build which I like. But after reading some of the forums on using QT, I believe that what I have so far will not render any osg data. I really want to learn how to use OSG and I am getting frustrated just trying to create the window app. If someone could share there code or point me in the right direction I would appreciate it. ___ 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 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Question on decreasing latency for database pagers...
Hi Boon Wah, Loading shouldn't cause frame drops as the loading is done in back ground thread. Downloading the objects to graphics card is much more likely to cause frame drops, but for most VPB database on modern hardware this usually isn't an issue. From the sound of it you are setting the tile size to a very high value, you don't actually say whether you mean imagery or height field size, if it's imagery then it way too high, if your are referring to the height field then it's ridiculously high, and in both cases it's high enough to cause frame drops when downloading the data to GPU. Is there are reason why you aren't using VPB defaults for tile size? The defaults 256x256 for imagery, and 64x64 for the height field, and are chosen to provide a well balanced scene graph that loads and renders efficiently without framedrops. Robert. On Tue, Sep 6, 2011 at 3:54 AM, Boon Wah boon...@gmail.com wrote: Hi Robert, I will like to clarify on my question. I may not know the correct technical terms, but probably you are right, I am trying to minimize the frame drop rate. The scenario is like this: I have pre-compiled the data using VPB setting a tile size of 2048 by 2048. The entire 'terrain' image is over 1GB and this produces about 400+ tiles at the finest resolution. During rendering, I need to do a fly-pass at the finest resolution and maintaining a frame-rate of 60fps. I realise that the loading time for each tile is quite significant and this is causing a frame drop. A quick check is that I did two identical fly-pass consecutively and found that once the data has been loaded during the first fly-pass, there will not be frame drop for the second fly-pass. This makes me think of trying to pre-load all the tiles into the pager prior to commencing my fly-pass. What I wanted to know is how can I do this easily? I am looking at the direction of building a customiser pager to pre-load all the tiles (of course limited by my memory). Kind Regards, Boon Wah -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42435#42435 ___ 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] Question on decreasing latency for database pagers...
Hi Robert, In VPB, I have set my tile-image-size to 2048 and tile-terrain-size to be 2048. The rationale is for me to have larger tiles so as to minimize the number of files. My development platform is Windows and it is pretty poor at handle large number of files. Is it possible to modify the pager such that it caches all my tiles prior to performing rendering? I understand it defeats the purpose of paging, but in this way the loading time of the tiles can be controlled. I hope somebody can guide me in doing this. Thanks for your help. Kind Regards, Boon Wah -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42443#42443 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Question on decreasing latency for database pagers...
Hi Jimmy, I also use VPB and osgTerrain with 500GB+ databases. Genereally you are right, NTFS isn't the best database for handling folders with lots of files. But I think you mix up two different aspects: In my opinion the handling capability of large file numbers is another topic than loading performance. My experience is: - NTFS can handle large numbers of files - Windows explorer has problems to move/copy so many files, the file management ist poor. Once the files are finally written to disk it's fine. To your original problem: I think you optimize your system too hard along that one parameter: the reduction of files to load. The small tiles are not default settings for fun: with large tiles you thwart the LOD algorithm an finally have much more vertices to render than with small tiles and good LOD'ing. As Robert said, 2000 x 2000 heighfield tiles is way to large, it makes 400 vertices per tile! The loading of you tiles shouldnt affect your rendering frame rate. As Robert said, OSG uses several seperate threads only for loading files from disk and preparing them to be rendered. If you order a tile and this tile is loaded to late (by whatever reason), it will be loaded simple in the next frame, but the rendering thread would not wait for it to be loaded. After the pager has loaded the tile and passes it to the rendering thread to render it, it has to deal with several potential performance bottle necks: - The first time the tile should be rendered, the geometryTechnique has to create a renderable geometry (triangle mesh) of the heightfield. This seperation of data storage in the tiles and data interpretation during rendering introduces a great flexibility but also some calculation needs which can not be preponed into the VPB processing stage. - Another bootleneck could be the grafic hardware. As robert said on some point in the rendering stage the data has to be transfered into the grafics hardware to be rendered, because the data is loaded but still in CPU and not GPU space. Unlikely, but that may be a booteneck too. If you fly and you have to load a lot of new tiles, one of the the bottlenecks may cause your lag. Remember, every calculation regarding a single tile is way more performance comsumptive if your tiles are so large. I think OSG provides a mechanism to control how many data is compiled in each frame. Also here using smaller tiles allows OSG a much finer grained control. If I'm wrong in some thoughts, please correct me :) Thank you! Cheers, Torben -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42444#42444 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Question on decreasing latency for database pagers...
Hi Boon Wah, On Tue, Sep 6, 2011 at 12:25 PM, Boon Wah boon...@gmail.com wrote: Hi Robert, In VPB, I have set my tile-image-size to 2048 and tile-terrain-size to be 2048. The rationale is for me to have larger tiles so as to minimize the number of files. My development platform is Windows and it is pretty poor at handle large number of files. Is it possible to modify the pager such that it caches all my tiles prior to performing rendering? I understand it defeats the purpose of paging, but in this way the loading time of the tiles can be controlled. I hope somebody can guide me in doing this. The problem is your settings of tile-image-size and tile-terrain-size, please discard these and use the defaults. Having a large number of tiles is normal and shouldn't cause any performance issues even under Windows. VPB/OSG users are using VPB generated databases that are multi-terrabyte in size with colossal numbers of tile, all running a solid 60Hz under windows. As for caching all your tiles prior to rendering, this rather defeats the purpose of doing paging, it's designed to be on-demand. The DatabasePager does have a cache which is populated as your moving around the database. Again leaving this in it's default setting is normally OK for most users. Robert. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] bug in Viewer::setUpViewerAsEmbeddedInWindow?
Hi, While using the Viewer::setUpViewerAsEmbeddedInWindow() I saw a possible problem with it. If you setup your viewer that way, all GUI events seem to bring incorrect information about the window size. This is because that method does not call GUIEventAdapter::setWindowRectangle() while the other setup methods do call it. So for example a call to ea.getWindowHeight() will always return the default 1024 value, no matter what your window size actually is. Is that a bug or is that the way it is supposed to work? Cheers, Luca -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42446#42446 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] [build] How to get a simple OSG example on iOS
Hi, Can anyone explain how i get a simple OSG example on the iPhone with the git repository? I use Xcode 4 and sdk 4.3 Help me pls! Thank you! Cheers, Tobias -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42447#42447 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Question on decreasing latency for database pagers...
Hi, for forcing load from disk to CPU mem you can check what osgposter or osgSim HeightAboveTerrain does. This does not however force tiles to GPU memory. jp On 06/09/2011 13:25, Boon Wah wrote: Hi Robert, In VPB, I have set my tile-image-size to 2048 and tile-terrain-size to be 2048. The rationale is for me to have larger tiles so as to minimize the number of files. My development platform is Windows and it is pretty poor at handle large number of files. Is it possible to modify the pager such that it caches all my tiles prior to performing rendering? I understand it defeats the purpose of paging, but in this way the loading time of the tiles can be controlled. I hope somebody can guide me in doing this. Thanks for your help. Kind Regards, Boon Wah -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42443#42443 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] manual camera view matrix update
Hi there, This should be a quick one. I am using OSG compiled for Android OpenGL ES 2.0. I have my app up and running on the device. My shaders for the object I am displaying doesn't do anything special, but it works just fine. My problem is, I need to update the camera matrix manually, this means: I update the view matrix for every frame (or whenever I need to). Well, my shader doesn't seem to care about my efforts. Nothing changes after I attempt to change the matrix for the camera. For that purpose I use: Code: void OsgMainApp::setModelViewMatrix( osg::Matrixf osgMat ){ _viewer-getCamera()-setViewMatrix(osgMat); } that I use every frame I need to before doing: Code: _viewer-frame(); But camera shader uniforms doesn't seem to be updating. What am I missing?? Any hint? As you can guess I am not very experienced with osg. Thanks a lot! Cheers, Rubén -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42449#42449 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Multipass RTT stage setup?
I am already using the RenderOrderNum, I guess my question is more along the lines of where do I place the cameras in the scenegraph? Should one be the parent of the other, or should they be siblings? Or is that what nesting means, i.e. one a child of the other Thanks for the reply. CD [quote=robertosfield]Hi Conan, You can either use the Camera's RenderOrderNum to determine which order the cameras are rendered in, or simply nest the Camera that you want to drawn first. You should still use PRE_RENDER RenderOrder in both approaches. Robert. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42450#42450 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Skipping nodes in serialization
Robert Osfield wrote on 2011-09-05: There isn't a scheme for missing nodes during serialization. On Sat, Sep 3, 2011 at 12:01 PM, Joel Graff pair_o_gra...@comcast.net wrote: Hi, I have a graph that I serialize with a simple call to osgDB::writeNodeFile(), but it contains a node that is auto-generated when the application starts. Is there a way to exclude that node from serialization? I'm familiar with the setNodeMask() / setTraversalMask() mechanism used in visitor classes, but wasn't finding something similiar for serialization - nothing jumped out at me in the ReaderWriter docs, anyway. Joel, You could try writing a WriteFileCallback and adding it to the osgDB::Registry which modifies the node mask, serializes the nodes, then restores the mask. This would cause problems if you were using the nodes elsewhere at the same time, though (such as for rendering). -- Bryan Thrall Principal Software Engineer FlightSafety International bryan.thr...@flightsafety.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgText:FadeText attaching small object seems invisible initiatly
Hi, ... setCullingActive(false) works Thank you! Cheers, Lv -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42452#42452 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgText:FadeText attaching small object seems invisible initiatly
Hi, disable small feature culling with Code: viewer.getCamera()-setCullingMode(viewer.getCamera()-getCullingMode() | ~osg::CullSettings::SMALL_FEATURE_CULLING); Enable it with: Code: viewer.getCamera()-setCullingMode(viewer.getCamera()-getCullingMode() | osg::CullSettings::SMALL_FEATURE_CULLING); (note the missing ~ here!) Thank you! Cheers, Torben -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42453#42453 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Skipping nodes in serialization
On Sat, 2011-09-03 at 13:01 +0200, Joel Graff wrote: Hi, I have a graph that I serialize with a simple call to osgDB::writeNodeFile(), but it contains a node that is auto-generated when the application starts. Is there a way to exclude that node from serialization? I'm familiar with the setNodeMask() / setTraversalMask() mechanism used in visitor classes, but wasn't finding something similiar for serialization - nothing jumped out at me in the ReaderWriter docs, anyway. It is really mind-boggling-ly easy to write a serializer wrapper. Here, I'll show you (this file is generally called LibraryWrapper.cpp): -- #include osgDB/Registry #include osgDB/ObjectWrapper extern C void wrapper_serializer_library_myLibrary(void) { } REGISTER_OBJECT_WRAPPER( myLibrary_Object, new myLibrary::Object(), myLibrary::Object, osg::Object osg::MatrixTransform myLibrary::Object ) { } - As long as your object can be built after construction this will be a suitable workaround. If you want to actually serialize members, well, that's also incredibly easy (depending on what type of data they are). You can find some examples here: http://code.google.com/p/osgpango/source/browse/#svn%2Ftrunk%2Fsrc% 2Fserializers ...or all throughout the code in $OSG/src/osgWrappers/serializers/ ... Thank you! Cheers, Joel -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42403#42403 ___ 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] tight integration of virtual file system
Hi Terry, On Sun, Sep 4, 2011 at 9:29 PM, Terry Welsh mogu...@gmail.com wrote: Excellent ZipFS plugin Jason. Thank you for the help. I think that was the hardest part of the problem. I finally got around to working on this more and I have the other half of the problem mostly solved. Thanks, glad it worked for you. We don't use it anymore for osgEarth but I think in general it's pretty useful. It looks like OSG uses zlib for all its compression/decompression. Just out of curiosity, how did you pick libzip instead? Or did you not write ZipFS? I did write the ZipFS plugin, we chose libzip over just using zlib b/c it had easy access to dealing with zip archives. If zlib itself has something in there that we can use instead of having another dependency that would be great but I didn't really look that hard since libzip worked so well. If you have a submission for the osgEarth that you need integrated just send along the whole modified file or do a pull request on github and I'll take a look at it. Jason To recap, I'm trying to set an OSG_FILE_PATH such as mydirectory/data.zip and load files out of the specified archive. At first I discovered the Registry class's FindFileCallback. I thought I could just make one of those and have it search inside of zip files. However, the work that I really needed to replace happened when the default Registry::findDataFileImplementation would call osgDB::findFileInPath in FileUtils. So I decided to override findFileInPath so that would look for paths containing .zip and try to locate the desired file inside the zip file. That almost worked. I also had to modify ReaderWriterZipFS::readFile so that it uses OSG's directory searching. At the beginning of the function I added std::string filenameWithPath = osgDB::Registry::instance()-findDataFile(fullFileName, options, CASE_SENSITIVE); and then I use filenameWithPath instead of fullFileName where appropriate. So now I can load almost all my game resources from one .zip file instead of a directory full of files. I haven't tested performance yet, but there's no noticeable change. .osg files load with all their textures. Here's the catch: .osg files don't get loaded with their shaders. I believe this is because shaders don't use the standard OSG plugin loading paradigm. Instead they simply use Shader::loadShaderSourceFromFile(). I haven't put any thought into this last detail yet (I hope it's not too messy), but I need a programming break -- Terry Welsh mogumbo 'at' gmail.com www.reallyslick.com Message: 9 Date: Fri, 5 Aug 2011 08:50:10 -0400 From: Jason Beverage jasonbever...@gmail.com To: OpenSceneGraph Users osg-users@lists.openscenegraph.org Subject: Re: [osg-users] tight integration of virtual file system Message-ID: camcxsmsly2m20aoa5z7tubjob1xyrqqkmnz9z9lslzmmkqu...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 Hi Terry, osgEarth has a generic zip based plugin called ZipFS that is implemented as an osgDB plugin and isn't dependent on osgEarth. We originally developed it to support using a zip file of imagery tiles for a cache. It allows you to load files like: osgDB::readNodeFile(c:/data/models.zip/cow.osg); I haven't used it for quite awhile but last I checked it was working just fine. You can get the osgearth source code from github at https://github.com/gwaldron/osgearth If anything it could be a start to what you're looking for. Thanks, Jason ___ 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] Question on decreasing latency for database pagers...
Hi all, Thanks for all of your replies. I will re-look and see how best to optimise my code. Thanks again! Kind Regards, Boon Wah -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42457#42457 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] manual camera view matrix update
Hi Rubén, The osg should be setting the osg_ModelViewMatrix uniform, which is equivilant to the gl_ModelViewMatix found in GLSL on OpenGL 2.0. Robert. On Tue, Sep 6, 2011 at 2:42 PM, Rubén Díaz ruw...@hotmail.com wrote: Hi there, This should be a quick one. I am using OSG compiled for Android OpenGL ES 2.0. I have my app up and running on the device. My shaders for the object I am displaying doesn't do anything special, but it works just fine. My problem is, I need to update the camera matrix manually, this means: I update the view matrix for every frame (or whenever I need to). Well, my shader doesn't seem to care about my efforts. Nothing changes after I attempt to change the matrix for the camera. For that purpose I use: Code: void OsgMainApp::setModelViewMatrix( osg::Matrixf osgMat ){ _viewer-getCamera()-setViewMatrix(osgMat); } that I use every frame I need to before doing: Code: _viewer-frame(); But camera shader uniforms doesn't seem to be updating. What am I missing?? Any hint? As you can guess I am not very experienced with osg. Thanks a lot! Cheers, Rubén -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42449#42449 ___ 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] Multipass RTT stage setup?
Hi Conan, On Tue, Sep 6, 2011 at 2:42 PM, Conan Doyle o...@celticblues.com wrote: I am already using the RenderOrderNum, I guess my question is more along the lines of where do I place the cameras in the scenegraph? Should one be the parent of the other, or should they be siblings? Or is that what nesting means, i.e. one a child of the other If you are using RenderOrderNum then you can put all the cameras alongside each other. If you make a render to texture Camera a child of another then that child will get rendered before the parent as long as it's RenderOrder to PRE_RENDER. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Multipass RTT stage setup?
Ok. got it. Thanks, CD robertosfield wrote: Hi Conan, On Tue, Sep 6, 2011 at 2:42 PM, Conan Doyle wrote: I am already using the RenderOrderNum, I guess my question is more along the lines of where do I place the cameras in the scenegraph? Should one be the parent of the other, or should they be siblings? Or is that what nesting means, i.e. one a child of the other If you are using RenderOrderNum then you can put all the cameras alongside each other. If you make a render to texture Camera a child of another then that child will get rendered before the parent as long as it's RenderOrder to PRE_RENDER. Robert. ___ 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=42460#42460 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg-users Digest, Vol 51, Issue 6
Okay, I'm sure I'll have something to submit. Just don't expect it anytime soon. I've got a vacation coming up :) and I want to consider switching to zlib (just to save my game an extra dependency) and figure out a fix for the shaders not loadingand fix whatever other problems I come across... -- Terry Welsh mogumbo 'at' gmail.com www.reallyslick.com Message: 25 Date: Tue, 6 Sep 2011 11:17:01 -0400 From: Jason Beverage jasonbever...@gmail.com To: OpenSceneGraph Users osg-users@lists.openscenegraph.org Subject: Re: [osg-users] tight integration of virtual file system Message-ID: CAMcxSMt=gtyqugofedwsy8y16gavoijqwm_rbewg52+hkjm...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 Hi Terry, On Sun, Sep 4, 2011 at 9:29 PM, Terry Welsh mogu...@gmail.com wrote: Excellent ZipFS plugin Jason. ?Thank you for the help. ?I think that was the hardest part of the problem. ?I finally got around to working on this more and I have the other half of the problem mostly solved. Thanks, glad it worked for you. We don't use it anymore for osgEarth but I think in general it's pretty useful. It looks like OSG uses zlib for all its compression/decompression. Just out of curiosity, how did you pick libzip instead? ?Or did you not write ZipFS? I did write the ZipFS plugin, we chose libzip over just using zlib b/c it had easy access to dealing with zip archives. If zlib itself has something in there that we can use instead of having another dependency that would be great but I didn't really look that hard since libzip worked so well. If you have a submission for the osgEarth that you need integrated just send along the whole modified file or do a pull request on github and I'll take a look at it. Jason To recap, I'm trying to set an OSG_FILE_PATH such as mydirectory/data.zip and load files out of the specified archive. ?At first I discovered the Registry class's FindFileCallback. ?I thought I could just make one of those and have it search inside of zip files. However, the work that I really needed to replace happened when the default Registry::findDataFileImplementation would call osgDB::findFileInPath in FileUtils. ?So I decided to override findFileInPath so that would look for paths containing .zip and try to locate the desired file inside the zip file. That almost worked. ?I also had to modify ReaderWriterZipFS::readFile so that it uses OSG's directory searching. ?At the beginning of the function I added std::string filenameWithPath = osgDB::Registry::instance()-findDataFile(fullFileName, options, CASE_SENSITIVE); and then I use filenameWithPath instead of fullFileName where appropriate. So now I can load almost all my game resources from one .zip file instead of a directory full of files. ?I haven't tested performance yet, but there's no noticeable change. ?.osg files load with all their textures. Here's the catch: .osg files don't get loaded with their shaders. ?I believe this is because shaders don't use the standard OSG plugin loading paradigm. ?Instead they simply use Shader::loadShaderSourceFromFile(). ?I haven't put any thought into this last detail yet (I hope it's not too messy), but I need a programming break -- Terry Welsh mogumbo 'at' gmail.com www.reallyslick.com Message: 9 Date: Fri, 5 Aug 2011 08:50:10 -0400 From: Jason Beverage jasonbever...@gmail.com To: OpenSceneGraph Users osg-users@lists.openscenegraph.org Subject: Re: [osg-users] tight integration of virtual file system Message-ID: ? ? ? ?camcxsmsly2m20aoa5z7tubjob1xyrqqkmnz9z9lslzmmkqu...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 Hi Terry, osgEarth has a generic zip based plugin called ZipFS that is implemented as an osgDB plugin and isn't dependent on osgEarth. ?We originally developed it to support using a zip file of imagery tiles for a cache. It allows you to load files like: osgDB::readNodeFile(c:/data/models.zip/cow.osg); I haven't used it for quite awhile but last I checked it was working just fine. ?You can get the osgearth source code from github at https://github.com/gwaldron/osgearth If anything it could be a start to what you're looking for. Thanks, Jason ___ 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] In readNode, find the parent node that will be merged into
Hi, I'm working on a feature that requires modifying a scene graph after it's been loaded, including those that may be loaded from the DatabasePager. Unfortunately the process depends on any ancestor transforms that may be present in the graph that the node may be merged into. I've looked (at some length) at both a ReadFileCallback and pseudo-loader plugin as implementation options, however neither appears to provide any way of 'seeing' whether a readNode request comes from the DatabasePager or elsewhere, and if it does, where it will end up in the rendered scene graph. Am I missing something obvious that would help in this situation? Otherwise I may look at modifying OSG to pass a reference to the parent node in the ReaderWriter Options or something similar. Thanks! Craig Bosma ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] In readNode, find the parent node that will be merged into
On 9/6/2011 12:33 PM, Craig S. Bosma wrote: Hi, I'm working on a feature that requires modifying a scene graph after it's been loaded, including those that may be loaded from the DatabasePager. Unfortunately the process depends on any ancestor transforms that may be present in the graph that the node may be merged into. I've looked (at some length) at both a ReadFileCallback and pseudo-loader plugin as implementation options, however neither appears to provide any way of 'seeing' whether a readNode request comes from the DatabasePager or elsewhere, and if it does, where it will end up in the rendered scene graph. Am I missing something obvious that would help in this situation? Otherwise I may look at modifying OSG to pass a reference to the parent node in the ReaderWriter Options or something similar. You could attach the parent node address (or the full NodePath for that matter) as UserData to your ReadFileCallback instance. -Paul ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [build] How to get a simple OSG example on iOS
Hi, Am 06.09.11 14:56, schrieb Tobias Weißhaar: Can anyone explain how i get a simple OSG example on the iPhone with the git repository? Do the three examples inside the xcode-project work? cheers, Stephan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] In readNode, find the parent node that will be merged into
Thanks Paul, That's a helpful suggestion, but wouldn't it still require the DatabasePager to be modified to also stash the parent node/nodepath in the read node's UserData, since the callback won't know when a read comes from the pager? Craig On Sep 6, 2011, at 1:57 PM, Paul Martz wrote: On 9/6/2011 12:33 PM, Craig S. Bosma wrote: Hi, I'm working on a feature that requires modifying a scene graph after it's been loaded, including those that may be loaded from the DatabasePager. Unfortunately the process depends on any ancestor transforms that may be present in the graph that the node may be merged into. I've looked (at some length) at both a ReadFileCallback and pseudo-loader plugin as implementation options, however neither appears to provide any way of 'seeing' whether a readNode request comes from the DatabasePager or elsewhere, and if it does, where it will end up in the rendered scene graph. Am I missing something obvious that would help in this situation? Otherwise I may look at modifying OSG to pass a reference to the parent node in the ReaderWriter Options or something similar. You could attach the parent node address (or the full NodePath for that matter) as UserData to your ReadFileCallback instance. -Paul ___ 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