Re: [osg-users] VBO fallback behavior and virtual machines
Hi Judson, I haven't played with using virtual machines for rendering so don't have first hand experience. For item 1 - version detection and extension usage, this should in theory work, with the OSG automatically detecting OpenGL 1.1 and lack of VBO support and not using it. The error you are seeing is either the driver claiming to support VBO's or the OSG missing this check. Check what OpenGL version is passed back. Running the OSG with OSG_NOTIFY_LEVEL set to DEBUG or programatically with osg::setNotifyLevel(osg::DEBUG_INFO); will report what version and extensions are supported to the console, along with lots of other stuff too, but redirect the output to a file and then browse through. This should tell you what the OSG has got back from the driver. Robert. On 19 March 2013 23:27, Judson Weissert jud...@mfrac.com wrote: Hello, I have been testing in VirtualBox recently, and encountered two problems that I was hoping someone might recognize. Note: The problems do not occur outside of a virtual environment. 1. I have geometry in my model where I call osg::Geometry::setUseVertexBufferObjects(true), but the virtual environment only supports OpenGL 1.1. An access violation occurs shortly after calling glDrawElements() from DrawElementsUInt::draw(). The last portion of the call stack is as follows (access violation in memcpy() trying to access 0x4fbc): msvcrt.dll!memcpy() + 0x31 bytes opengl32.dll!__gllc_ReducedElementsHandler() + 0x285 bytes opengl32.dll!ReduceDrawElements() + 0x1cb bytes opengl32.dll!__gllc_DrawElements() + 0x121 bytes osg92-osg.dll!osg::DrawElementsUInt::draw(osg::State state={...}, bool useVertexBufferObjects=false) osg92-osg.dll!osg::Geometry::drawImplementation(osg::RenderInfo renderInfo={...}) Taking out the call to setUseVertexBufferObjects() seems to fix the problem. Do I have to detect the OpenGL version explicitly, or is the OSG library supposed to fallback to a non-VBO mode of operation automatically? Also, prior to the crash, I get various Error: glBufferData not supported by OpenGL driver notifications. Also a glGenBuffers() and glBindBuffer() error notification, and a Windows error #127 that mentions wglChoosePixelFormatARB ext not found. 2. If I enable 3D acceleration in VirtualBox, there is no crash, but the scene ends up opening as a separate window and takes up the entire screen. I am not sure how much this issue relates to OSG though. Spy++ shows a window class of OSG Graphics Window for Win32 [{with cursor}], that is not visible in Spy if the window opens as a child window with a non-null parent as expected. Has anyone had success viewing their models using VirtualBox? or VMWare? Thanks, Judson ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Problems deleting objects
Hi, I'm having complications during the transition of the diferent scenes. I want to delete all scene and load a new one. My code structure: I have a class where I define a scene conponents an other things... Code: DemoOSGScene::DemoOSGScene() { ... _rootGroup-addChild(_model-getRootGroup()); _rootGroup-addChild(osgDB::readNodeFile(../../../extras/data/3d_models/scene.fbx)); ... } DemoOSGScene::~DemoOSGScene(void) { _rootGroup-removeChildren(0,_rootGroup-getNumChildren()); delete _model; } _model is a AnimatedModel object that contain osg::ref_ptr osg::Group m_modelRoot. Code: AnimatedModel::~AnimatedModel(void) { delete m_animManager; delete m_morphManager; delete _configReader; //m_modelRoot-unref(); //give me an ref_ptr Access violation error m_modelRoot-unref_nodelete(); //works ok but memory is not liberated } What could be the problem? Thank you! Cheers, Aitor -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=53168#53168 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Problems deleting objects
I think that you should not make an explicit delete of the _model object. The osg::reg_ptr is a smart pointer which manages the memory deletion for you. It is possible that the error is here. Carlos On 20 March 2013 11:12, Aitor Ardanza aitoralt...@terra.es wrote: Hi, I'm having complications during the transition of the diferent scenes. I want to delete all scene and load a new one. My code structure: I have a class where I define a scene conponents an other things... Code: DemoOSGScene::DemoOSGScene() { ... _rootGroup-addChild(_model-getRootGroup()); _rootGroup-addChild(osgDB::readNodeFile(../../../extras/data/3d_models/scene.fbx)); ... } DemoOSGScene::~DemoOSGScene(void) { _rootGroup-removeChildren(0,_rootGroup-getNumChildren()); delete _model; } _model is a AnimatedModel object that contain osg::ref_ptr osg::Group m_modelRoot. Code: AnimatedModel::~AnimatedModel(void) { delete m_animManager; delete m_morphManager; delete _configReader; //m_modelRoot-unref(); //give me an ref_ptr Access violation error m_modelRoot-unref_nodelete(); //works ok but memory is not liberated } What could be the problem? Thank you! Cheers, Aitor -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=53168#53168 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- -- Carlos Reig Matut LSyM - Instituto IRTIC Universidad de Valencia Ph. +34 96 354 3639 -- ext. 43639 http://irtic.uv.es/lsym ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Problems deleting objects
Hi Carlos, I think like you. But if I coment the unref functions the application give me ref_ptr access violation error... Cheers, Aitor -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=53171#53171 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Problems deleting objects
Hi Aitor. On 20 March 2013 12:10, Aitor Ardanza aitoralt...@terra.es wrote: I think like you. But if I coment the unref functions the application give me ref_ptr access violation error... Once you start using ref_ptr for holding pointers to objects you'll no longer need to call ref/unref or delete as all the memory management will be done for you. Once you embrace ref_ptr and other smart pointers you'll find you code simpler and robust. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] VBO fallback behavior and virtual machines
Hi Robert, Thank you for the suggestion. I have attached the notify log. In summary, the log includes a number of entries for features not supported by the OpenGL driver, including GL_ARB_vertex_buffer_object. There are a number of glBufferData errors in the log, but I am not sure of their severity. I did not see the OpenGL version reported in the log, but OpenGL Extension viewer reports 1.1 and also agrees with the extension support reported in the log. I will continue to experiment. Thanks, Judson On 3/20/2013 4:57 AM, Robert Osfield wrote: Hi Judson, I haven't played with using virtual machines for rendering so don't have first hand experience. For item 1 - version detection and extension usage, this should in theory work, with the OSG automatically detecting OpenGL 1.1 and lack of VBO support and not using it. The error you are seeing is either the driver claiming to support VBO's or the OSG missing this check. Check what OpenGL version is passed back. Running the OSG with OSG_NOTIFY_LEVEL set to DEBUG or programatically with osg::setNotifyLevel(osg::DEBUG_INFO); will report what version and extensions are supported to the console, along with lots of other stuff too, but redirect the output to a file and then browse through. This should tell you what the OSG has got back from the driver. Robert. On 19 March 2013 23:27, Judson Weissert jud...@mfrac.com wrote: Hello, I have been testing in VirtualBox recently, and encountered two problems that I was hoping someone might recognize. Note: The problems do not occur outside of a virtual environment. 1. I have geometry in my model where I call osg::Geometry::setUseVertexBufferObjects(true), but the virtual environment only supports OpenGL 1.1. An access violation occurs shortly after calling glDrawElements() from DrawElementsUInt::draw(). The last portion of the call stack is as follows (access violation in memcpy() trying to access 0x4fbc): msvcrt.dll!memcpy() + 0x31 bytes opengl32.dll!__gllc_ReducedElementsHandler() + 0x285 bytes opengl32.dll!ReduceDrawElements() + 0x1cb bytes opengl32.dll!__gllc_DrawElements() + 0x121 bytes osg92-osg.dll!osg::DrawElementsUInt::draw(osg::State state={...}, bool useVertexBufferObjects=false) osg92-osg.dll!osg::Geometry::drawImplementation(osg::RenderInfo renderInfo={...}) Taking out the call to setUseVertexBufferObjects() seems to fix the problem. Do I have to detect the OpenGL version explicitly, or is the OSG library supposed to fallback to a non-VBO mode of operation automatically? Also, prior to the crash, I get various Error: glBufferData not supported by OpenGL driver notifications. Also a glGenBuffers() and glBindBuffer() error notification, and a Windows error #127 that mentions wglChoosePixelFormatARB ext not found. 2. If I enable 3D acceleration in VirtualBox, there is no crash, but the scene ends up opening as a separate window and takes up the entire screen. I am not sure how much this issue relates to OSG though. Spy++ shows a window class of OSG Graphics Window for Win32 [{with cursor}], that is not visible in Spy if the window opens as a child window with a non-null parent as expected. Has anyone had success viewing their models using VirtualBox? or VMWare? Thanks, Judson ___ 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 -- *Judson Weissert* | Software Engineer *Baker Hughes* | Pressure Pumping Office: +1 724 224 1440 | Fax: +1 724 224 1442 jud...@mfrac.com mailto:jud...@mfrac.com | judson.weiss...@bakerhughes.com mailto:judson.weiss...@bakerhughes.com http://www.mfrac.com | /A Global Leader in Hydraulic Fracturing Software/ http://www.bakerhughes.com | /Advancing Reservoir Performance/ CullSettings::readEnvironmentalVariables() DatabasePager::addDatabaseThread() HANDLE_NON_HTTP DatabasePager::addDatabaseThread() HANDLE_ONLY_HTTP Render::Render() 23651BD0 CullSettings::readEnvironmentalVariables() (*Repeated 4x) ShaderComposer::ShaderComposer() 239003F0 CullSettings::readEnvironmentalVariables() ShaderComposer::ShaderComposer() 2390AFF0 _availableQueue.size()=2 GraphicsContext::registerGraphicsContext 23917560 Windows Error #127: [Screen #0] ChooseMatchingPixelFormat() - wglChoosePixelFormatARB extension not found, trying GDI. Reason: The specified procedure could not be found. Rendering in software: pixelFormatIndex 3 ShaderComposer::ShaderComposer() 237AB600 GraphicsContext::createNewContextID() creating contextID=0 Updating the MaxNumberOfGraphicsContexts to 1 CullSettings::readEnvironmentalVariables() Render::Render() 237B1DE0 CullSettings::readEnvironmentalVariables() (*Repeated 4x)
Re: [osg-users] VBO fallback behavior and virtual machines
Update: In an effort to eliminate variables, I compiled the osggeometry example file and ran it in both inside and outside of VirtualBox. It ran fine for both cases. Then, I applied the attached patch and ran it again. The result was no crash outside of the virtual environment, and a crash inside the Virtual Environment. I am assuming the crash is the same, I need to do some additional debugging. Regards, Judson On 3/20/2013 9:57 AM, Judson Weissert wrote: Hi Robert, Thank you for the suggestion. I have attached the notify log. In summary, the log includes a number of entries for features not supported by the OpenGL driver, including GL_ARB_vertex_buffer_object. There are a number of glBufferData errors in the log, but I am not sure of their severity. I did not see the OpenGL version reported in the log, but OpenGL Extension viewer reports 1.1 and also agrees with the extension support reported in the log. I will continue to experiment. Thanks, Judson Index: osggeometry.cpp === --- osggeometry.cpp (revision 44627) +++ osggeometry.cpp (working copy) @@ -503,6 +503,8 @@ polyGeom-setNormalArray(shared_normals.get()); polyGeom-setNormalBinding(osg::Geometry::BIND_OVERALL); +polyGeom-setUseVertexBufferObjects (true); + // This time we simply use primitive, and hardwire the number of coords to use // since we know up front, ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Updating parameter-based procedural geometry
Hi, I have a custom procedural geometry that is generated based on several parameters. Since the generation is fairly expensive, I do not want to perform it more often than necessary. Therefore, I have chosen the following approach: class MyGeode: public osg::Geode { public: // Constructors omitted... int getParameter1() const { return _parameter1; } void setParameter1(int parameter1) { _parameter1 = parameter1; dirty(); } int getParameter2() const { return _parameter2; } void setParameter2(int parameter2) { _parameter2 = parameter2; dirty(); } // ... inline void dirty() { _dirty = true; } virtual void traverse(osg::NodeVisitor) override { if (_dirty) { update(); // Update geometry... _dirty = false; } osg::Geode::traverse(nv); } private: void update(); osg::ref_ptrosg::Geometry _geometry; bool _dirty; int _parameter1; int _parameter2; }; As you can see, I have added a dirty flag to the geode, which gets set whenever a parameter changes. Is this the right way to go in OSG? Are there any pitfalls that I should look out for? I have tried to only use the update traversal like this: if (nv.getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR) { // update } However, the node never got visited by an UpdateVisitor. Do I somehow need to signal that a node needs updating? Can it be dangerous to update the geometry during other traversals? (It seems to work fine...) Cheers, Peter ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Updating parameter-based procedural geometry
Hi, I think the most standard way to do this is to use an UpdateCallback on your osg::Node. This ensure your update code to be executed in the main application thread : UpdateCallbacks are executed during the update traversal, and this is the best way to avoid threading issues. Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=53178#53178 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Updating parameter-based procedural geometry
Ah, thanks for your suggestion. The update callback does indeed work, e.g.: class MyGeodeUpdateCallback: public osg::NodeCallback { public: void operator()(osg::Node* node, osg::NodeVisitor* nv) { MyGeode* myGeode = dynamic_castMyGeode*(node); if (myGeode) myGeode-updateIfDirty(); } }; So, I suppose this is the way to go? Cheers, Peter On Wed, Mar 20, 2013 at 11:15 PM, Aurelien Albert aurelien.alb...@alyotech.fr wrote: Hi, I think the most standard way to do this is to use an UpdateCallback on your osg::Node. This ensure your update code to be executed in the main application thread : UpdateCallbacks are executed during the update traversal, and this is the best way to avoid threading issues. Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=53178#53178 ___ 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] VBO fallback behavior and virtual machines
Hi Judson, On 20/03/13 09:57, Judson Weissert wrote: Has anyone had success viewing their models using VirtualBox? I can confirm textured static and animated models work fine in my app under VirtualBox. I use it as a test environment in my development setup semi-regularly. - Host: Debian Linux 6.0.6 - Guest: Windows XP - OpenSceneGraph 3.0.1 (with some small custom patches) - VirtualBox 4.2.4 r81684 with 3D acceleration enabled - Host hardware is nVidia-based. If more detail on the above would help, just let me know. I run my app windowed, in a small window. Never tried it fullscreen. It's not fast. My demands on it aren't too high. Be careful of shadows though- I've had issues. Sorry that I can't be more specific, but consider disabling shadows as a test if you're having problems. Personally, I don't bother with the non-3D-accelerated setup with VirtualBox any more, because almost everything 3D-related breaks or is unusably slow. If you're developing, you control the hardware. For users, I'd imagine the cases where someone expects to run VirtualBox as a user *and* wants to disable 3D acceleration for a 3D app are very rare. For this reason, I just stick with the enabled setup. Since the 3D acceleration mode works as a pass-through to the host of sorts, having well-behaved 3D hardware on the host is essential. I've mostly stuck with nVidia cards for this purpose. I don't know about ATI, but they'd probably be fine. It's been a while since I've used VMware for this purpose, but I *think* OSG was one of the few engines that could cope with it. I haven't used VMware for a few years now though. I hope this helps. Cheers, Garth On 20/03/13 09:57, Judson Weissert wrote: Hello, I have been testing in VirtualBox recently, and encountered two problems that I was hoping someone might recognize. Note: The problems do not occur outside of a virtual environment. 1. I have geometry in my model where I call osg::Geometry::setUseVertexBufferObjects(true), but the virtual environment only supports OpenGL 1.1. An access violation occurs shortly after calling glDrawElements() from DrawElementsUInt::draw(). The last portion of the call stack is as follows (access violation in memcpy() trying to access 0x4fbc): msvcrt.dll!memcpy() + 0x31 bytes opengl32.dll!__gllc_ReducedElementsHandler() + 0x285 bytes opengl32.dll!ReduceDrawElements() + 0x1cb bytes opengl32.dll!__gllc_DrawElements() + 0x121 bytes osg92-osg.dll!osg::DrawElementsUInt::draw(osg::State state={...}, bool useVertexBufferObjects=false) osg92-osg.dll!osg::Geometry::drawImplementation(osg::RenderInfo renderInfo={...}) Taking out the call to setUseVertexBufferObjects() seems to fix the problem. Do I have to detect the OpenGL version explicitly, or is the OSG library supposed to fallback to a non-VBO mode of operation automatically? Also, prior to the crash, I get various Error: glBufferData not supported by OpenGL driver notifications. Also a glGenBuffers() and glBindBuffer() error notification, and a Windows error #127 that mentions wglChoosePixelFormatARB ext not found. 2. If I enable 3D acceleration in VirtualBox, there is no crash, but the scene ends up opening as a separate window and takes up the entire screen. I am not sure how much this issue relates to OSG though. Spy++ shows a window class of OSG Graphics Window for Win32 [{with cursor}], that is not visible in Spy if the window opens as a child window with a non-null parent as expected. Has anyone had success viewing their models using VirtualBox? or VMWare? Thanks, Judson ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How can I check which objects are frustum culled?
Hiya, In my scene I'd like to check which nodes are being culled before rendering due to frustum culling. The culling mode I use my main (only) camera is osg::CullSettings::VIEW_FRUSTUM_SIDES_CULLING. Is it possible to do this? Can I get a list of objects that are culled, or something similar? Preet ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org