Re: [osg-users] Issue with drawing polygons
On 4/17/2011 6:05 PM, Gaurav Garg wrote: > We have separate geometries for both LINE and FILL (Each one can be > dynamically turned off and both can be on at the same time). So, we need not > to switch between these modes. We are using polygon primitives because we > need to support object selection in the application (using > LineSegmentIntersector). > Is there any way, I can select polygons drawn as > Line loop primitive. Not to my knowledge. But couldn't you display the LINE entities, but run the intersection test against the POLYGON portion of the graph? I believe you can begin the intersection test at any point in the graph you wish. -- Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com http://www.alphapixel.com/ Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. Contracting. "There is no Truth. There is only Perception. To Perceive is to Exist." - Xen ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Nvidia Windows7 Dual Monitor Setup
Hi Tim, Glad that you confirm my intuition on this one. So where does the init happen ? (I am not talking about fixing the osgviewer) Where would be the place to start fixing this in osg itself so that it runs as expected out-of-the-box ? Have a look at the osgViewer::View::setUpViewAcrossAllScreens() method. It just loops through the avaiable screens in order (if you have 2 screens it will loop for(i=0;i<2;++i) ) and sets up a view on each, with a translation along X in the view and projection matrices. So that's how you can see that it's making a horizontal arrangement with all screens in numerical order from left to right. The situation on my side is even worse, since e.g. the cow.osg is not just split in the wrong way, but the events from the mouse are only recognized on the "first" screen. I have only seen that with old drivers. What video card are you using? On nvidia cards at least, with recent drivers this doesn't happen anymore. Also flashing that used to occur a lot with fullscreen OSG windows doesn't happen as much with recent drivers. J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.dyndns-web.com/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Issue with drawing polygons
We have separate geometries for both LINE and FILL (Each one can be dynamically turned off and both can be on at the same time). So, we need not to switch between these modes. We are using polygon primitives because we need to support object selection in the application (using LineSegmentIntersector). Is there any way, I can select polygons drawn as Line loop primitive. Thanks, Gaurav -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Chris 'Xenon' Hanson Sent: Monday, April 18, 2011 5:17 AM To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] Issue with drawing polygons On 4/17/2011 11:09 AM, Gaurav Garg wrote: > I am trying to create osg polygon geometry with polygon mode = > osg::PolygonMode::LINE. The issue is that line segment joining first > and last point is not being drawn. This issue is not reprducible on > all the systems. It works fine on my GTX 460 and ATI Radeon 5700 > machines. But, it is producible with other nvidia cards like Quadro 5000 or GF 310M. I have tried using the same driver version on nvidia machines. Do you need to dynamically switch between PolygonMode LINE and FILL, or are you always doing LINEs? Because you could try using a Line Loop primitive instead of polygons. > Has anybody faced similar issue? Any help in this regard will be grateful. I have no experience with this. I know the Quadros have different line-drawing code in their driver, because line-drawing performance is one place where all the money you pay for a Quadro actually makes a big performance difference. -- Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com http://www.alphapixel.com/ Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. Contracting. "There is no Truth. There is only Perception. To Perceive is to Exist." - Xen ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Using only geometries from highest LOD
On 4/17/2011 5:47 PM, Linda Lee wrote: > I need to do screencaptures of a scene from different views. And I need the > terrain to be switched to the highest LOD to capture all details. Is there a > way to force the terrain (an openflight terrain) to switch to the highest LOD > when rendering in OSG? I think there's an example for doing this. Look at the osgposter example -- I think it loads highest LODs before rendering. -- Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com http://www.alphapixel.com/ Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. Contracting. "There is no Truth. There is only Perception. To Perceive is to Exist." - Xen ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Using only geometries from highest LOD
Hi, I need to do screencaptures of a scene from different views. And I need the terrain to be switched to the highest LOD to capture all details. Is there a way to force the terrain (an openflight terrain) to switch to the highest LOD when rendering in OSG? Thank you! Cheers, Linda -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38542#38542 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Issue with drawing polygons
On 4/17/2011 11:09 AM, Gaurav Garg wrote: > I am trying to create osg polygon geometry with polygon mode = > osg::PolygonMode::LINE. The > issue is that line segment joining first and last point is not being drawn. > This issue is > not reprducible on all the systems. It works fine on my GTX 460 and ATI > Radeon 5700 > machines. But, it is producible with other nvidia cards like Quadro 5000 or > GF 310M. I > have tried using the same driver version on nvidia machines. Do you need to dynamically switch between PolygonMode LINE and FILL, or are you always doing LINEs? Because you could try using a Line Loop primitive instead of polygons. > Has anybody faced similar issue? Any help in this regard will be grateful. I have no experience with this. I know the Quadros have different line-drawing code in their driver, because line-drawing performance is one place where all the money you pay for a Quadro actually makes a big performance difference. -- Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com http://www.alphapixel.com/ Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. Contracting. "There is no Truth. There is only Perception. To Perceive is to Exist." - Xen ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Nvidia Windows7 Dual Monitor Setup
Hi, thanks a lot for the fast and detailed answer! Glad that you confirm my intuition on this one. So where does the init happen ? (I am not talking about fixing the osgviewer) Where would be the place to start fixing this in osg itself so that it runs as expected out-of-the-box ? The situation on my side is even worse, since e.g. the cow.osg is not just split in the wrong way, but the events from the mouse are only recognized on the "first" screen. Cheers, Tim Skylark wrote: > Hi Tim, > > > > while running the OSG examples with the OSGViewer I have a very strange > > effect on my machine. The screen is split between my two monitors, but in > > "the wrong" order, e.g. for the cow.osg example the first part is rendered > > to the left screen and the "end" part of the cow is rendered to the right > > screen. > > > > In other words the cow is split in the wrong way. This holds for any > > example, can sombody give me a quick hint, how to fix this ? > > > > I've seen this effect as well, and it seems to me that it's just because > of the way OSG queries the screens. It doesn't seem to consider the > relative positions of the screens at all, it will just always place > screen 0 left-most, screen 1 to the right of that, screen 2 to the right > again and so on. > > It will always do a horizontal arrangement of all screens, i.e. a Nx1 > arrangement for N screens. So in particular, if your screens are say 2x2 > (2 video cards with 2 screens each, placed in a square 2 screens high > and 2 wide), and even though it's configured that way in Windows, OSG > won't see it and will still think it's a 4x1 arrangement. > > So yes, OSG's out-of-the-box support for multiple screens (especially > relative positions) could be better. But I haven't had time to do > anything about it myself. > > Ultimately, if you want to place the screens the way you want, you're > better off making it configurable in your app (similar to the Displays > control panel where you can drag screens around to place them relative > to each other). It could be just a config file to achieve the same > effect. Or you could code up a proper query of screen geometry and > positions through Windows APIs and automatically place viewports on > that. I've done this for our own software, and it's a bit complex but > once you've figured it out it's definitely useful. I wish I could just > transpose that code directly into OSG but it's not possible at present. > > Hope this helps, > > J-S -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38541#38541 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Build UserInterface
thanx for the tip really appreciated ahmed -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38540#38540 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Build UserInterface
ahmed89 wrote: > Hi, > i am currently using osg version 1.2 and i am trying to make user interface > so user can submit commands .. etc > i can use MFC or whatever technology that will help > > any advice that can help me doing this ? > > ... > > Thank you! > > Cheers, > ahmed you can use wxWidget wxGlCanavs which controls the render method Code: #include "wxglcanvassubclass.h" #include #include #include #include #include #include #include #include #include BEGIN_EVENT_TABLE(wxGLCanvasSubClass, wxGLCanvas) EVT_PAINT(wxGLCanvasSubClass::Paintit) END_EVENT_TABLE() wxGLCanvasSubClass::wxGLCanvasSubClass(wxFrame *parent) :wxGLCanvas(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, wxT("GLCanvas")){ osg::setNotifyLevel(osg::ALWAYS); viewer.setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS); viewer.getCullSettings().setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR); float cx = GetSystemMetrics(SM_CXSCREEN); cx/=10; float cy = GetSystemMetrics(SM_CYSCREEN); cy/=10; int width = cx * 5.5; int height = cy * 6; int xPos = cx; int yPos = cy * 2.7; viewer.getCamera(0)->getRenderSurface()->setWindowRectangle(xPos,yPos,width,height); #ifndef __linux viewer.getCamera(0)->getRenderSurface()->fullScreen(false); #endif osg::Group* foregroundGroup = new osg::Group(); osg::Node* modelNode = osgDB::readNodeFile("H2SO4.3DS"); foregroundGroup->addChild(modelNode); foregroundGroup->getOrCreateStateSet()->setMode(GL_LIGHT_MODEL_AMBIENT, osg::StateAttribute::OFF); osg::ref_ptr root = new osg::Group; root->addChild(foregroundGroup); viewer.setSceneData(root.get()); viewer.realize(); } void wxGLCanvasSubClass::Paintit(wxPaintEvent& WXUNUSED(event)){ Render(); } void wxGLCanvasSubClass::Render() { SetCurrent(); wxPaintDC(this); viewer.sync(); viewer.update(); viewer.frame(); } that is it in the constructor you init the osg defaults and in the render method put the code in the while(!viewer.done) loop in osg after that all you need is new wxGLCanvasSubClass(this); in the wxFrame child class in your app -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38539#38539 Attachments: http://forum.openscenegraph.org//files/wxosg_146.rar ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgOcean in CompositeViewer with multiple views
Hi Kim, Firstly thanks for the recent set of commits, much appreciated. Yes, we've started a few more projects that will require a more recent osgOcean build than we'd been using up until now (specifically to be able to see through the surface when the camera is above the water), and so in starting to use the newer versions I fixed a few small issues. The larger one is still to be fixed though :-) Now onto your problem. I had a feeling that that there would be problems when using osgOcean with multiple views, largely because of the LOD system that it employs relying on the main camera. You had mentioned that in the past, yes, but LOD is not that much of an issue to us since all cameras are normally pretty close together so any artifacts are not too visible. However wrong refractions are very visible :-) I've had a play with your composite viewer code and what I don't understand is why the reflection pass renders correctly in both views but not the refraction pass, they both use the same view matrix and despite the multiple render targets their implementations are the same. I know, that's a mystery to me too. Ultimately I think the ViewData approach you suggested is sound, it sounds like the solution mentioned above and I'm pretty sure it's needed to get the post processing effects to work as well. I think so too, and it's what the new osgShadow techniques do, so it would be reusing an existing "pattern" more or less. I'm going to be on vacation until Wednesday of next week (and will stay clear of any technology during that time :-) ) but once I come back I'll start working on a solution in that vein. It'll be pretty important that I do this soon. But I would be keen to dig a bit deeper to figure out why reflections work but refractions don't as this sounds like a bug somewhere. Let me know what you find out, I've looked into it a bit but haven't been able to find anything conclusive. Thanks for your help, J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.dyndns-web.com/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Nvidia Windows7 Dual Monitor Setup
Hi Tim, while running the OSG examples with the OSGViewer I have a very strange effect on my machine. The screen is split between my two monitors, but in "the wrong" order, e.g. for the cow.osg example the first part is rendered to the left screen and the "end" part of the cow is rendered to the right screen. In other words the cow is split in the wrong way. This holds for any example, can sombody give me a quick hint, how to fix this ? I've seen this effect as well, and it seems to me that it's just because of the way OSG queries the screens. It doesn't seem to consider the relative positions of the screens at all, it will just always place screen 0 left-most, screen 1 to the right of that, screen 2 to the right again and so on. It will always do a horizontal arrangement of all screens, i.e. a Nx1 arrangement for N screens. So in particular, if your screens are say 2x2 (2 video cards with 2 screens each, placed in a square 2 screens high and 2 wide), and even though it's configured that way in Windows, OSG won't see it and will still think it's a 4x1 arrangement. So yes, OSG's out-of-the-box support for multiple screens (especially relative positions) could be better. But I haven't had time to do anything about it myself. Ultimately, if you want to place the screens the way you want, you're better off making it configurable in your app (similar to the Displays control panel where you can drag screens around to place them relative to each other). It could be just a config file to achieve the same effect. Or you could code up a proper query of screen geometry and positions through Windows APIs and automatically place viewports on that. I've done this for our own software, and it's a bit complex but once you've figured it out it's definitely useful. I wish I could just transpose that code directly into OSG but it's not possible at present. Hope this helps, J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.dyndns-web.com/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Issue with drawing polygons
Hi All, I am trying to create osg polygon geometry with polygon mode = osg::PolygonMode::LINE. The issue is that line segment joining first and last point is not being drawn. This issue is not reprducible on all the systems. It works fine on my GTX 460 and ATI Radeon 5700 machines. But, it is producible with other nvidia cards like Quadro 5000 or GF 310M. I have tried using the same driver version on nvidia machines. Has anybody faced similar issue? Any help in this regard will be grateful. Thanks, Gaurav ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Nvidia Windows7 Dual Monitor Setup
Hi, while running the OSG examples with the OSGViewer I have a very strange effect on my machine. The screen is split between my two monitors, but in "the wrong" order, e.g. for the cow.osg example the first part is rendered to the left screen and the "end" part of the cow is rendered to the right screen. In other words the cow is split in the wrong way. This holds for any example, can sombody give me a quick hint, how to fix this ? Thank you! Cheers, Tim -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38533#38533 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgOcean in CompositeViewer with multiple views
Hi J-S, Firstly thanks for the recent set of commits, much appreciated. Now onto your problem. I had a feeling that that there would be problems when using osgOcean with multiple views, largely because of the LOD system that it employs relying on the main camera. I've had a play with your composite viewer code and what I don't understand is why the reflection pass renders correctly in both views but not the refraction pass, they both use the same view matrix and despite the multiple render targets their implementations are the same. I wonder if it could be to do with the way that I get the current camera: osg::Camera* currentCamera = cv->getCurrentRenderBin()->getStage()->getCamera(); I understood this to take the view matrix from the root (main) camera but I'm unsure how it behaves with multiples views. But again since the reflection pass appears to work the same in both views I don't understand why this should differ for the refraction pass. My only experience with a multiview camera setup and FBOs is when I wrote an order independent transparency effect for a stereo work wall. In that case I discovered that I had to duplicate all FBOs for each eye otherwise it would simply take the last view that was rendered, that effect was simply rendering to a fullscreen quad though. When I was thinking about how to get osgOcean to work in stereo I came to the conclusion that I would need to implement a similar solution. Ultimately I think the ViewData approach you suggested is sound, it sounds like the solution mentioned above and I'm pretty sure it's needed to get the post processing effects to work as well. But I would be keen to dig a bit deeper to figure out why reflections work but refractions don't as this sounds like a bug somewhere. In the mean time I'll knock up a little test application to test the behaviour of FBOs and multiple views. Let me know your thoughts. K. On 15 April 2011 13:48, Jean-Sébastien Guay wrote: > Hi all, > > > I'll be thankful for any comments / suggestions. >> > > One full day and no suggestions, so I'll assume that my idea of using an > approach similar to the ViewDependentShadow techniques (with ViewData) is in > the right vein, and I think I'll start working on that. > > I'd still appreciate any input on these issues. > > > J-S > -- > __ > Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com > http://www.cm-labs.com/ >http://whitestar02.dyndns-web.com/ > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] problem with osgFX::SpecularHighlights
Hello Lv, when shl->setLightNumber(8) it prints " Warning: detected OpenGL error 'invalid enumerant' at after RenderBin::draw(..) " when set Light Numbe below 8 ,it is OK. The OpenGL fixed pipeline supports up to 8 lights, indices 0 to 7 (enumerants GL_LIGHT0 to GL_LIGHT7). So index 8 is out of bounds. The error is because GL_LIGHT8 doesn't exist. If you want to use more than 8 lights, you have to write your own shaders, and you can't use fixed pipeline techniques. Hope this helps, J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.dyndns-web.com/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Render To Image Crash in RenderStage.cpp - trunk
Hi Matthias, in your second suggestion seems pImage->dirty(); should be placed somewhere to load rendered texture. Regards Sergey ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] VSync & Linux & NVidia
Hi Lv, >I have already enable "Sync to VBlank" in the Nvidia-settings.Every time I first start the computer and run the osg >applicaiton,the VSync seemes not effect,the fps is about 100. see http://forum.openscenegraph.org/viewtopic.php?t=8004 for linux patch ( third post by *Laurens Voerman*) it might help Regards Sergey ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org