Re: [osg-users] why dynamic modification are so difficult?
Hi JP, it's impossible to show exactly my code, but what I basically do with the geode is: 1. Remove all drawables: geode-removeDrawables((unsigned int)0, geode-getNumDrawables()); 2. Create new ones: osg::ref_ptr osg::Geometry geom; geom = createGeom(parameters); .. 3. Add them to the geode: if( geom.valid() ) geode-addDrawable( geom.get() ); I'm not sure the problem is there, because as I mentioned the new scene is properly shown if I load it with osgViewer.exe. I think the problem is more with some missing settings, either to the drawables/nodes, or to the viewer (the original one, which doesn't get updated). I tried to set the drawables data variance to DYNAMIC, and other things but nothing worked. However, as Robert said, it seems this should work without any additional action. The strange thing is, why the old drawables are properly deleted from the original viewer, but the new ones are not added? I would have preferred that the viewer didn't do anything, than just 1 part of the job. Thank you all for your prompt replies, I really appreciate it. Fausto On Fri, Jan 22, 2010 at 7:55 AM, J.P. Delport jpdelp...@csir.co.za wrote: Hi, can you give more detail on what you are adding/removing? Do you use the same vertex lists, but with new drawables. Do you change vertices, but keep the drawables? To get more help you'd probably need to make a very small example that shows the problem... jp fausto wrote: Thank you both for your inputs. To Robert: Try writing the subgraph they are in out to a file then load this file into osgviewer to see if can view them. Yes, as I mentioned the new scene data is OK, I can see it while debugging and after saving-loading it with osgViewer.exe all new drawables appear in the scene, and previous ones are removed. So, the scene is OK, the problem is really with the original viewer. It renders OK, but doesn't update properly when drawables are added. I'm rendering in Qt widgets, could that be the problem? To D.J. I might recommend refactoring the code to add/remove nodes instead of drawables. Unfortunately, I need nodes to be the same. I keep searching and testing. Thanks again for your help. Cheers. Fausto On Thu, Jan 21, 2010 at 6:42 PM, D.J. Caldwell dlcaldwel...@gmail.commailto: dlcaldwel...@gmail.com wrote: Hi Fausto and Robert, If the simple modification is due to some specific user event (button press, file dialog, etc.), I might recommend refactoring the code to add/remove nodes instead of drawables. It sounds like you have no trouble initially getting the geometry into the scene; it is the simple modification that is the problem. What I am suggesting here is a work-around, and not a fix (on my system, it appears that there is no bug to fix). Other than this, I believe the issue may be familiarity with the available patterns; that is, using the right tool for the right job. No insult intended, but the only fix for that is research, time, and patience. The project I am part of uses visitors and/or swapping out vertices for time based changes, and adding/removing nodes for user based inputs. Fausto, as Robert said, you are the only one who can know what is appropriate for your project. Just some things to consider; I hope this helps... D.J. On Thu, Jan 21, 2010 at 12:12 PM, Robert Osfield robert.osfi...@gmail.com mailto:robert.osfi...@gmail.com wrote: Hi Fausto, Dynamically modifying the scene graph shouldn't be that hard. Removing drawables and adding news ones should perfect safe and shouldn't require and extra steps from you, no need to dirty bounding volumes or display lists, it should all just work. As to why your new drawables aren't appearing I can't say. Try writing the subgraph they are in out to a file then load this file into osgviewer to see if can view them. It could be simply that there is something wrong with the geometry data you've set up. Only you has your app and your data so you're the only one that can investigate. Robert. On Thu, Jan 21, 2010 at 4:41 PM, fausto f4us...@gmail.com mailto:f4us...@gmail.com wrote: Hi All, I'm struggling to have a simple modification of an osg scene working. I simply need to remove all drawables from a geode and add new drawables to the same geode. In the viewer, the geode just disappears after removing the drawables, but I can see that the scene contains the geode with the new drawables. So, it seems a rendering problem. I see that many people have similar problems with dynamic modifications. I've read plenty of posts about setting display list to false, using callbacks, dirtyBound(), etc But I hope there is a clearer and easier way to achieve this.
Re: [osg-users] Saving Screenshot
Hi, try attach before frame. I'm not sure why you want to call frame yourself, is this part of a larger app? jp Danny Lesnik wrote: Hi, I tried the following code Code: osg::ref_ptrosg::Image shot = new osg::Image(); shot-allocateImage(640, 480, 24, GL_RGB, GL_UNSIGNED_BYTE); osg::ref_ptrosg::Camera camera = _viewer-getCamera(); _viewer-frame(); camera-attach(osg::Camera::COLOR_BUFFER, shot.get()); osgDB::writeImageFile(*shot, test.png ); but still black image. How can I solve the issue. Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=23033#23033 ___ 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. MailScanner thanks Transtec Computers for their support. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] why dynamic modification are so difficult?
Hi, fausto wrote: Hi JP, it's impossible to show exactly my code, but what I basically do with the geode is: 1. Remove all drawables: geode-removeDrawables((unsigned int)0, geode-getNumDrawables()); 2. Create new ones: osg::ref_ptr osg::Geometry geom; geom = createGeom(parameters); .. 3. Add them to the geode: if( geom.valid() ) geode-addDrawable( geom.get() ); I don't see anything strange. Does createGeom reuse any old osg data (arrays)? where in your frame loop do you do this? In between rendering calls (frame)? What happens if you just delete the geode and add a new one? jp I'm not sure the problem is there, because as I mentioned the new scene is properly shown if I load it with osgViewer.exe. I think the problem is more with some missing settings, either to the drawables/nodes, or to the viewer (the original one, which doesn't get updated). I tried to set the drawables data variance to DYNAMIC, and other things but nothing worked. However, as Robert said, it seems this should work without any additional action. The strange thing is, why the old drawables are properly deleted from the original viewer, but the new ones are not added? I would have preferred that the viewer didn't do anything, than just 1 part of the job. Thank you all for your prompt replies, I really appreciate it. Fausto On Fri, Jan 22, 2010 at 7:55 AM, J.P. Delport jpdelp...@csir.co.za mailto:jpdelp...@csir.co.za wrote: Hi, can you give more detail on what you are adding/removing? Do you use the same vertex lists, but with new drawables. Do you change vertices, but keep the drawables? To get more help you'd probably need to make a very small example that shows the problem... jp fausto wrote: Thank you both for your inputs. To Robert: Try writing the subgraph they are in out to a file then load this file into osgviewer to see if can view them. Yes, as I mentioned the new scene data is OK, I can see it while debugging and after saving-loading it with osgViewer.exe all new drawables appear in the scene, and previous ones are removed. So, the scene is OK, the problem is really with the original viewer. It renders OK, but doesn't update properly when drawables are added. I'm rendering in Qt widgets, could that be the problem? To D.J. I might recommend refactoring the code to add/remove nodes instead of drawables. Unfortunately, I need nodes to be the same. I keep searching and testing. Thanks again for your help. Cheers. Fausto On Thu, Jan 21, 2010 at 6:42 PM, D.J. Caldwell dlcaldwel...@gmail.com mailto:dlcaldwel...@gmail.com mailto:dlcaldwel...@gmail.com mailto:dlcaldwel...@gmail.com wrote: Hi Fausto and Robert, If the simple modification is due to some specific user event (button press, file dialog, etc.), I might recommend refactoring the code to add/remove nodes instead of drawables. It sounds like you have no trouble initially getting the geometry into the scene; it is the simple modification that is the problem. What I am suggesting here is a work-around, and not a fix (on my system, it appears that there is no bug to fix). Other than this, I believe the issue may be familiarity with the available patterns; that is, using the right tool for the right job. No insult intended, but the only fix for that is research, time, and patience. The project I am part of uses visitors and/or swapping out vertices for time based changes, and adding/removing nodes for user based inputs. Fausto, as Robert said, you are the only one who can know what is appropriate for your project. Just some things to consider; I hope this helps... D.J. On Thu, Jan 21, 2010 at 12:12 PM, Robert Osfield robert.osfi...@gmail.com mailto:robert.osfi...@gmail.com mailto:robert.osfi...@gmail.com mailto:robert.osfi...@gmail.com wrote: Hi Fausto, Dynamically modifying the scene graph shouldn't be that hard. Removing drawables and adding news ones should perfect safe and shouldn't require and extra steps from you, no need to dirty bounding volumes or display lists, it should all just work. As to why your new drawables aren't appearing I can't say. Try writing the subgraph they are in out to a file then load this file into osgviewer to see if can view them. It could be simply that there
Re: [osg-users] why dynamic modification are so difficult?
Hi JP, Does createGeom reuse any old osg data (arrays)? No. where in your frame loop do you do this? Well, now that you tell me, I think the problem is here. I have no loop. I thought that the rendering refresh was done automatically when a node in the scene was modified. Sorry for my ignorance, this might seem stupid, but since I have very few dynamic modifications in my scene, how can I simply refresh the viewer frame without being obliged to have a loop. I've tried to call viewer-frame() when I know that the scene has been modified, but nothing appears now in the viewer. Cheers. Fausto On Fri, Jan 22, 2010 at 9:44 AM, J.P. Delport jpdelp...@csir.co.za wrote: Hi, fausto wrote: Hi JP, it's impossible to show exactly my code, but what I basically do with the geode is: 1. Remove all drawables: geode-removeDrawables((unsigned int)0, geode-getNumDrawables()); 2. Create new ones: osg::ref_ptr osg::Geometry geom; geom = createGeom(parameters); .. 3. Add them to the geode: if( geom.valid() ) geode-addDrawable( geom.get() ); I don't see anything strange. Does createGeom reuse any old osg data (arrays)? where in your frame loop do you do this? In between rendering calls (frame)? What happens if you just delete the geode and add a new one? jp I'm not sure the problem is there, because as I mentioned the new scene is properly shown if I load it with osgViewer.exe. I think the problem is more with some missing settings, either to the drawables/nodes, or to the viewer (the original one, which doesn't get updated). I tried to set the drawables data variance to DYNAMIC, and other things but nothing worked. However, as Robert said, it seems this should work without any additional action. The strange thing is, why the old drawables are properly deleted from the original viewer, but the new ones are not added? I would have preferred that the viewer didn't do anything, than just 1 part of the job. Thank you all for your prompt replies, I really appreciate it. Fausto On Fri, Jan 22, 2010 at 7:55 AM, J.P. Delport jpdelp...@csir.co.zamailto: jpdelp...@csir.co.za wrote: Hi, can you give more detail on what you are adding/removing? Do you use the same vertex lists, but with new drawables. Do you change vertices, but keep the drawables? To get more help you'd probably need to make a very small example that shows the problem... jp fausto wrote: Thank you both for your inputs. To Robert: Try writing the subgraph they are in out to a file then load this file into osgviewer to see if can view them. Yes, as I mentioned the new scene data is OK, I can see it while debugging and after saving-loading it with osgViewer.exe all new drawables appear in the scene, and previous ones are removed. So, the scene is OK, the problem is really with the original viewer. It renders OK, but doesn't update properly when drawables are added. I'm rendering in Qt widgets, could that be the problem? To D.J. I might recommend refactoring the code to add/remove nodes instead of drawables. Unfortunately, I need nodes to be the same. I keep searching and testing. Thanks again for your help. Cheers. Fausto On Thu, Jan 21, 2010 at 6:42 PM, D.J. Caldwell dlcaldwel...@gmail.com mailto:dlcaldwel...@gmail.com mailto:dlcaldwel...@gmail.com mailto:dlcaldwel...@gmail.com wrote: Hi Fausto and Robert, If the simple modification is due to some specific user event (button press, file dialog, etc.), I might recommend refactoring the code to add/remove nodes instead of drawables. It sounds like you have no trouble initially getting the geometry into the scene; it is the simple modification that is the problem. What I am suggesting here is a work-around, and not a fix (on my system, it appears that there is no bug to fix). Other than this, I believe the issue may be familiarity with the available patterns; that is, using the right tool for the right job. No insult intended, but the only fix for that is research, time, and patience. The project I am part of uses visitors and/or swapping out vertices for time based changes, and adding/removing nodes for user based inputs. Fausto, as Robert said, you are the only one who can know what is appropriate for your project. Just some things to consider; I hope this helps... D.J. On Thu, Jan 21, 2010 at 12:12 PM, Robert Osfield robert.osfi...@gmail.com mailto:robert.osfi...@gmail.com mailto:robert.osfi...@gmail.com
Re: [osg-users] why dynamic modification are so difficult?
No, may be the problem is not there yet, unless I miss something. Never mind the following, I've been able to make it appear. I've tried to call viewer-frame() when I know that the scene has been modified, but nothing appears now in the viewer. However the problem is still the same, even when I call viewer-frame() after having removed/added drawables from the geode. The new drawables don't appear in the viewer, while the old ones have properly disappeared. Fausto On Fri, Jan 22, 2010 at 10:25 AM, fausto f4us...@gmail.com wrote: Hi JP, Does createGeom reuse any old osg data (arrays)? No. where in your frame loop do you do this? Well, now that you tell me, I think the problem is here. I have no loop. I thought that the rendering refresh was done automatically when a node in the scene was modified. Sorry for my ignorance, this might seem stupid, but since I have very few dynamic modifications in my scene, how can I simply refresh the viewer frame without being obliged to have a loop. I've tried to call viewer-frame() when I know that the scene has been modified, but nothing appears now in the viewer. Cheers. Fausto On Fri, Jan 22, 2010 at 9:44 AM, J.P. Delport jpdelp...@csir.co.zawrote: Hi, fausto wrote: Hi JP, it's impossible to show exactly my code, but what I basically do with the geode is: 1. Remove all drawables: geode-removeDrawables((unsigned int)0, geode-getNumDrawables()); 2. Create new ones: osg::ref_ptr osg::Geometry geom; geom = createGeom(parameters); .. 3. Add them to the geode: if( geom.valid() ) geode-addDrawable( geom.get() ); I don't see anything strange. Does createGeom reuse any old osg data (arrays)? where in your frame loop do you do this? In between rendering calls (frame)? What happens if you just delete the geode and add a new one? jp I'm not sure the problem is there, because as I mentioned the new scene is properly shown if I load it with osgViewer.exe. I think the problem is more with some missing settings, either to the drawables/nodes, or to the viewer (the original one, which doesn't get updated). I tried to set the drawables data variance to DYNAMIC, and other things but nothing worked. However, as Robert said, it seems this should work without any additional action. The strange thing is, why the old drawables are properly deleted from the original viewer, but the new ones are not added? I would have preferred that the viewer didn't do anything, than just 1 part of the job. Thank you all for your prompt replies, I really appreciate it. Fausto On Fri, Jan 22, 2010 at 7:55 AM, J.P. Delport jpdelp...@csir.co.zamailto: jpdelp...@csir.co.za wrote: Hi, can you give more detail on what you are adding/removing? Do you use the same vertex lists, but with new drawables. Do you change vertices, but keep the drawables? To get more help you'd probably need to make a very small example that shows the problem... jp fausto wrote: Thank you both for your inputs. To Robert: Try writing the subgraph they are in out to a file then load this file into osgviewer to see if can view them. Yes, as I mentioned the new scene data is OK, I can see it while debugging and after saving-loading it with osgViewer.exe all new drawables appear in the scene, and previous ones are removed. So, the scene is OK, the problem is really with the original viewer. It renders OK, but doesn't update properly when drawables are added. I'm rendering in Qt widgets, could that be the problem? To D.J. I might recommend refactoring the code to add/remove nodes instead of drawables. Unfortunately, I need nodes to be the same. I keep searching and testing. Thanks again for your help. Cheers. Fausto On Thu, Jan 21, 2010 at 6:42 PM, D.J. Caldwell dlcaldwel...@gmail.com mailto:dlcaldwel...@gmail.com mailto:dlcaldwel...@gmail.com mailto:dlcaldwel...@gmail.com wrote: Hi Fausto and Robert, If the simple modification is due to some specific user event (button press, file dialog, etc.), I might recommend refactoring the code to add/remove nodes instead of drawables. It sounds like you have no trouble initially getting the geometry into the scene; it is the simple modification that is the problem. What I am suggesting here is a work-around, and not a fix (on my system, it appears that there is no bug to fix). Other than this, I believe the issue may be familiarity with the available patterns; that is, using the right tool for the right job. No insult intended, but the only fix for that is research, time, and patience. The
Re: [osg-users] Blur while moving/turning
Hi Dat, On Thu, Jan 21, 2010 at 9:39 PM, Nguyen Tien Dat tienda...@gmail.com wrote: I'm using OpenSceneGraph 2.8.2 with C++, and notice that when I move or turn (by updating the camera position or orientation), the edges of objects are blur. I don't like that effect and would like to disable it. Could anybody tell me how? This effect has nothing to do with the OSG, but the physical characteristics of your monitor. LCD's especially older ones have a low response rate to changes in intensity which doesn't cause any problems until the image starts moving quickly. CRT's and modern LCD with low response time don't suffer from this issue so much. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG on OMAP3 (Beagleboard)
Hi David, I believe the shaders are actually compiliant with GLES 2.0, but the drivers you have add they own restrictions. Could you send me the modified files so I can review them with a view to merging them in some form. Cheers, Robert. On Thu, Jan 21, 2010 at 8:37 PM, picoflamingo picoflami...@papermint-designs.com wrote: Hello, Not sure if this has been reported so far (I couldn't find anything in the mailing list archive). I have been trying to run OSG 2.9.6 in a BeagleBoard (OpenGL ES 2.0) with partial success. Just after compiling, when running osgviewer, I got a window with the classical OSG blue background but nothing was rendered. Looking at the log, I found that the vertex and fragment shaders compilation failed. The main problem is that the OpenGL ES 2.0 library for the BeagleBoard expects a precision qualifier for every single declaration. This doesn't happen in the Imagination emulator, so it has to be tried in the real HW (AFAIK). I modified the ShaderGen.cpp file to include the missing qualifiers (I just prepend highp to every single vec and mat declaration, including attributes, uniforms and varyings). I also modify State.cpp to add the qualifier to the different Uniforms, but I'm not sure if that had some effect. Finally, I just override the ShaderGen.cpp to produce a simple vertex/fragment shader-pair just to check that it can render something, and that worked for simple color objects (no material, no texture,...). I could render the axis.osg and glider.osg models. I do not know enough about OSG internals to produce a proper patch for this, so hope that this information could help to make OSG work in the BeagleBoard (and probably in other OMAP3 platforms -OpenPandora, N900,..-) in the next stable release. If I can help in any way (as tester for instance), please just let me know. I was using the OSG 2.9.6 tarball, not the svn version, so if this is already fixed, please ignore this message. Many thanks. david -- picoFlamingo Project: http://community.papermint-designs.com/ ___ 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] Saving Screenshot
you have to render the scene first then save the image. Have a look at osgprerender examples. Mimic the code and save the image from the Camera DrawCallback Nick http://www.linkedin.com/in/tnick On Fri, Jan 22, 2010 at 3:27 AM, Danny Lesnik danny...@walla.co.il wrote: Hi, I tried the following code Code: osg::ref_ptrosg::Image shot = new osg::Image(); shot-allocateImage(640, 480, 24, GL_RGB, GL_UNSIGNED_BYTE); osg::ref_ptrosg::Camera camera = _viewer-getCamera(); _viewer-frame(); camera-attach(osg::Camera::COLOR_BUFFER, shot.get()); osgDB::writeImageFile(*shot, test.png ); but still black image. How can I solve the issue. Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=23033#23033 ___ 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] dependancies with Visual2005 SP2
Hi jean-sebastien thank you for your answer My mistake, I use visual 2005 sorry. It seems that no SP2 exists, you are right again. I saw version 2.0.50727 SP2 in the visual2005 about box. But I guess it is the .Net Framework version ... sorry again ! Anyway, that does not explain my problem. If I take the binaries for VC8 SP1 in debug mode (openscenegraph-all-2.8.2-win32-x86-vc80sp1-Debug.zip), I still have the (0xc0150002) error message. All my dll (osg and 3rd party (zlib) dependancies) are copied into the same directory as my exe, into the debug directory. As you said, I tried Dependancy walker on my app , here is the log result : Error: The Side-by-Side configuration information for ...\sources\visualapp\debug\OSG55-OSGD.DLL contains errors. Cette application n'a pas pu dmarrer car la configuration de l'application est incorrecte. Rinstaller l'application pourrait rsoudre ce problme (14001). Error: The Side-by-Side configuration information for ...\sources\visualapp\debug\OT11-OPENTHREADSD.DLL contains errors. Cette application n'a pas pu dmarrer car la configuration de l'application est incorrecte. Rinstaller l'application pourrait rsoudre ce problme (14001). Error: The Side-by-Side configuration information for ...\sources\visualapp\debug\OSG55-OSGDBD.DLL contains errors. Cette application n'a pas pu dmarrer car la configuration de l'application est incorrecte. Rinstaller l'application pourrait rsoudre ce problme (14001). Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module. I really do not understand ... Are these dll do not correspond with my version of visual ? But if I compile all osg (like I said before) that works with the new binaries... Sebastien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=23052#23052 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Saving Screenshot
Hi, This is activeX control and inside the contol I have a method which prints screenshot. This is how I do initiate control AND all OSG instances: Code: int ViewerCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (COleControl::OnCreate(lpCreateStruct) == -1) return -1; RECT rect; GetWindowRect(rect); WCHAR str[255]; swprintf(str, L(%d,%d) - (%d,%d), rect.left,rect.top,rect.right,rect.bottom); // Set window traits and gc _traits = new osg::GraphicsContext::Traits; osg::ref_ptrosg::Referenced windata = new osgViewer::GraphicsWindowWin32::WindowData( GetSafeHwnd() ); _traits-x = 0; _traits-y = 0; _traits-width = rect.right - rect.left; _traits-height = rect.bottom - rect.top; _traits-windowDecoration = false; _traits-doubleBuffer = true; _traits-sharedContext = 0; _traits-setInheritedWindowPixelFormat = true; _traits-inheritedWindowData = windata; _gc = osg::GraphicsContext::createGraphicsContext( _traits.get() ); _gc-setClearColor( osg::Vec4f(0.2f, 0.2f, 0.6f, 1.0f) ); _gc-setClearMask( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); // Create camera osg::ref_ptrosg::Camera camera = new osg::Camera; camera-setGraphicsContext(_gc); camera-setViewport( new osg::Viewport(_traits-x, _traits-y, _traits-width, _traits-height) ); camera-setProjectionMatrixAsPerspective( 30.0f, (double)_traits-width/(double)_traits-height, 1.0f, 1.0f ); camera-setClearMask( GL_DEPTH_BUFFER_BIT ); // Create viewer _viewer = new osgViewer::Viewer; _viewer-setThreadingModel( osgViewer::Viewer::SingleThreaded ); _viewer-setCamera( camera.get() ); _viewer-setCameraManipulator( new osgGA::TrackballManipulator ); // Set root node of the scene _root = new osg::Group; _viewer-setSceneData( _root.get() ); _viewer-realize(); WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, CRect(01, 1, 50, 50), this, 1000); // Create a thread for the simulation loop _beginthread(RenderThread, 0, _viewer); return 0; } and this is how do I take screenshot: Code: VARIANT_BOOL ViewerCtrl::SaveScreenshot(LPCTSTR name) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); CW2A tmpStr(name); osg::ref_ptrosg::Image shot = new osg::Image(); shot-allocateImage(640, 480, 24, GL_RGB, GL_UNSIGNED_BYTE); osg::ref_ptrosg::Camera camera = _viewer-getCamera(); _viewer-frame(); camera-attach(osg::Camera::COLOR_BUFFER, shot.get()); osgDB::writeImageFile(*shot, test.png ); //osgViewer::ScreenCaptureHandler* scrn = new osgViewer::ScreenCaptureHandler(); //osgViewer::ScreenCaptureHandler::WriteToFile* captureOper = new osgViewer::ScreenCaptureHandler::WriteToFile(tmpStr.m_szBuffer, png); //scrn-setCaptureOperation(capt()ureOper); //scrn-captureNextFrame(*_viewer); //_viewer-frame(); return VARIANT_TRUE; } so any clue or suggestion is welcomed. Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=23053#23053 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Saving Screenshot
Hi Danny, you have to attach the image first and then draw the frame: osg::ref_ptrosg::Image shot = new osg::Image(); shot-allocateImage(640, 480, 24, GL_RGB, GL_UNSIGNED_BYTE); osg::ref_ptrosg::Camera camera = _viewer-getCamera(); camera-attach(osg::Camera::COLOR_BUFFER, shot.get()); _viewer-frame(); osgDB::writeImageFile(*shot, test.png ); camera-attach(osg::Camera::COLOR_BUFFER, NULL); The image is copied from the frame buffer at the end of the frame() call. regards Ralph Am 22.01.2010 13:30, schrieb Danny Lesnik: Hi, This is activeX control and inside the contol I have a method which prints screenshot. This is how I do initiate control AND all OSG instances: Code: int ViewerCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (COleControl::OnCreate(lpCreateStruct) == -1) return -1; RECT rect; GetWindowRect(rect); WCHAR str[255]; swprintf(str, L(%d,%d) - (%d,%d), rect.left,rect.top,rect.right,rect.bottom); // Set window traits and gc _traits = new osg::GraphicsContext::Traits; osg::ref_ptrosg::Referenced windata = new osgViewer::GraphicsWindowWin32::WindowData( GetSafeHwnd() ); _traits-x = 0; _traits-y = 0; _traits-width = rect.right - rect.left; _traits-height = rect.bottom - rect.top; _traits-windowDecoration = false; _traits-doubleBuffer = true; _traits-sharedContext = 0; _traits-setInheritedWindowPixelFormat = true; _traits-inheritedWindowData = windata; _gc = osg::GraphicsContext::createGraphicsContext( _traits.get() ); _gc-setClearColor( osg::Vec4f(0.2f, 0.2f, 0.6f, 1.0f) ); _gc-setClearMask( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); // Create camera osg::ref_ptrosg::Camera camera = new osg::Camera; camera-setGraphicsContext(_gc); camera-setViewport( new osg::Viewport(_traits-x, _traits-y, _traits-width, _traits-height) ); camera-setProjectionMatrixAsPerspective( 30.0f, (double)_traits-width/(double)_traits-height, 1.0f, 1.0f ); camera-setClearMask( GL_DEPTH_BUFFER_BIT ); // Create viewer _viewer = new osgViewer::Viewer; _viewer-setThreadingModel( osgViewer::Viewer::SingleThreaded ); _viewer-setCamera( camera.get() ); _viewer-setCameraManipulator( new osgGA::TrackballManipulator ); // Set root node of the scene _root = new osg::Group; _viewer-setSceneData( _root.get() ); _viewer-realize(); WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, CRect(01, 1, 50, 50), this, 1000); // Create a thread for the simulation loop _beginthread(RenderThread, 0, _viewer); return 0; } and this is how do I take screenshot: Code: VARIANT_BOOL ViewerCtrl::SaveScreenshot(LPCTSTR name) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); CW2A tmpStr(name); osg::ref_ptrosg::Image shot = new osg::Image(); shot-allocateImage(640, 480, 24, GL_RGB, GL_UNSIGNED_BYTE); osg::ref_ptrosg::Camera camera = _viewer-getCamera(); _viewer-frame(); camera-attach(osg::Camera::COLOR_BUFFER, shot.get()); osgDB::writeImageFile(*shot, test.png ); //osgViewer::ScreenCaptureHandler* scrn = new osgViewer::ScreenCaptureHandler(); //osgViewer::ScreenCaptureHandler::WriteToFile* captureOper = new osgViewer::ScreenCaptureHandler::WriteToFile(tmpStr.m_szBuffer, png); //scrn-setCaptureOperation(capt()ureOper); //scrn-captureNextFrame(*_viewer); //_viewer-frame(); return VARIANT_TRUE; } so any clue or suggestion is welcomed. Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=23053#23053 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] OSG_PLUGIN_EXTENSION not being set in Xcode for the Db, current svn
Hello All: I am trying the latest SVN and when running some debug I see things like: FindFileInPath() : trying /Developer/qt/lib/osgPlugins-2.9.7/osgdb_freetypeOSG_PLUGIN_EXTENSION I did some digging and it looks like the OSG_PLUGIN_EXTENSION is not getting set in the Xcode project? Not sure if that is where it is suppose to be defined. Take care Garrett Potts ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG_PLUGIN_EXTENSION not being set in Xcode for the Db, current svn
HI Garrett, This problem will be fallout from a fix for Mingw's freetype header location. I've just reverted this change as it obviously cause more pain than gain. Robert. On Fri, Jan 22, 2010 at 3:04 PM, Garrett Potts po...@cfl.rr.com wrote: Hello All: I am trying the latest SVN and when running some debug I see things like: FindFileInPath() : trying /Developer/qt/lib/osgPlugins-2.9.7/osgdb_freetypeOSG_PLUGIN_EXTENSION I did some digging and it looks like the OSG_PLUGIN_EXTENSION is not getting set in the Xcode project? Not sure if that is where it is suppose to be defined. Take care Garrett Potts ___ 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] OSG_PLUGIN_EXTENSION not being set in Xcode for the Db, current svn
Hi Robert, This problem will be fallout from a fix for Mingw's freetype header location. I've just reverted this change as it obviously cause more pain than gain. Totally agree. If I have some time I'll see if I can find another fix, and post it to osg-users first for others to test. But for now I'm happy making a symlink. 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] Database Pager stall reading in VPB database
Hi, I'm currently using OSG 2 8 2. I'm having a problem with the Database Pager. It seems to stall out and never comes back when I perform a certain use case in my app. I was able to reproduce using a smaller sample app, which I provide the code for below. The use case needed to reproduce the problem in the sample app is as follows: (Sorry for the silly use case, but it is the best I could come up with) 1. Zoom in/out to ensure that paging is happening correctly. 2. Hold down the '1' key to repeatedly reload the root of the LOD database. I am using the database located at LOD_DB_HERE* 3. While holding '1', zoom in and out with the mouse for a certain amount of time (10 seconds or so) 4. Release everything and check to see if things are paging in and out. 5. Repeat if necessary. I'm usually able to get the Pager to stall after repeating the above 3-4 times. I checked the stats one time and there were 12 requests being reported, without changing. I hope this is sufficient in describing my problem. Please let me know if you need more information The code for the sample app: (Please email me for the code at jesse dot stimpson at gmail dot com . I wasn't able to post it on the board for some reason) *Note: I wasn't able to post the URL because I don't have enough posts, but it is hosted on the OpenSceneGraph website at earth_bayeara Thank you! Best, Jesse -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=23062#23062 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Database Pager stall reading in VPB database
Hi, Sorry for the weird formatting and missing information. I was fighting with the message board to be allowed to post URLs and whatnot. I'll be available to clear anything up, though. Thanks, Jesse -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=23063#23063 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] OpenThreads/Config current settings causes crashes under Snow Leopard
Hello All: I wanted to repost this under a different thread name. This current code causes OpenThreads Atomic operations to be compiled in a way that causes crashes. The current code looks like: #define _OPENTHREADS_ATOMIC_USE_MUTEX #if defined(MAC_OS_X_VERSION_10_5) #if MAC_OS_X_VERSION_MIN_REQUIRED = MAC_OS_X_VERSION_10_5 #define _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC #undef _OPENTHREADS_ATOMIC_USE_MUTEX #endif #endif I was wondering if we could modify the Config file to not automatically select on MAC's. For when I set the deployment to 10.5 any Qt gui I created would crash when accessing any of the referenced pointers. When I manually #if 0 the MAC out and had the OpenThreads use the builtin mutex everything ran fine. I was wondering if we just do the following: #define _OPENTHREADS_ATOMIC_USE_MUTEX /* #undef _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC */ /* #undef _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS */ /* #undef _OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS */ /* #undef _OPENTHREADS_ATOMIC_USE_SUN */ /* #undef _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED */ /* #undef _OPENTHREADS_ATOMIC_USE_MUTEX */ Just add the _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC as something that could be uncommented by the user to allow one to do custom setup of a different atomic operation. Take care Garrett Potts ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] 转发:Combine the OSG and OpenGL
Hi, I have been learning the OSG for two months.As the need of my project,I would like to combine the OSG and OpenGL in MFC.In my programme,using the OpenGL draws the background(such as Terrain) in the main thread and the OSG draws the surface features(such as buildings) in the sub thread.When I run my programme,I found the result is normal in the first frame,however,from the second frame,It can't clear the window and leaves the traces of the previous frame.I know that It can be implemented by using the preDrawCallback,but the method does not meet the requirement drawing the background in the main thread.I have no idea how to do it.Do you have a solution to realize this situation? Please help me. Thank you! Best, xulie___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] PagedLOD DatabasePager crash
Hi Robert, Just tested out your changes, the new methods get called and it seems to fix the crash, looks good to me. Thanks! Jason On Fri, Jan 22, 2010 at 12:40 PM, Robert Osfield robert.osfi...@gmail.comwrote: Hi Jason, I've reviewed your change and while it will prevent this particular crash it will add an overhead that needn't be introduced. I've made a provision change to DatabasePager::RequestQueue to add a destructor and a DatabaseRequest::valid() flag and a DatabaseRequest::invalidate() that the RequestQueue calls for all it's active DatabaseRequest that it owns. This mechanism should invalidate the DatabaseRequests that are still attached to the scene graph and prevent them from being used later. Using the example I was unable to reproduce a crash, but I was able to get the new methods to invoke. Could you please try the attached DatabasePager and DatabasePager.cpp. In your example it'd also be worth adding the following to prevent issues with missing textures on the second view. // disable the unref after apply as we'll be need to re-create the textures from images when the new graphics context // starts up. viewer1-getDatabasePager()-setUnrefImageDataAfterApplyPolicy(true, false); Could you (and others) let me know if my changes fix the crash you are seeing. If it does I'll clean up the changes and get them checked into svn/trunk. Robert. On Thu, Jan 21, 2010 at 5:43 PM, Jason Beverage jasonbever...@gmail.com wrote: Hi all, I can confirm that this issue exists in 2.9.6 as well and believe Colin's assessment is correct. Changing the raw pointer to the RequestQueue in the DatabaseRequest to an observer_ptr and taking a temporary ref when using it fixes the issue. I'm including a full program that you can use to test the issue (based on Brett's program but using ref_ptr instead of raw pointers for the Viewer ;) ) I'll post a fix to osg-submissions shortly. Thanks! Jason #include osgDB/ReadFile #include osgViewer/Viewer #include osgGA/TrackballManipulator int main(int argc, char** argv) { std::string modelPath = http://www.openscenegraph.org/data/earth_bayarea/earth.ive;; // create a scene graph (and keep it around). osg::ref_ptrosg::Node modelNode = osgDB::readNodeFile(modelPath); // create a viewer and set the scene graph data. osg::ref_ptrosgViewer::Viewer viewer = new osgViewer::Viewer(); viewer-setSceneData(modelNode.get()); viewer-setCameraManipulator(new osgGA::TrackballManipulator()); //Render the viewer until it's finished viewer-realize(); while(!viewer-done()) { viewer-frame(); } // Create a new viewer and set the scene graph data to the same data. viewer = new osgViewer::Viewer(); viewer-setCameraManipulator(new osgGA::TrackballManipulator()); viewer-setSceneData(modelNode.get()); //Render until finished viewer-realize(); while(!viewer-done()) { viewer-frame(); } return 0; } On Wed, Jan 20, 2010 at 3:40 PM, Robert Osfield robert.osfi...@gmail.com wrote: Hi Brett, You really should learn to use ref_ptr's, manually deleting ref counting objects is dangerous and only possible Viewer as I haven't put the destructor private to allow one to construct the Viewer on the stack for convenience, not to allow delete... That sermon aside, could you please try your example with svn/trunk or 2.9.6. Thanks, Robert. On Wed, Jan 20, 2010 at 8:25 PM, Brett Wiesner brettwies...@gmail.com wrote: Robert, Here is a sample program that crashes when loading earth.ive the second time. I'm using OSG 2.8.2. Thanks, Brett main() { std::string modelPath = earth.ive; // create a scene graph (and keep it around). osg::ref_ptrosg::Node modelNode = osgDB::readNodeFile(modelPath); // create viewer1 and set the scene graph data. osgViewer::Viewer* viewer1 = new osgViewer::Viewer; viewer1-setUpViewOnSingleScreen(0); viewer1-setSceneData(modelNode.get()); viewer1-setCameraManipulator(new osgGA::TrackballManipulator()); // render a frame viewer1-realize(); while(!viewer1-done()) { viewer1-frame(); } // delete viewer1. delete viewer1; viewer1 = 0; // create viewer2 and set the scene graph data. osgViewer::Viewer* viewer2 = new osgViewer::Viewer; viewer2-setUpViewOnSingleScreen(0); viewer2-setSceneData(modelNode.get()); viewer2-setCameraManipulator(new osgGA::TrackballManipulator()); // render a frame viewer2-realize(); while(!viewer2-done()) { viewer2-frame(); } // check that it has textures. // delete viewer2.
Re: [osg-users] 3-Axis rotation with quat PAT
J.P. Delport wrote: Hi, Thomas Simon wrote: Thanks for your interest and help The wiimotion plus gives 3 around-axis speeds which I transforme into angles the fact is that the pat keep turning around the OSG basic are you manually integrating the angular rates? If so, I'd also suggest looking at quaternions... I agree switching to Quat's is a good idea. You'll also likely need to do a coordinate system conversion to get the kind of motion you want. What is the native coordinate system of the Wiimote? For example (philosophical discussions aside), OSG is typically considered as using the X-right, Y-forward, Z-up convention. Which way do the axes point from the Wiimote? --J ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OpenThreads/Config current settings causes crashes under Snow Leopard
Hello Stephan: I did a min macosx of 10.5 and a sdk target of 10.5 for all libraries and dependencies. I donwloaded the Qt 4.6 and the Cocoa 64 bit version/support. I setup all projects with a 10.5 min and target. The core dump only happened if I created a Qt framework and then linked a qt application to that framework. I then just allocated a Embedded graphics window object and once destroyed it core dumped. Removing the BSD mutex fixed the core dump. This was easily replicated by taking the osgviewerQt example and extact out the adaptor widget as a framework and then just do a simple main that instantiates an embedded graphics window and assigns to an osg::ref_ptr. Then just assing back to 0 and it core dumps everytime. Take care Garrett On Jan 22, 2010, at 2:55 PM, Stephan Huber wrote: Hi Garrett, Am 22.01.10 18:08, schrieb Garrett Potts: Just add the _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC as something that could be uncommented by the user to allow one to do custom setup of a different atomic operation. any chance you are mixing the settings for the deployment targets? (e.g. built osg with 10.4 as deployment target and your app with 10.5 as deployment target? Cheers, 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] PagedLOD DatabasePager crash
Hi Jason, On Fri, Jan 22, 2010 at 6:40 PM, Jason Beverage jasonbever...@gmail.com wrote: Just tested out your changes, the new methods get called and it seems to fix the crash, looks good to me. Thanks for the feedback. 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] OSG on OMAP3 (Beagleboard)
Hi David, Thanks for the file changes, I'll have a look once I'm back at my work machine. W.r.t results from different models, the osgUtil::ShaderGen class that is used to convert fixed function scene graph state into shaders+uniforms is not complete, it only maps a modest range of fixed OpenGL state so not all scene graphs can be mapped correctly. As things stand the way to use OSG+GLES2 is to build your scene graphs with shaders appropriate for you target platform. This does put more onus on you developing the application as there is no fixed function pipeline there as a fallback. Robert. On Fri, Jan 22, 2010 at 8:53 PM, picoflamingo picoflami...@papermint-designs.com wrote: Hi Robert, Please find attached the files I modified (osg/State.cpp and osgUtil/ShaderGen.cpp). I just change the ifs related to my test model that are very simple, just geometry and color/material. With the modification in the attached files I can see the glider.osg without problems, but trying to load some 3DS models with material produces black pixels (almost that is what I think)... I just see the silhouette. I have to force a value for the color in the vertex shader in order to get a grey-shaded model I also include a DEBUG_INFO log (for instance the list of supported extensions could be useful). Hope that could help. Many thanks for looking into this. cheers! david Robert Osfield wrote: Hi David, I believe the shaders are actually compiliant with GLES 2.0, but the drivers you have add they own restrictions. Could you send me the modified files so I can review them with a view to merging them in some form. Cheers, Robert. On Thu, Jan 21, 2010 at 8:37 PM, picoflamingo picoflami...@papermint-designs.com wrote: Hello, Not sure if this has been reported so far (I couldn't find anything in the mailing list archive). I have been trying to run OSG 2.9.6 in a BeagleBoard (OpenGL ES 2.0) with partial success. Just after compiling, when running osgviewer, I got a window with the classical OSG blue background but nothing was rendered. Looking at the log, I found that the vertex and fragment shaders compilation failed. The main problem is that the OpenGL ES 2.0 library for the BeagleBoard expects a precision qualifier for every single declaration. This doesn't happen in the Imagination emulator, so it has to be tried in the real HW (AFAIK). I modified the ShaderGen.cpp file to include the missing qualifiers (I just prepend highp to every single vec and mat declaration, including attributes, uniforms and varyings). I also modify State.cpp to add the qualifier to the different Uniforms, but I'm not sure if that had some effect. Finally, I just override the ShaderGen.cpp to produce a simple vertex/fragment shader-pair just to check that it can render something, and that worked for simple color objects (no material, no texture,...). I could render the axis.osg and glider.osg models. I do not know enough about OSG internals to produce a proper patch for this, so hope that this information could help to make OSG work in the BeagleBoard (and probably in other OMAP3 platforms -OpenPandora, N900,..-) in the next stable release. If I can help in any way (as tester for instance), please just let me know. I was using the OSG 2.9.6 tarball, not the svn version, so if this is already fixed, please ignore this message. Many thanks. david -- picoFlamingo Project: http://community.papermint-designs.com/ ___ 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 RegisterWindowingSystemInterfaceProxy() X11WindowingSystemInterface() GraphicsContext::setWindowingSystemInterface() 0x1ad68 0x40a46b44 CullSettings::readEnvironmentalVariables() DatabasePager::addDatabaseThread() HANDLE_NON_HTTP DatabasePager::addDatabaseThread() HANDLE_ONLY_HTTP CullSettings::readEnvironmentalVariables() CullSettings::readEnvironmentalVariables() CullSettings::readEnvironmentalVariables() CullSettings::readEnvironmentalVariables() CullSettings::readEnvironmentalVariables() itr='/home/root/osg/lib' FindFileInPath() : trying /home/root/osg/lib/osgPlugins-2.9.6/osgdb_3ds.so ... FindFileInPath() : USING /home/root/osg/lib/osgPlugins-2.9.6/osgdb_3ds.so Opened DynamicLibrary osgPlugins-2.9.6/osgdb_3ds.so FindFileInPath(../3D1.3ds): returning ../3D1.3ds NODE TRAVERSAL of 3ds file LIB3DS MESH TRAVERSAL of 3ds file LIB3DS mesh name Font 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 Warning: in 3ds loader: file has no nodes, traversing by meshes instead Final OSG node structure looks like this: Group Geode View::setSceneData() Reusing exisitng scene0x1b2c8
[osg-users] Resizing a window
Hi, I was just wondering what is required when resizing a window. I've done this with Direct3D, and what it does is basically take your front buffer surface and then it stretch blits it to the client area of your window. If you want to avoid distortion when the aspect ration changes, you must, at a minimum, change your perspective matrix to reflect the new aspect ratio. Ideally, you would also change the dimensions of your front/back buffers to exactly match the size of your client area, but this was a bit more complicated as it required resetting the device (which, in turn, requires unloading and re-loading some of your resources, if applicable). Ok, so I haven't yet dealt with this issue in OpenGL. Would it require changing the rendering context, or possibly deleting it and creating a new one? I'm not sure, but I guess that is moot because I'm working with OSG and therefore those details are probably abstracted away to that extent. So I guess I'm just wondering how I could do this with OSG. In this case, I am not having OSG launch the window for me. Instead, I have a Panel control in an already-existing application that I'm using to display the rendered scene. To do this, I am passing the Panel's HWND to a WindowData object, and then assigning that object to the inheritedWindowData member of the Traits object that I use to create the graphics context. It works fine, but the image seems stretched horizontally, so I'd like to be able to fix that. Interestingly, I can't seem to 'fix' the stretching by resizing the Panel, which may be an indication that OSG, or something, is doing the aforementioned adjustments automatically, but in doing so, maintains the original aspect ratio, which as I said, results in a stretched image. Thank you! Cheers, Frank -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=23080#23080 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Resizing a window
Frank Sullivan wrote: Ok, so I haven't yet dealt with this issue in OpenGL. Would it require changing the rendering context, or possibly deleting it and creating a new one? I'm not sure, but I guess that is moot because I'm working with OSG and therefore those details are probably abstracted away to that extent. No need to create a new context just because the window changed size. In OpenGL1/2, just specify a new projection matrix with the new aspect ratio, and set the glViewport to use the new width and height. In OSG, set the projection matrix and viewport through the Camera class. For simple examples in pure OpenGL, see the OpeGL Distilled example code: http://ogld.googlecode.com So I guess I'm just wondering how I could do this with OSG. In this case, I am not having OSG launch the window for me. Instead, I have a Panel control in an already-existing application that I'm using to display the rendered scene. To do this, I am passing the Panel's HWND to a WindowData object, and then assigning that object to the inheritedWindowData member of the Traits object that I use to create the graphics context. It works fine, but the image seems stretched horizontally, so I'd like to be able to fix that. Interestingly, I can't seem to 'fix' the stretching by resizing the Panel, which may be an indication that OSG, or something, is doing the aforementioned adjustments automatically, but in doing so, maintains the original aspect ratio, which as I said, results in a stretched image. Thank you! Cheers, Frank -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=23080#23080 ___ 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] MinGW and OpenSceneGraph
Hi Jean-Sebastien, I checked your comments from this thread http://thread.gmane.org/gmane.comp.graphics.openscenegraph.cvs/6738http://www.google.com/url?sa=Dq=http://thread.gmane.org/gmane.comp.graphics.openscenegraph.cvs/6738usg=AFQjCNEdPuRua1NsIhFWIQJUp0Z18wNTAAand decided to try it out. I noticed that some of the fixes were submitted to the SVN trunk, so first thing I did was a checkout of http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk (rev 10983) Below an overview of my settings (just in case somebody wants to confirm the results) Compiler MinGW (Nuwen 5.0) http://nuwen.net/files/mingw/mingw-5.0.zip $ g++ --version g++.exe (GCC) 4.4.1-nuwen Copyright (C) 2009 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 3rd Party Dependencies == (1) Libtiff (3.4-1) Download: http://sourceforge.net/projects/mingwrep/files/libtiff-devel/3.4-1/libtiff-devel-3.4-1.zip/download (2) Libxml2 (2.7.6) Download: http://xmlsoft.org/sources/win32/libxml2-2.7.6.win32.zip (3) Curl (7.17.1) Download: http://curl.haxx.se/latest.cgi?curl=win32-devel (4) FFmpeg (not official, precompiled mingw binary) http://mingw-w64-dgn.googlecode.com/files/ffmpeg-w32-bin-i686-20100108.7z (5) Qt libraries 4.6.1 for Windows (minGW 4.4, 277 MB) Download: http://qt.nokia.com/downloads/windows-cpp Install: just run the setup and use the default location (C:\Qt\4.6.1) OpenSceneGraph-SVN-r10983-3rdParty.7z (this package includes everything above except the Qt SDK) http://www.multigesture.net/wp-content/plugins/download-monitor/download.php?id=28 CMAKE = Where is the source code: C:/OpenSceneGraphSrc/OpenSceneGraphSVN Where to build the binaries: C:/OpenSceneGraphBuild/OpenSceneGraph-SVN ACTUAL_3DPARTY_DIR: C:/MinGW CMAKE_BUILD_TYPE: Release CMAKE_INSTALL_PREFIX: C:/OpenSceneGraph/OpenSceneGraph-SVN FFMPEG_ROOT: C:/OpenSceneGraphSrc/3rdParty/ffmpeg (after hitting configure it will find all files automatically) SDL_INCLUDE_DIR: C:/MinGW/include/SDL SDL_LIBRARY: C:/MinGW/lib/libSDL.a SDLMAIN:_LIBRARY: C:/MinGW/lib/libSDLmain.a CURL_INCLUDE_DIR: C:/OpenSceneGraphSrc/3rdParty/libcurl-7.17.1/include CURL_LIBRARY: C:/OpenSceneGraphSrc/3rdParty/libcurl-7.17.1/lib/libcurl.a TIFF_INCLUDE_DIR: C:/OpenSceneGraphSrc/3rdParty/libtiff-devel-3.4-1/include TIFF_LIBRARY: C:/OpenSceneGraphSrc/3rdParty/libtiff-devel-3.4-1/lib/libtiff.a LIBXML2_INCLUDE_DIR: C:/OpenSceneGraphSrc/3rdParty/libxml2-2.7.6.win32/include LIBXML2_LIBRARIES: C:/OpenSceneGraphSrc/3rdParty/libxml2-2.7.6.win32/lib/libxml2.lib QT4: This is not so trivial, I don't remember how I got it working. I just filled out a few of the entries with the appropiate values and kept hitting configure. After getting a few messages about Qt3 and Qt4 it found most of the locations automatically. QT_QT_LIBRARY: Didn't know what to put in here, so I kept it empty. Building In MSYS (create a symlink as Jean-Sebastien Guay suggests on the OSG mailinglist): # cd /mingw/include # ln -s freetype2 freetype Change to your build directory and build! # cd /c/C:/OpenSceneGraphBuild/OpenSceneGraph-SVN # make # make install List of issues: === Unlike what Jean-Sebastien Guay reports here http://thread.gmane.org/gmane.comp.graphics.openscenegraph.cvs/6738 I don't have any problems (might already been fixed): osgviewerQT - no issues osgviewerQtWidget - no issues The only application that does not wants to build is osgQtBrowser (error message below) The fix is simple: The missing header files should be here: C:\Qt\4.6.1\include\QtCore Seems like the CMakeList.txt files doesn't include the QTCORE header files. Patch: C:\OpenSceneGraphSrc\OpenSceneGraphSVN\examples\osgQtBrowser\CMakeLists.txt from: INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ) to: INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR}) It should now compile just fine. = [100%] Built target example_osgviewerQtWidget [100%] Generating moc_QGraphicsViewAdapter.cxx Scanning dependencies of target example_osgQtBrowser [100%] Building CXX object examples/osgQtBrowser/CMakeFiles/example_osgQtBrowser .dir/moc_QGraphicsViewAdapter.obj In file included from c:/Qt/4.6.1/include/QtWebKit/qwebelement.h:1, from c:/Qt/4.6.1/include/QtWebKit/QtWebKit:7, from C:/OpenSceneGraphSrc/OpenSceneGraphSVN/examples/osgQtBrowser/QGraphicsViewAdapter.h:21, from c:/OpenSceneGraphBuild/OpenSceneGraph-SVN/examples/osgQtBrowser/moc_QGraphicsViewAdapter.cxx:10: c:/Qt/4.6.1/include/QtWebKit/../../src/3rdparty/webkit/WebCore/../WebKit/qt/Api/qwebelement.h:23:19: error: QString: No such file or directory
Re: [osg-users] MinGW and OpenSceneGraph
Hello Laurence, Below an overview of my settings (just in case somebody wants to confirm the results) Thanks a lot for testing and for reporting your findings! I'll just comment on one thing: (5) Qt libraries 4.6.1 for Windows (minGW 4.4, 277 MB) Download: http://qt.nokia.com/downloads/windows-cpp Install: just run the setup and use the default location (C:\Qt\4.6.1) ... Unlike what Jean-Sebastien Guay reports here http://thread.gmane.org/gmane.comp.graphics.openscenegraph.cvs/6738 I don't have any problems (might already been fixed): osgviewerQT - no issues osgviewerQtWidget - no issues Excellent, note that I had a preinstalled Qt 4.4.3 (because that's the version we use in our software at work) for Windows / Visual Studio, which is probably what was picked up by CMake, and that's probably the reason I had problems. Anyways, I didn't really want to test that many optional compiles (I had already tested Curl, FFMPEG, etc so I think it was enough for most uses). ;-) The only application that does not wants to build is osgQtBrowser (error message below) The fix is simple: The missing header files should be here: C:\Qt\4.6.1\include\QtCore Seems like the CMakeList.txt files doesn't include the QTCORE header files. Patch: C:\OpenSceneGraphSrc\OpenSceneGraphSVN\examples\osgQtBrowser\CMakeLists.txt from: INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ) to: INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR}) It should now compile just fine. Please send the whole modified CMakeLists.txt file to osg-submissions. That's the way to submit fixes to OSG. It almost compiles out of the box, great job :) ! Only one CMakeList.txt file needs to be patched and perhaps users should be made aware about the symlink (to fix the freetype issue). Yeah, that could be documented (where? Perhaps a message in CMake if MinGW is detected?) Thanks again, 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] osgocean and reflected scene
Hi, is there a way to have a node to be only reflected but not rendered? I have tryied to set up the node mask to just ocean-getOceanScene()-getReflectedSceneMask() but the node still gets rendered Thanks, Nick http://www.linkedin.com/in/tnick Sent from Istanbul, 34, Turkey ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgocean and reflected scene
Hi Nick, is there a way to have a node to be only reflected but not rendered? I have tryied to set up the node mask to just ocean-getOceanScene()-getReflectedSceneMask() but the node still gets rendered This has nothing to do with osgOcean... If you want your node to not be rendered you need to set up the viewer's cull visitor to have a traversal mask different than 0x (which means render anything with a non-zero node mask). So in your case you could use say 0x ~ocean-getOceanScene()-getReflectedSceneMask() which is all bits except the reflected scene mask. You can get the viewer's cull visitor this way: osgViewer::Renderer* renderer = dynamic_castosgViewer::Renderer*(viewer-getCamera()-getRenderer()); renderer-getSceneView(0)-getCullVisitor(); (or if you're using CompositeViewer, get each view's camera and then...) (also do it for SceneView 1 - the SceneViews are double-buffered in multithreaded viewers, better be safe). Hope this helps, 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