Re: [osg-users] adding object models in osgEarth best practices
Good to hear! As an aside, if you find yourself dealing with clipping issues when zooming in closely to models, take a look at osgEarth::Util::LogarithmicDepthBuffer. Cheers, Eran -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=75943#75943 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] adding object models in osgEarth best practices
Hi David, It would help if you post the code that doesn't work for you so that we can see whats wrong with it. Have you set its location using a GeoPoint? Code: auto model = osgDB::readNodeFile("path-to-model"); auto geoTransform = new osgEarth::GeoTransform; geoTransform->addChild(model); // This sets the location to New ork at an altitude of 1000 meters auto srs = osgEarth::SpatialReference::get("wgs84); GeoPoint newYork(srs, -73.935242, 40.730610, 1000); geoTransform->setLocation(newYork); ... If this isn't the problem then reply with a snippet of the code that isn't working. Cheers, Eran -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=75940#75940 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] adding object models in osgEarth best practices
Hi David, If you're adding a model from code, you can simple load it normally using osgDB::readNodeFile and place it under an osgEarth::GeoTransform to transform to the correct location: Code: auto model = osgDB::readNodeFile("path-to-model"); auto geoTransform = new osgEarth::GeoTransform; geoTransform->addChild(model); ... GeoTransform can place the model using a GeoPoint and orients correctly so that the Z-axis down is toward the earth. To scale and rotate the model, simply put it under an additional transform: Code: auto model = osgDB::readNodeFile("path-to-model"); auto transform = new osg::MatrixTransform; transform->setMatrix(osg::Matrix::scale(10, 10, 10)); transform->addChild(model); auto geoTransform = new osgEarth::GeoTransform; geoTransform->addChild(transform); ... Cheers, Eran -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=75936#75936 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [3rdparty] class osgEarth::Map has no member named 'addImageLayer'
Rodrigo wrote: > Hi, > > I'm following the example from here > (http://docs.osgearth.org/en/latest/developer/maps.html#programmatic-map-creation). > This line, however: > > > Code: > map->addImageLayer( layer ); > > > > won't compile. g++ says: > > > > error: ‘class osgEarth::Map’ has no member named ‘addImageLayer’; did you > > mean ‘addLayer’? > > > > > I tried with addLayer, but then the program compiles but hangs on run, and > won't execute not even the first line, "cout << 1;". > > I'm using version 2.10. I noticed that the documentation > (https://updraft.github.io/osgearth-doc/html/classosgEarth_1_1Map.html) is > from version 2.1. Even the page where I took the example from is titled > "osgEarth 2.4 documentation". Is there an up to date documentation? What am I > doing wrong here? > > Thank you! > > Cheers, > Rodrigo Hi Rodrigo, If I'm not mistaken, the map API was changed in 2.9 to be more generic, so the different map->add*Type*Layer() were changed to map->addLayer(), so that's the reason for the first error. I'm not sure why the program hangs when you use the addLayer() method, but you may have better luck asking in the osgEarth forum. Good luck, Eran Cohen -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=75377#75377 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Selecting a mesh of 3d model (say 3ds model)
ceranco wrote: > > nebsar wrote: > > Hi, > > > > I know how to select a point on a model. Is there anyway to select a > > particular mesh on the 3d model? > > > > Thank you! > > > > Cheers, > > Nebi > > > Hi Nebi, > If I'm not mistaken the layer API changed in 2.9 to be more generic, and you > should simply use: > > Code: > map->addLayer() > > > > As an aside, you will probably get better help for these kind of questions in > the osgEarth forum. > Good luck! > > Eran Cohen Excuse me, I accidentally replied to the wrong post. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=75376#75376 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Selecting a mesh of 3d model (say 3ds model)
nebsar wrote: > Hi, > > I know how to select a point on a model. Is there anyway to select a > particular mesh on the 3d model? > > Thank you! > > Cheers, > Nebi Hi Nebi, If I'm not mistaken the layer API changed in 2.9 to be more generic, and you should simply use: Code: map->addLayer() As an aside, you will probably get better help for these kind of questions in the osgEarth forum. Good luck! Eran Cohen -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=75375#75375 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Update node color on demand
Hi Diego, You can pass user events to the viewer (and thus to its Event Handlers): Code: // This struct will be passed to the event handler with the relevant parameters (for example, the node you want to affect and the color to change it to) struct ChangeColorEvent : public osg::Referenced { ChangeColorEvent(float r, float g, float b, osg::Node* node) { this->r = r; this->g = g; this->b = b; this->node = node; } float r; float g; float b; osg::Node* node; } // When you want to call the event (on a button click in QT for example) viewer->getEventQueue()->userEvent(new ChangeColorEvent{ 1.0, 0.3, 0.4, node }, 0); To handle said event in your EventHandler: Code: class ColorHandler : public osgGA::GUIEventHandler { virtual bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa) override { if (ea.getEventType() == ea.USER) { auto changeColorEvent = dynamic_cast(ea.getUserData()); if (changeColorEvent != nullptr) { // do whatever you want here, for example run the visitor on the node return true; } } return false; } }; Cheers, Eran -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=75241#75241 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Update node color on demand
Hi, To respond to user events you can either inherit from osg::Callback and install it on your node as an EventCallback: Code: class ColorCallback : public osg::Callback { public: virtual bool run(osg::Object* object, osg::Object* data) override { auto nv = dynamic_cast(data); if (nv != nullptr && nv->getVisitorType() == nv->EVENT_VISITOR) { auto events = nv->asEventVisitor()->getEvents(); for (auto event : events) { // handle events } } return traverse(object, data); } }; _lines->addEventCallback(new ColorCallback); or use a global EventHandler and install it on your Viewer: Code: class ColorHandler : public osgGA::GUIEventHandler { virtual bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa) override { if (ea.getEventType() == ea.KEYDOWN) { // handle event } } }; viewer->addEventHandler(new ColorHandler); Cheers, Eran -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=75239#75239 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OpenSceneGraph 3.0 for beginners book Quality
Hi, >From my experience the book is still mostly relevant and will help you quickly >get up to speed. I recommend reading it (or at least the relevant chapters for you), but don't forget that the best way to learn after that is to go through the examples and read their source, as Johny suggested. Good luck, Eran Cohen -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=75074#75074 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Model flickering on osgViewer
That does indeed fix the flickering. My driver is Intel(R) HD Graphic 4000 ver 10.18.10.4885. ceranco wrote: > Hi Laurens, thanks for answering so quickly. > I'll try your suggestion when I get home. > > > > L. Voerman wrote: > > This looks like a driver bug, an reminds me of a problem in the nvidia > > driver having problems with display lists combined with depth_clamp. > > the osgviewer doesn't do the depthclamp, but the display lists might be a > > problem here. > > can you try: > > set OSG_OPTIMIZER=INDEX_MESH > > > > osgviewer cow.osg > > > > > > Laurens. > > > > > > On Thu, Jun 21, 2018 at 12:02 PM Eran Cohen < ()> wrote: > > > > > > > Hi, > > > > > > I compiled OpenSceneGraph 3.6.1 on a recently formatted Windows 10 laptop > > > with up-to-date drivers. > > > When I tried to run osgViewer with cow.osg, the model and screen started > > > to 'flicker': > > > [Image: https://preview.ibb.co/dbVWFT/photo.jpg > > > (https://preview.ibb.co/dbVWFT/photo.jpg) ] (https://ibb.co/jeAnpo > > > (https://ibb.co/jeAnpo)) > > > > > > but interestingly, when I took a screenshot, everything looked alright: > > > [Image: https://preview.ibb.co/ic4u28/screenshot.jpg > > > (https://preview.ibb.co/ic4u28/screenshot.jpg) ] (https://ibb.co/e9ju28 > > > (https://ibb.co/e9ju28)) > > > > > > Previously, the laptop was running Linux and this problem didn't happen. > > > Does anyone have an idea why this is happening? > > > > > > Thanks, > > > Eran > > > > > > -- > > > Read this topic online here: > > > http://forum.openscenegraph.org/viewtopic.php?p=74097#74097 > > > (http://forum.openscenegraph.org/viewtopic.php?p=74097#74097) > > > > > > > > > > > > > > > > > > ___ > > > osg-users mailing list > > > () > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > (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=74106#74106 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Model flickering on osgViewer
Hi Laurens, thanks for answering so quickly. I'll try your suggestion when I get home. L. Voerman wrote: > This looks like a driver bug, an reminds me of a problem in the nvidia driver > having problems with display lists combined with depth_clamp. > the osgviewer doesn't do the depthclamp, but the display lists might be a > problem here. > can you try: > set OSG_OPTIMIZER=INDEX_MESH > > osgviewer cow.osg > > > Laurens. > > > On Thu, Jun 21, 2018 at 12:02 PM Eran Cohen < ()> wrote: > > > > Hi, > > > > I compiled OpenSceneGraph 3.6.1 on a recently formatted Windows 10 laptop > > with up-to-date drivers. > > When I tried to run osgViewer with cow.osg, the model and screen started to > > 'flicker': > > [Image: https://preview.ibb.co/dbVWFT/photo.jpg > > (https://preview.ibb.co/dbVWFT/photo.jpg) ] (https://ibb.co/jeAnpo > > (https://ibb.co/jeAnpo)) > > > > but interestingly, when I took a screenshot, everything looked alright: > > [Image: https://preview.ibb.co/ic4u28/screenshot.jpg > > (https://preview.ibb.co/ic4u28/screenshot.jpg) ] (https://ibb.co/e9ju28 > > (https://ibb.co/e9ju28)) > > > > Previously, the laptop was running Linux and this problem didn't happen. > > Does anyone have an idea why this is happening? > > > > Thanks, > > Eran > > > > -- > > Read this topic online here: > > http://forum.openscenegraph.org/viewtopic.php?p=74097#74097 > > (http://forum.openscenegraph.org/viewtopic.php?p=74097#74097) > > > > > > > > > > > > ___ > > osg-users mailing list > > () > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > (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=74104#74104 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Model flickering on osgViewer
Hi, I compiled OpenSceneGraph 3.6.1 on a recently formatted Windows 10 laptop with up-to-date drivers. When I tried to run osgViewer with cow.osg, the model and screen started to 'flicker': [Image: https://preview.ibb.co/dbVWFT/photo.jpg ] (https://ibb.co/jeAnpo) but interestingly, when I took a screenshot, everything looked alright: [Image: https://preview.ibb.co/ic4u28/screenshot.jpg ] (https://ibb.co/e9ju28) Previously, the laptop was running Linux and this problem didn't happen. Does anyone have an idea why this is happening? Thanks, Eran -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=74097#74097 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Shader Program stops working after Changing Viewer GraphcsContext or Viewer
Hi, I implemented a 'PausableViewer', to enable dynamically 'hiding' and 'showing' the window. I did it in the following way: On pause, I set done to true, create a new GraphicsContext with the same traits of the previous GraphicsContext, stop the viewer threading and switch them - Code: pause() { auto traits = new GraphicsContext::Traits(*getCamera()->getGraphicsContext()->getTraits()); auto gc = GraphicsContext::create(traits); stopThreading(); getCamera()->setGraphicsContext(gc); setDone(true); } On resume, I resume the threading and set done to false - Code: resume() { setDone(false); startThreading(); } This works well, but when using with osgEarth's SkyNode as the scene data of the viewer, after the second context switch and onward, I get these errors in a loop: glValidateProgram FAILED "" id=4 contextID=0 glValidateProgram FAILED "SimpleSky Atmosphere" id=7 contextID=0 Warning: detected OpenGL error 'invalid operation' at RenderBin::draw(..) I can also recreate the error using a regular Viewer, by closing a Viewer but saving the scene data and giving it to a new Viewer: Code: ref_ptr root = new Group; auto mapNode = new MapNode; auto skyNode = SkyNode::create(mapNode); skyNode->addChild(mapNode); root->addChild(skyNode); while (true) { Viewer viewer; viewer.setCameraManipulator(new EarthManipulator); viewer.setSceneData(root); viewer.run(); } I know that this problem might stem from the osgEarth side of things, and I've asked there, but I'm wondering if anyone might have a clue to why this happens. Cheers, Eran -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=73696#73696 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [build] "INSTALL.vcxproj" -- FAILED
This problem seems to have been fixed in the new 3.6.0 release Cheers, Eran -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=73614#73614 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Conflict between osg-3.0.1 and UI
Hi, We have a program with a UI that is built in WPF and WinForms and runs on Windows 7. We have another library that uses OSG-3.0.1 that we are trying to integrate into our program. This library uses OSG to render a picture to the screen (using osgViewer). Our program can run either from the UI or from the command line without the UI. When we try to use the library in our program while using the UI, we get the following error: > Warning: Windows Error #170 : [Screen 0] > GraphicsWindowWin32::makeCurrentImplementation() - Unable to set current > OpenGL rendering context. > Reason: The requested resource is in use. and we get a black picture rendered to the screen. But if we run it from the command line without the UI everything works as expected. We have tried finding packages in our UI that use OSG, but we haven't found any. If anyone has encountered a similar situation before or has any idea in what direction we should look to solve this problem, it would be greatly appreciated. Thank you! Cheers, Eran[/quote] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=73189#73189 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Opening .ico image files with osgDB::readImageFile
Hi, I was wondering if there is a way to read an .ico file, preferably using osgDB. When I try to use it in the following way: Code: osg::Image* icoImage = osgDB::readImageFile("delete.ico") icoImage is null. Thank you! Cheers, Eran -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=73029#73029 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [build] "INSTALL.vcxproj" -- FAILED
Hi Robert, I have no Cmake knowledge, so I didn't change the Cmake script, but rather manually changed the project configurations for all of the examples in visual studio. Right click on the project, select properties. Go to Linker -> Debugging and change the Generate Program Database File to $(ProjectDir)$(AssemblyName)d.pdb The .vcxproj of the osganalysis example now looks like this: > > < Link > > > < AdditionalDependencies > >..\..\lib\osgViewerd.lib;..\..\lib\osgTextd.lib;opengl32.lib;..\..\lib\osgGAd.lib;..\..\lib\osgDBd.lib;C:\Users\ceran\Desktop\OpenSceneGraph-3.4.1\3rdParty\x64\lib\zlibd.lib;..\..\lib\osgUtild.lib;..\..\lib\osgd.lib;..\..\lib\OpenThreadsd.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib< > / AdditionalDependencies > > < AdditionalLibraryDirectories >%(AdditionalLibraryDirectories)< / > AdditionalLibraryDirectories > > < AdditionalOptions >%(AdditionalOptions) /machine:x64< / > AdditionalOptions > > < GenerateDebugInformation >true< / GenerateDebugInformation > > < IgnoreSpecificDefaultLibraries >%(IgnoreSpecificDefaultLibraries)< / > IgnoreSpecificDefaultLibraries > > < ImportLibrary > >C:/Users/ceran/Desktop/OpenSceneGraph-3.4.1/OpenSceneGraph/build/lib/osganalysisd.lib< > / ImportLibrary > > < ProgramDataBaseFile >(ProjectDir)$(AssemblyName)d.pdb< / > ProgramDataBaseFile > > < SubSystem >Console< / SubSystem > > < Version > > < / Version > > < / Link > > The line in bold is the line that was changed. Cheers, Eran -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=72608#72608 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [build] "INSTALL.vcxproj" -- FAILED
For anyone interested, the build failed because of the place that the Cmake install script looked for the .pdb files of the examples. Cmake looked for them in build/examples/example_name, but all the examples built them to build/bin. I manually changed the build location for the .pdb file for all of the examples projects to the macro: Code: $(ProjectDir)$(AssemblyName)d.pdb and it fixed the problem. Cheers, Eran[/quote] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=72600#72600 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] [build] "INSTALL.vcxproj" -- FAILED
Hi, I succeeded in building the OpenScenegraph solution on VS2017 64-bit with the small 3rdParty dependencies, but when I try to build the INSTALL project, it fails with this message: > > 1>C:\Program Files (x86)\Microsoft Visual > Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): > error MSB3073: The command "setlocal > 1>C:\Program Files (x86)\Microsoft Visual > Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): > error MSB3073: "C:\Program Files\CMake\bin\cmake.exe" -DBUILD_TYPE=Debug -P > cmake_install.cmake > 1>C:\Program Files (x86)\Microsoft Visual > Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): > error MSB3073: if %errorlevel% neq 0 goto :cmEnd > 1>C:\Program Files (x86)\Microsoft Visual > Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): > error MSB3073: :cmEnd > 1>C:\Program Files (x86)\Microsoft Visual > Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): > error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone > 1>C:\Program Files (x86)\Microsoft Visual > Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): > error MSB3073: :cmErrorLevel > 1>C:\Program Files (x86)\Microsoft Visual > Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): > error MSB3073: exit /b %1 > 1>C:\Program Files (x86)\Microsoft Visual > Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): > error MSB3073: :cmDone > 1>C:\Program Files (x86)\Microsoft Visual > Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): > error MSB3073: if %errorlevel% neq 0 goto :VCEnd > 1>C:\Program Files (x86)\Microsoft Visual > Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(133,5): > error MSB3073: :VCEnd" exited with code 1. > 1>Done building project "INSTALL.vcxproj" -- FAILED. > I am using OpenSceneGraph 3.4.1 source files and CMake 3.9.6, but this has happened with CMake 3.10.1 as well. Thank you! Cheers, Eran -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=72590#72590 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org